Esempio n. 1
0
        public Attributes2014(string arrangementFileName, Arrangement arrangement, DLCPackageData info, Platform platform)
            : base(arrangementFileName, arrangement, info, platform)
        {
            #region VARIABLES

            var dlcName = info.Name.ToLower();

            var xblockUrn    = String.Format(URN_TEMPLATE_SHORT, TagValue.EmergentWorld.GetDescription(), dlcName);
            var showlightUrn = String.Format(URN_TEMPLATE, TagValue.Application.GetDescription(), TagValue.XML.GetDescription(), String.Format("{0}_showlights", dlcName));
            var songXmlUrn   = String.Format(URN_TEMPLATE, TagValue.Application.GetDescription(), TagValue.XML.GetDescription(), String.Format(AggregateGraph2014.NAME_ARRANGEMENT, dlcName, arrangementFileName));
            var songSngUrn   = String.Format(URN_TEMPLATE, TagValue.Application.GetDescription(), TagValue.MusicgameSong.GetDescription(), String.Format(AggregateGraph2014.NAME_ARRANGEMENT, dlcName, arrangementFileName));

            var manifestFunctions = new ManifestFunctions(platform.version);

            #endregion

            #region FILL ATTRIBUTES

            ArrangementSort = arrangement.ArrangementSort;
            BlockAsset      = xblockUrn;
            manifestFunctions.GenerateDynamicVisualDensity(this, SongContent, arrangement);
            FullName           = String.Format(AggregateGraph2014.NAME_ARRANGEMENT, info.Name, arrangement.Name);
            MasterID_PS3       = (IsVocal) ? -1 : arrangement.MasterId;
            MasterID_Xbox360   = (IsVocal) ? -1 : arrangement.MasterId;
            PreviewBankPath    = String.Format("song_{0}_preview.bnk", info.Name.ToLower());
            RelativeDifficulty = 0; //Always 0 in RS2014
            ShowlightsXML      = showlightUrn;
            SongAsset          = songSngUrn;
            SongBank           = String.Format("song_{0}.bnk", info.Name.ToLower());
            SongEvent          = String.Format("Play_{0}", info.Name);
            SongXml            = songXmlUrn;
            SongVolume         = info.Volume;
            PreviewVolume      = (info.PreviewVolume != null) ? info.PreviewVolume : SongVolume;

            // Only for Vocal
            if (IsVocal)
            {
                InputEvent = "Play_Tone_Standard_Mic";
            }

            // Only for instruments
            if (!IsVocal)
            {
                ArrangementProperties            = SongContent.ArrangementProperties;
                ArrangementProperties.BassPick   = (int)arrangement.PluckedType;
                ArrangementProperties.PathLead   = Convert.ToInt32(arrangement.RouteMask == DLCPackage.RouteMask.Lead);
                ArrangementProperties.PathRhythm = Convert.ToInt32(arrangement.RouteMask == DLCPackage.RouteMask.Rhythm);
                ArrangementProperties.PathBass   = Convert.ToInt32(arrangement.RouteMask == DLCPackage.RouteMask.Bass);
                ArrangementProperties.RouteMask  = (int)arrangement.RouteMask;

                // BONUS ARRANGEMENT
                ArrangementProperties.BonusArr = Convert.ToInt32(arrangement.BonusArr);

                if (arrangement.Name == Sng.ArrangementName.Combo)
                { //Exclusive condition
                    if (arrangement.RouteMask == DLCPackage.RouteMask.Lead)
                    {
                        ArrangementType = (int)Sng.ArrangementName.Lead;
                    }
                    else if (arrangement.RouteMask == DLCPackage.RouteMask.Rhythm)
                    {
                        ArrangementType = (int)Sng.ArrangementName.Rhythm;
                    }
                    else
                    {
                        ArrangementType = (int)arrangement.Name;
                    }
                }
                else
                {
                    ArrangementType = (int)arrangement.Name;
                }

                //Chords        -- //TODO: MISSING GENERATE

                ChordTemplates = new List <ChordTemplate>();
                manifestFunctions.GenerateChordTemplateData(this, SongContent);

                LastConversionDateTime = SongContent.LastConversionDateTime;
                MaxPhraseDifficulty    = manifestFunctions.GetMaxDifficulty(SongContent);

                TargetScore      = 100000;
                PhraseIterations = new List <PhraseIteration>();
                manifestFunctions.GeneratePhraseIterationsData(this, SongContent, platform.version);
                //Score_MaxNotes -- Generated on function above
                //Score_PNV      -- Generated on function above

                Phrases = new List <Phrase>();
                manifestFunctions.GeneratePhraseData(this, SongContent);

                Sections = new List <Section>();
                manifestFunctions.GenerateSectionData(this, SongContent);

                SongAverageTempo = SongContent.AverageTempo;
                SongOffset       = arrangement.Sng2014.Metadata.StartTime * -1;

                //SongPartition  -- Generated in DLCPackageCreator after this constructor

                //Techniques     -- //TODO: MISSING GENERATE
                Tone_A           = arrangement.ToneA;
                Tone_B           = arrangement.ToneB;
                Tone_Base        = arrangement.ToneBase;
                Tone_C           = arrangement.ToneC;
                Tone_D           = arrangement.ToneD;
                Tone_Multiplayer = arrangement.ToneMultiplayer;

                Tones = new List <Tone2014>();
                if (!String.IsNullOrEmpty(arrangement.ToneA))
                {
                    Tones.Add(info.TonesRS2014.SingleOrDefault(t => t.Name == Tone_A));
                }
                if (!String.IsNullOrEmpty(arrangement.ToneB))
                {
                    Tones.Add(info.TonesRS2014.SingleOrDefault(t => t.Name == Tone_B));
                }
                if (!String.IsNullOrEmpty(arrangement.ToneBase))
                {
                    Tones.Add(info.TonesRS2014.SingleOrDefault(t => t.Name == Tone_Base));
                }
                if (!String.IsNullOrEmpty(arrangement.ToneC))
                {
                    Tones.Add(info.TonesRS2014.SingleOrDefault(t => t.Name == Tone_C));
                }
                if (!String.IsNullOrEmpty(arrangement.ToneD))
                {
                    Tones.Add(info.TonesRS2014.SingleOrDefault(t => t.Name == Tone_D));
                }
                if (!String.IsNullOrEmpty(arrangement.ToneMultiplayer))
                {
                    Tones.Add(info.TonesRS2014.SingleOrDefault(t => t.Name == Tone_Multiplayer));
                }
            }

            #endregion
        }
Esempio n. 2
0
        public string GenerateManifest(string dlcKey, IList <Arrangement> arrangements, SongInfo songInfo, Platform platform)
        {
            var manifest = Manifest;

            manifest.Entries = new Dictionary <string, Dictionary <string, Attributes> >();
            bool firstarrangset = false;

            Arrangement vocal = null;

            if (arrangements.Any <Arrangement>(a => a.ArrangementType == Sng.ArrangementType.Vocal))
            {
                vocal = arrangements.Single <Arrangement>(a => a.ArrangementType == Sng.ArrangementType.Vocal);
            }

            var manifestFunctions = new ManifestFunctions(platform.version);
            var songPartition     = new SongPartition();

            foreach (var arr in arrangements)
            {
                var isVocal   = arr.ArrangementType == Sng.ArrangementType.Vocal;
                var song      = (isVocal) ? null : Song.LoadFromFile(arr.SongXml.File);
                var attribute = new Attributes();

                attribute.AlbumArt             = String.Format("urn:llid:{0}", AggregateGraph.AlbumArt.LLID);
                attribute.AlbumName            = songInfo.Album;
                attribute.AlbumNameSort        = songInfo.AlbumSort;
                attribute.ArrangementName      = arr.ArrangementName.ToString();
                attribute.ArtistName           = songInfo.Artist;
                attribute.ArtistNameSort       = songInfo.ArtistSort;
                attribute.AssociatedTechniques = new List <string>();
                //Should be 51 for bass, 49 for vocal and guitar
                attribute.BinaryVersion = arr.ArrangementType == Sng.ArrangementType.Bass ? 51 : 49;
                attribute.BlockAsset    = String.Format("urn:emergent-world:{0}", AggregateGraph.XBlock.Name);

                if (!isVocal)
                {
                    attribute.ChordTemplates = new List <ChordTemplate>();
                }

                attribute.DISC_DLC_OTHER             = "Disc";
                attribute.DisplayName                = songInfo.SongDisplayName;
                attribute.DLCPreview                 = false;
                attribute.EffectChainMultiplayerName = String.Empty;
                // NOTE: attribute.EffectChainName = tone.Key
                // attribute.EffectChainName = isVocal ? "" : (arr.ToneBase == null ? throw new DataException("<ERROR> " + arr.ArrangementName + " ToneBase/ToneKey is null ...") : arr.ToneBase);

                if (isVocal)
                {
                    attribute.EffectChainName = "";
                }
                else
                {
                    if (arr.ToneBase == null)
                    {
                        throw new DataException("<ERROR> " + arr.ArrangementName + " ToneBase/ToneKey is null ...");
                    }
                    else // ToneBase w/ space <=> tone.Name w/ space <=> tone.Key w/o space
                    {
                        attribute.EffectChainName = arr.ToneBase.GetValidKey(isTone: true);
                    }
                }
                attribute.EventFirstTimeSortOrder = 9999;
                attribute.ExclusiveBuild          = new List <object>();
                attribute.FirstArrangementInSong  = false;
                attribute.ForceUseXML             = true;
                attribute.Genre      = "PLACEHOLDER Genre";
                attribute.InputEvent = isVocal ? "Play_Tone_Standard_Mic" : "Play_Tone_";
                attribute.IsDemoSong = false;
                attribute.IsDLC      = true;

                if (!isVocal)
                {
                    attribute.LastConversionDateTime = song.LastConversionDateTime;
                }

                // TODO: improve this
                int masterId = isVocal ? 1 : arr.MasterId;
                attribute.MasterID_PS3     = masterId;
                attribute.MasterID_Xbox360 = masterId;

                if (!isVocal)
                {
                    attribute.MaxPhraseDifficulty = manifestFunctions.GetMaxDifficulty(song);
                }

                attribute.PersistentID     = arr.Id.ToString().Replace("-", "").ToUpper();
                attribute.PhraseIterations = new List <PhraseIteration>();
                attribute.Phrases          = new List <Phrase>();
                attribute.PluckedType      = arr.PluckedType == Sng.PluckedType.Picked ? "Picked" : "Not Picked"; // TODO: FIXME

                if (isVocal)
                {
                    attribute.RelativeDifficulty        = 0;
                    attribute.RepresentativeArrangement = false;
                }
                else
                {
                    attribute.RelativeDifficulty        = song.Levels.Length; //TODO: FIXME
                    attribute.RepresentativeArrangement = true;
                }

                attribute.Score_MaxNotes = 0;
                attribute.Score_PNV      = 0;
                attribute.Sections       = new List <Section>();
                attribute.Shipping       = true;
                attribute.SongAsset      = String.Format("urn:llid:{0}", arr.SongFile.LLID);

                if (!isVocal)
                {
                    attribute.SongDifficulty = (float)song.PhraseIterations.Average(it => song.Phrases[it.PhraseId].MaxDifficulty);
                }

                attribute.SongEvent    = String.Format("Play_{0}", dlcKey);
                attribute.SongKey      = dlcKey;
                attribute.SongLength   = 0;
                attribute.SongName     = songInfo.SongDisplayName;
                attribute.SongNameSort = songInfo.SongDisplayNameSort;

                if (!isVocal)
                {
                    attribute.SongPartition = songPartition.GetSongPartition(arr.ArrangementName, arr.ArrangementType);
                    attribute.SongLength    = (float)Math.Round((decimal)song.SongLength, 3, MidpointRounding.AwayFromZero); //rounded
                }

                attribute.SongXml  = String.Format("urn:llid:{0}", arr.SongXml.LLID);
                attribute.SongYear = songInfo.SongYear;

                if (isVocal)
                {
                    attribute.TargetScore     = 0;
                    attribute.ToneUnlockScore = 0;
                }
                else
                {
                    attribute.TargetScore     = 100000;
                    attribute.ToneUnlockScore = 70000;
                }

                attribute.TwoHandTapping = false;
                attribute.UnlockKey      = "";
                attribute.Tuning         = arr.Tuning;
                attribute.VocalsAssetId  = arr.ArrangementType == Sng.ArrangementType.Vocal ? "" : (vocal != null) ? String.Format("{0}|GRSong_{1}", vocal.Id, vocal.ArrangementName) : "";

                if (!firstarrangset && arr == arrangements.First())
                {
                    firstarrangset = true;
                    attribute.FirstArrangementInSong = true;
                }

                manifestFunctions.GenerateDynamicVisualDensity(attribute, song, arr, GameVersion.RS2012);

                if (!isVocal)
                {
                    #region Include Associated Techniques

                    attribute.PowerChords = song.HasPowerChords();
                    if (attribute.PowerChords)
                    {
                        AssociateTechniques(arr, attribute, "PowerChords");
                    }
                    attribute.BarChords = song.HasBarChords();
                    if (attribute.BarChords)
                    {
                        AssociateTechniques(arr, attribute, "BarChords");
                    }
                    attribute.OpenChords = song.HasOpenChords();
                    if (attribute.OpenChords)
                    {
                        AssociateTechniques(arr, attribute, "ChordIntro");
                    }
                    attribute.DoubleStops = song.HasDoubleStops();
                    if (attribute.DoubleStops)
                    {
                        AssociateTechniques(arr, attribute, "DoubleStops");
                    }
                    attribute.Sustain = song.HasSustain();
                    if (attribute.Sustain)
                    {
                        AssociateTechniques(arr, attribute, "Sustain");
                    }
                    attribute.Bends = song.HasBends();
                    if (attribute.Bends)
                    {
                        AssociateTechniques(arr, attribute, "Bends");
                    }
                    attribute.Slides = song.HasSlides();
                    if (attribute.Slides)
                    {
                        AssociateTechniques(arr, attribute, "Slides");
                    }
                    attribute.Tremolo = song.HasTremolo();
                    if (attribute.Tremolo)
                    {
                        AssociateTechniques(arr, attribute, "Tremolo");
                    }
                    attribute.SlapAndPop = song.HasSlapAndPop();
                    if (attribute.SlapAndPop)
                    {
                        AssociateTechniques(arr, attribute, "Slap");
                    }
                    attribute.Harmonics = song.HasHarmonics();
                    if (song.HasHarmonics())
                    {
                        AssociateTechniques(arr, attribute, "Harmonics");
                    }
                    attribute.PalmMutes = song.HasPalmMutes();
                    if (attribute.Harmonics)
                    {
                        AssociateTechniques(arr, attribute, "PalmMutes");
                    }
                    attribute.HOPOs = song.HasHOPOs();
                    if (attribute.HOPOs)
                    {
                        AssociateTechniques(arr, attribute, "HOPOs");
                    }
                    attribute.FretHandMutes = song.HasFretHandMutes();
                    if (attribute.FretHandMutes)
                    {
                        AssociateTechniques(arr, attribute, "FretHandMutes");
                    }
                    attribute.DropDPowerChords = song.HasDropDPowerChords();
                    if (attribute.DropDPowerChords)
                    {
                        AssociateTechniques(arr, attribute, "DropDPowerChords");
                    }
                    attribute.Prebends = song.HasPrebends();
                    if (attribute.Prebends)
                    {
                        AssociateTechniques(arr, attribute, "Prebends");
                    }
                    attribute.Vibrato = song.HasVibrato();
                    if (attribute.Vibrato)
                    {
                        AssociateTechniques(arr, attribute, "Vibrato");
                    }

                    //Bass exclusive
                    attribute.TwoFingerPlucking = song.HasTwoFingerPlucking();
                    if (attribute.TwoFingerPlucking)
                    {
                        AssociateTechniques(arr, attribute, "Plucking");
                    }
                    attribute.FifthsAndOctaves = song.HasFifthsAndOctaves();
                    if (attribute.FifthsAndOctaves)
                    {
                        AssociateTechniques(arr, attribute, "Octave");
                    }
                    attribute.Syncopation = song.HasSyncopation();
                    if (attribute.Syncopation)
                    {
                        AssociateTechniques(arr, attribute, "Syncopation");
                    }

                    #endregion

                    manifestFunctions.GenerateChordTemplateData(attribute, song);
                    manifestFunctions.GeneratePhraseData(attribute, song);
                    manifestFunctions.GenerateSectionData(attribute, song);
                    manifestFunctions.GeneratePhraseIterationsData(attribute, song, platform.version);
                }

                var attrDict = new Dictionary <string, Attributes> {
                    { "Attributes", attribute }
                };
                manifest.Entries.Add(attribute.PersistentID, attrDict);
            }

            manifest.ModelName        = "GRSong_Asset";
            manifest.IterationVersion = 2;

            var jsonManifest = JsonConvert.SerializeObject(manifest, Formatting.Indented);
            return(jsonManifest);
        }
        public Attributes2014(string arrangementFileName, Arrangement arrangement, DLCPackageData info, Platform platform)
            : base(arrangementFileName, arrangement, info, platform)
        {
            #region VARIABLES

            var dlcName = info.Name.ToLower();

            var xblockUrn = String.Format(URN_TEMPLATE_SHORT, TagValue.EmergentWorld.GetDescription(), dlcName);
            var showlightUrn = String.Format(URN_TEMPLATE, TagValue.Application.GetDescription(), TagValue.XML.GetDescription(), String.Format("{0}_showlights", dlcName));
            var songXmlUrn = String.Format(URN_TEMPLATE, TagValue.Application.GetDescription(), TagValue.XML.GetDescription(), String.Format(AggregateGraph2014.NAME_ARRANGEMENT, dlcName, arrangementFileName));
            var songSngUrn = String.Format(URN_TEMPLATE, TagValue.Application.GetDescription(), TagValue.MusicgameSong.GetDescription(), String.Format(AggregateGraph2014.NAME_ARRANGEMENT, dlcName, arrangementFileName));

            var manifestFunctions = new ManifestFunctions(platform.version);

            #endregion

            #region FILL ATTRIBUTES

            ArrangementSort = arrangement.ArrangementSort;
            BlockAsset = xblockUrn;
            manifestFunctions.GenerateDynamicVisualDensity(this, SongContent, arrangement);
            FullName = String.Format(AggregateGraph2014.NAME_ARRANGEMENT, info.Name, arrangement.Name);
            MasterID_PS3 = (IsVocal) ? -1 : arrangement.MasterId;
            MasterID_Xbox360 = (IsVocal) ? -1 : arrangement.MasterId;
            PreviewBankPath = String.Format("song_{0}_preview.bnk", info.Name.ToLower());
            RelativeDifficulty = 0; //Always 0 in RS2014
            ShowlightsXML = showlightUrn;
            SongAsset = songSngUrn;
            SongBank = String.Format("song_{0}.bnk", info.Name.ToLower());
            SongEvent = String.Format("Play_{0}", info.Name);
            SongXml = songXmlUrn;
            SongVolume = info.Volume;
            PreviewVolume = (info.PreviewVolume != null) ? info.PreviewVolume : SongVolume;

            // Only for Vocal
            if (IsVocal)
                InputEvent = "Play_Tone_Standard_Mic";

            // Only for instruments
            if (!IsVocal)
            {
                ArrangementProperties = SongContent.ArrangementProperties;
                ArrangementProperties.BassPick = (int)arrangement.PluckedType;
                ArrangementProperties.PathLead = Convert.ToInt32(arrangement.RouteMask == DLCPackage.RouteMask.Lead);
                ArrangementProperties.PathRhythm = Convert.ToInt32(arrangement.RouteMask == DLCPackage.RouteMask.Rhythm);
                ArrangementProperties.PathBass = Convert.ToInt32(arrangement.RouteMask == DLCPackage.RouteMask.Bass);
                ArrangementProperties.RouteMask = (int)arrangement.RouteMask;

                // BONUS ARRANGEMENT
                ArrangementProperties.BonusArr = Convert.ToInt32(arrangement.BonusArr);

                if (arrangement.Name == Sng.ArrangementName.Combo)
                { //Exclusive condition
                    if (arrangement.RouteMask == DLCPackage.RouteMask.Lead)
                        ArrangementType = (int)Sng.ArrangementName.Lead;
                    else if (arrangement.RouteMask == DLCPackage.RouteMask.Rhythm)
                        ArrangementType = (int)Sng.ArrangementName.Rhythm;
                    else
                        ArrangementType = (int)arrangement.Name;
                }
                else
                    ArrangementType = (int)arrangement.Name;

                //Chords        -- //TODO: MISSING GENERATE

                ChordTemplates = new List<ChordTemplate>();
                manifestFunctions.GenerateChordTemplateData(this, SongContent);

                LastConversionDateTime = SongContent.LastConversionDateTime;
                MaxPhraseDifficulty = manifestFunctions.GetMaxDifficulty(SongContent);

                TargetScore = 100000;
                PhraseIterations = new List<PhraseIteration>();
                manifestFunctions.GeneratePhraseIterationsData(this, SongContent, platform.version);
                //Score_MaxNotes -- Generated on function above
                //Score_PNV      -- Generated on function above

                Phrases = new List<Phrase>();
                manifestFunctions.GeneratePhraseData(this, SongContent);

                Sections = new List<Section>();
                manifestFunctions.GenerateSectionData(this, SongContent);

                SongAverageTempo = SongContent.AverageTempo;
                SongOffset = arrangement.Sng2014.Metadata.StartTime * -1;

                //SongPartition  -- Generated in DLCPackageCreator after this constructor

                //Techniques     -- //TODO: MISSING GENERATE

                //Fix for Dead tones
                var it = info.TonesRS2014;
                Tones = new List<Tone2014>();

                Tone_A = GetToneName(arrangement.ToneA, it);
                Tone_B = GetToneName(arrangement.ToneB, it);
                Tone_Base = GetToneName(arrangement.ToneBase, it);
                Tone_C = GetToneName(arrangement.ToneC, it);
                Tone_D = GetToneName(arrangement.ToneD, it);
                Tone_Multiplayer = GetToneName(arrangement.ToneMultiplayer, it);
            }

            #endregion
        }
        public string GenerateManifest(string dlcName, IList<Arrangement> arrangements, SongInfo songInfo, Platform platform)
        {
            var manifest = Manifest;
            manifest.Entries = new Dictionary<string, Dictionary<string, Attributes>>();
            bool firstarrangset = false;

            Arrangement vocal = null;
            if (arrangements.Any<Arrangement>(a => a.ArrangementType == Sng.ArrangementType.Vocal))
                vocal = arrangements.Single<Arrangement>(a => a.ArrangementType == Sng.ArrangementType.Vocal);

            var manifestFunctions = new ManifestFunctions(platform.version);
            var songPartition = new SongPartition();

            foreach (var x in arrangements)
            {
                var isVocal = x.ArrangementType == Sng.ArrangementType.Vocal;
                var song = (isVocal) ? null : Song.LoadFromFile(x.SongXml.File);

                var attribute = new Attributes();
                attribute.AlbumArt = String.Format("urn:llid:{0}", AggregateGraph.AlbumArt.LLID);
                attribute.AlbumNameSort = attribute.AlbumName = songInfo.Album;
                attribute.ArrangementName = x.Name.ToString();
                attribute.ArtistName = songInfo.Artist;
                attribute.ArtistNameSort = songInfo.ArtistSort;
                attribute.AssociatedTechniques = new List<string>();
                //Should be 51 for bass, 49 for vocal and guitar
                attribute.BinaryVersion = x.ArrangementType == Sng.ArrangementType.Bass ? 51 : 49;
                attribute.BlockAsset = String.Format("urn:emergent-world:{0}", AggregateGraph.XBlock.Name);
                attribute.ChordTemplates = null;
                attribute.DISC_DLC_OTHER = "Disc";
                attribute.DisplayName = songInfo.SongDisplayName;
                attribute.DLCPreview = false;
                attribute.EffectChainMultiplayerName = string.Empty;
                attribute.EffectChainName = isVocal ? "" : (dlcName + "_" + x.ToneBase == null ? "Default" : x.ToneBase.Replace(' ', '_'));
                attribute.EventFirstTimeSortOrder = 9999;
                attribute.ExclusiveBuild = new List<object>();
                attribute.FirstArrangementInSong = false;
                if (isVocal && !firstarrangset)
                {
                    firstarrangset = true;
                    attribute.FirstArrangementInSong = true;
                }
                attribute.ForceUseXML = true;
                attribute.Tag = "PLACEHOLDER Tag";
                attribute.InputEvent = isVocal ? "Play_Tone_Standard_Mic" : "Play_Tone_";
                attribute.IsDemoSong = false;
                attribute.IsDLC = true;
                attribute.LastConversionDateTime = "";
                int masterId = isVocal ? 1 : x.MasterId;
                attribute.MasterID_PS3 = masterId;
                attribute.MasterID_Xbox360 = masterId;
                attribute.MaxPhraseDifficulty = 0;
                attribute.PersistentID = x.Id.ToString().Replace("-", "").ToUpper();
                attribute.PhraseIterations = new List<PhraseIteration>();
                attribute.Phrases = new List<Phrase>();
                attribute.PluckedType = x.PluckedType == Sng.PluckedType.Picked ? "Picked" : "Not Picked";
                attribute.RelativeDifficulty = isVocal ? 0 : song.Levels.Count();
                attribute.RepresentativeArrangement = false;
                attribute.Score_MaxNotes = 0;
                attribute.Score_PNV = 0;
                attribute.Sections = new List<Section>();
                attribute.Shipping = true;
                attribute.SongAsset = String.Format("urn:llid:{0}", x.SongFile.LLID);
                attribute.SongEvent = String.Format("Play_{0}", dlcName);
                attribute.SongKey = dlcName;
                attribute.SongLength = 0;
                attribute.SongName = songInfo.SongDisplayName;
                attribute.SongNameSort = songInfo.SongDisplayNameSort;
                attribute.SongXml = String.Format("urn:llid:{0}", x.SongXml.LLID);
                attribute.SongYear = songInfo.SongYear;
                attribute.TargetScore = 0;
                attribute.ToneUnlockScore = 0;
                attribute.TwoHandTapping = false;
                attribute.UnlockKey = "";
                attribute.Tuning = x.Tuning;
                attribute.VocalsAssetId = x.ArrangementType == Sng.ArrangementType.Vocal ? "" : (vocal != null) ? String.Format("{0}|GRSong_{1}", vocal.Id, vocal.Name) : "";
                attribute.ChordTemplates = new List<ChordTemplate>();
                manifestFunctions.GenerateDynamicVisualDensity(attribute, song, x);

                if (!isVocal)
                {
                    #region "Associated Techniques"

                    attribute.PowerChords = song.HasPowerChords();
                    if (song.HasPowerChords()) AssociateTechniques(x, attribute, "PowerChords");
                    attribute.BarChords = song.HasBarChords();
                    if (song.HasBarChords()) AssociateTechniques(x, attribute, "BarChords");
                    attribute.OpenChords = song.HasOpenChords();
                    if (song.HasOpenChords()) AssociateTechniques(x, attribute, "ChordIntro");
                    attribute.DoubleStops = song.HasDoubleStops();
                    if (song.HasDoubleStops()) AssociateTechniques(x, attribute, "DoubleStops");
                    attribute.Sustain = song.HasSustain();
                    if (song.HasSustain()) AssociateTechniques(x, attribute, "Sustain");
                    attribute.Bends = song.HasBends();
                    if (song.HasBends()) AssociateTechniques(x, attribute, "Bends");
                    attribute.Slides = song.HasSlides();
                    if (song.HasSlides()) AssociateTechniques(x, attribute, "Slides");
                    attribute.Tremolo = song.HasTremolo();
                    if (song.HasTremolo()) AssociateTechniques(x, attribute, "Tremolo");
                    attribute.SlapAndPop = song.HasSlapAndPop();
                    if (song.HasSlapAndPop()) AssociateTechniques(x, attribute, "Slap");
                    attribute.Harmonics = song.HasHarmonics();
                    if (song.HasHarmonics()) AssociateTechniques(x, attribute, "Harmonics");
                    attribute.PalmMutes = song.HasPalmMutes();
                    if (song.HasPalmMutes()) AssociateTechniques(x, attribute, "PalmMutes");
                    attribute.HOPOs = song.HasHOPOs();
                    if (song.HasHOPOs()) AssociateTechniques(x, attribute, "HOPOs");
                    attribute.FretHandMutes = song.HasFretHandMutes();
                    if (song.HasFretHandMutes()) AssociateTechniques(x, attribute, "FretHandMutes");
                    attribute.DropDPowerChords = song.HasDropDPowerChords();
                    if (song.HasDropDPowerChords()) AssociateTechniques(x, attribute, "DropDPowerChords");
                    attribute.Prebends = song.HasPrebends();
                    if (song.HasPrebends()) AssociateTechniques(x, attribute, "Prebends");
                    attribute.Vibrato = song.HasVibrato();
                    if (song.HasVibrato()) AssociateTechniques(x, attribute, "Vibrato");

                    //Bass exclusive
                    attribute.TwoFingerPlucking = song.HasTwoFingerPlucking();
                    if (song.HasTwoFingerPlucking()) AssociateTechniques(x, attribute, "Plucking");
                    attribute.FifthsAndOctaves = song.HasFifthsAndOctaves();
                    if (song.HasFifthsAndOctaves()) AssociateTechniques(x, attribute, "Octave");
                    attribute.Syncopation = song.HasSyncopation();
                    if (song.HasSyncopation()) AssociateTechniques(x, attribute, "Syncopation");

                    #endregion

                    attribute.AverageTempo = songInfo.AverageTempo;
                    attribute.RepresentativeArrangement = true;
                    attribute.SongPartition = songPartition.GetSongPartition(x.Name, x.ArrangementType);
                    attribute.SongLength = (float)Math.Round((decimal)song.SongLength, 3, MidpointRounding.AwayFromZero); //rounded
                    attribute.LastConversionDateTime = song.LastConversionDateTime;
                    attribute.TargetScore = 100000;
                    attribute.ToneUnlockScore = 70000;
                    attribute.SongDifficulty = (float)song.PhraseIterations.Average(it => song.Phrases[it.PhraseId].MaxDifficulty);
                    manifestFunctions.GenerateChordTemplateData(attribute, song);
                    manifestFunctions.GeneratePhraseData(attribute, song);
                    manifestFunctions.GenerateSectionData(attribute, song);
                    manifestFunctions.GeneratePhraseIterationsData(attribute, song, platform.version);
                }
                var attrDict = new Dictionary<string, Attributes> { { "Attributes", attribute } };
                manifest.Entries.Add(attribute.PersistentID, attrDict);
            }
            manifest.ModelName = "GRSong_Asset";
            manifest.IterationVersion = 2;
            return JsonConvert.SerializeObject(manifest, Formatting.Indented);
        }
Esempio n. 5
0
        public Attributes2014(string arrangementFileName, Arrangement arrangement, DLCPackageData info, Platform platform)
            : base(arrangementFileName, arrangement, info, platform)
        {
            #region VARIABLES

            var dlcName = info.Name.ToLower();

            var xblockUrn    = String.Format(URN_TEMPLATE_SHORT, TagValue.EmergentWorld.GetDescription(), dlcName);
            var showlightUrn = String.Format(URN_TEMPLATE, TagValue.Application.GetDescription(), TagValue.XML.GetDescription(), String.Format("{0}_showlights", dlcName));
            var songXmlUrn   = String.Format(URN_TEMPLATE, TagValue.Application.GetDescription(), TagValue.XML.GetDescription(), String.Format(AggregateGraph2014.NAME_ARRANGEMENT, dlcName, arrangementFileName));
            var songSngUrn   = String.Format(URN_TEMPLATE, TagValue.Application.GetDescription(), TagValue.MusicgameSong.GetDescription(), String.Format(AggregateGraph2014.NAME_ARRANGEMENT, dlcName, arrangementFileName));

            var manifestFunctions = new ManifestFunctions(platform.version);

            #endregion

            #region FILL ATTRIBUTES

            ArrangementSort = arrangement.ArrangementSort;
            BlockAsset      = xblockUrn;
            manifestFunctions.GenerateDynamicVisualDensity(this, SongContent, arrangement, GameVersion.RS2014);//2.0 constant for vocs in RS2
            FullName           = String.Format(AggregateGraph2014.NAME_ARRANGEMENT, info.Name, arrangement.Name);
            MasterID_PS3       = (IsVocal) ? -1 : arrangement.MasterId;
            MasterID_XBox360   = (IsVocal) ? -1 : arrangement.MasterId;
            PreviewBankPath    = String.Format("song_{0}_preview.bnk", info.Name.ToLower());
            RelativeDifficulty = 0; //Always 0 in RS2014
            ShowlightsXML      = showlightUrn;
            SongAsset          = songSngUrn;
            SongBank           = String.Format("song_{0}.bnk", info.Name.ToLower());
            SongEvent          = String.Format("Play_{0}", info.Name);
            SongXml            = songXmlUrn;
            SongVolume         = info.Volume;
            PreviewVolume      = info.PreviewVolume ?? SongVolume;

            // Only for Vocal
            if (IsVocal)
            {
                InputEvent = "Play_Tone_Standard_Mic";
            }

            // Only for instruments
            if (!IsVocal)
            {
                ArrangementProperties            = SongContent.ArrangementProperties;
                ArrangementProperties.BassPick   = (int)arrangement.PluckedType;
                ArrangementProperties.PathLead   = Convert.ToInt32(arrangement.RouteMask == DLCPackage.RouteMask.Lead);
                ArrangementProperties.PathRhythm = Convert.ToInt32(arrangement.RouteMask == DLCPackage.RouteMask.Rhythm);
                ArrangementProperties.PathBass   = Convert.ToInt32(arrangement.RouteMask == DLCPackage.RouteMask.Bass);
                ArrangementProperties.RouteMask  = (int)arrangement.RouteMask;

                // BONUS ARRANGEMENT
                ArrangementProperties.BonusArr = Convert.ToInt32(arrangement.BonusArr);

                // Metronome
                ArrangementProperties.Metronome = (int)arrangement.Metronome;

                if (arrangement.Name == Sng.ArrangementName.Combo)
                { //Exclusive condition
                    if (arrangement.RouteMask == DLCPackage.RouteMask.Lead)
                    {
                        ArrangementType = (int)Sng.ArrangementName.Lead;
                    }
                    else if (arrangement.RouteMask == DLCPackage.RouteMask.Rhythm)
                    {
                        ArrangementType = (int)Sng.ArrangementName.Rhythm;
                    }
                    else
                    {
                        ArrangementType = (int)arrangement.Name;
                    }
                }
                else
                {
                    ArrangementType = (int)arrangement.Name;
                }

                //Chords        -- //TODO: MISSING GENERATE

                ChordTemplates = new List <ChordTemplate>();
                manifestFunctions.GenerateChordTemplateData(this, SongContent);

                LastConversionDateTime = SongContent.LastConversionDateTime;
                MaxPhraseDifficulty    = manifestFunctions.GetMaxDifficulty(SongContent);

                TargetScore      = 100000;
                PhraseIterations = new List <PhraseIteration>();
                manifestFunctions.GeneratePhraseIterationsData(this, SongContent, platform.version);
                //Score_MaxNotes -- Generated on function above
                //Score_PNV      -- Generated on function above

                Phrases = new List <Phrase>();
                manifestFunctions.GeneratePhraseData(this, SongContent);

                Sections = new List <Section>();
                manifestFunctions.GenerateSectionData(this, SongContent);

                SongAverageTempo = SongContent.AverageTempo;
                SongOffset       = arrangement.Sng2014.Metadata.StartTime * -1;

                //SongPartition  -- Generated in DLCPackageCreator after this constructor

                //Techniques     -- //TODO: MISSING GENERATE

                /*
                 * Techniques: {
                 *     DiffLevelID: {
                 *         // 4 : 0,[6,9],[13],[12,15] // unpitchedSlides, tremolo, hopo
                 *         PhraseIterationIndex: [TechID, TechID...]
                 *     }
                 * }
                 */

                //Fix for Dead tones
                var it = info.TonesRS2014;
                Tones = new List <Tone2014>();

                Tone_A           = GetToneName(arrangement.ToneA, it);
                Tone_B           = GetToneName(arrangement.ToneB, it);
                Tone_Base        = GetToneName(arrangement.ToneBase, it);
                Tone_C           = GetToneName(arrangement.ToneC, it);
                Tone_D           = GetToneName(arrangement.ToneD, it);
                Tone_Multiplayer = GetToneName(arrangement.ToneMultiplayer, it);
            }

            #endregion
        }