protected static void FillInPhenomenaDetails(GMD detail) { double Y1 = 1.071374 * detail.ApparentRectangularCoordinates.Y; double r = Y1 * Y1 + detail.ApparentRectangularCoordinates.X * detail.ApparentRectangularCoordinates.X; if (r < 1) { if (detail.ApparentRectangularCoordinates.Z < 0) { //Satellite nearer to Earth than Jupiter, so it must be a transit not an occultation detail.bInTransit = true; detail.bInOccultation = false; } else { detail.bInTransit = false; detail.bInOccultation = true; } } else { detail.bInTransit = false; detail.bInOccultation = false; } }
private static int RunPrintAndReturnExitCode(PrintOptions opts) { GMD gmd; Console.WriteLine("File: " + opts.Path); try { gmd = new GMD(opts.Path); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); return(1); } foreach (var entry in gmd.Entries) { string key = "\"\""; string value = '"' + entry.Value + '"'; if (entry as GMD_Entry is var x && x != null) { key = '"' + x.Key + '"'; }
public void Load__action_trial_eng() { // Uses skipInvalidMessages GMD gmd = new GMD(Utility.GetFullPath(@"chunk0/common/text/action_trial_eng.gmd")); //Assert.AreEqual(gmd.Entries[3].Value, "©CAPCOM CO., LTD. ALL RIGHTS RESERVED."); }
public GMDViewModel(string path) : base(path) { _context = new GMD(path); // Commands AddEntryCommand = new RelayCommand(AddEntry, IsUnsafeModeEnabled); AddEntryNoKeyCommand = new RelayCommand(AddEntryNoKey, IsUnsafeModeEnabled); TriggerSearchCommand = new RelayCommand(TriggerSearch, () => true); // Header metadata HeaderMetadata.Add(new KeyValueViewModel("Version", "0x" + _context.Header.Version.ToHexString())); HeaderMetadata.Add(new KeyValueViewModel("Language", _context.Header.Language.ToString())); HeaderMetadata.Add(new KeyValueViewModel("KeyCount", _context.Header.KeyCount.ToString())); HeaderMetadata.Add(new KeyValueViewModel("StringCount", _context.Header.StringCount.ToString())); HeaderMetadata.Add(new KeyValueViewModel("KeyBlockSize", _context.Header.KeyBlockSize.ToString())); HeaderMetadata.Add(new KeyValueViewModel("StringBlockSize", _context.Header.StringBlockSize.ToString())); HeaderMetadata.Add(new KeyValueViewModel("FilenameLength", _context.Header.FilenameLength.ToString())); HeaderMetadata.Add(new KeyValueViewModel("Filename", _context.Filename)); // Entries for (int i = 0; i < _context.Entries.Count; i++) { Entries.Add(new GMDEntryViewModel(i, _context.Entries[i])); } // Filtered Entries CollectionViewSource FilteredEntries = CollectionViewSource.GetDefaultView(Entries); FilteredEntries.Filter = Entries_Filter; }
public GmdViewModel(FileInfo fileInfo, MainWindowViewModel mainWindowViewModel) { this.mainWindowViewModel = mainWindowViewModel; Info = fileInfo; gmd = new GMD(fileInfo.FullName); for (int i = 0; i < gmd.Entries.Count; i++) { entriesList.Add(new GmdEntryViewModel(i, gmd.Entries[i])); } AddEntryCommand = ReactiveCommand.Create(AddEntry); AddPaddingEntryCommand = ReactiveCommand.Create(AddPaddingEntry); ImportFromCsvCommand = ReactiveCommand.Create(ImportFromCsvHandler); ExportToCsvCommand = ReactiveCommand.CreateFromTask(ExportToCsvHandler); DeleteRowsCommand = ReactiveCommand.Create <IList <GmdEntryViewModel> >(DeleteRows); var keyFilter = this.WhenValueChanged(t => t.KeySearchQuery) .Throttle(TimeSpan.FromMilliseconds(250)) .Select(KeyFilterPredicate); var valueFilter = this.WhenValueChanged(t => t.ValueSearchQuery) .Throttle(TimeSpan.FromMilliseconds(250)) .Select(ValueFilterPredicate); entriesList.Connect() .Filter(keyFilter) .Filter(valueFilter) .Sort(SortExpressionComparer <GmdEntryViewModel> .Ascending(x => x.Index)) .ObserveOn(RxApp.MainThreadScheduler) .Bind(out filteredEntriesBinding) .Subscribe(); }
public void Load__action_trial_ara() { // Uses skipInvalidMessages and weird workaround (see Models/GMD.cs) GMD gmd = new GMD(Utility.GetFullPath(@"chunk0/common/text/action_trial_ara.gmd")); //Assert.AreEqual(gmd.Entries[3].Value, "©CAPCOM CO., LTD. ALL RIGHTS RESERVED."); }
// Get quest title public static string GetQuestTitle(string InputFile) { GMD Gmd = new GMD(InputFile); var GmdEntries = Gmd.Entries.OfType <GMD_Entry>(); string QuestTitle = GmdEntries.ElementAt(0).Value; return(QuestTitle); }
public void AllClose() { GMD.GetComponent <MainInfo>().infoWin_obj.SetActive(false); option_obj.SetActive(false); GM.GetComponent <MainShop>().shopWin_obj.SetActive(false); GM.GetComponent <MainShop>().outItem_obj.SetActive(false); GM.GetComponent <MainShop>().shopWinYN_obj.SetActive(false); }
private void IndexJewels() { XmlNodeList jewels = Honey.HoneyGearData.SelectNodes("//Honey/Gear/Jewels/Jewel"); foreach (XmlNode je in jewels) { Searchable[GMD.GetItemNameById(int.Parse(je.Attributes["GameId"].Value))] = int.Parse(je.Attributes["ID"].Value); } }
public GmdViewModel(FileInfo fileInfo) { Info = fileInfo; gmd = new GMD(fileInfo.FullName); for (int i = 0; i < gmd.Entries.Count; i++) { Entries.Add(new GmdEntryViewModel(i, gmd.Entries[i])); } }
private void OnSongQueueUpdate(object source, HuntingHornSongEventArgs args) { if (args.IsCastingSongs) { return; } Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => { if (SongQueue.Children.Count == args.SongsQueued) { int index = args.RawSongIndexesQueue[args.LastSongIndex]; if (args.Songs.Length < index + 1 || index < 0) { return; } sHuntingHornSong song = args.Songs[index]; SongComponent songComponent = new SongComponent() { SongName = GMD.GetMusicSkillNameById(song.BuffId)//GStrings.GetAbnormalityByID("HUNTINGHORN", song.BuffId, 0) }; songComponent.SetSong(song.Notes, cachedBrushes); SongQueue.Children.Insert(0, songComponent); SongQueue.Children.RemoveAt(SongQueue.Children.Count - 1); } else { bool insert = SongQueue.Children.Count > 0; // Add remaning songs to the queue based on the SongQueue length for (int i = 0; SongQueue.Children.Count < args.SongsQueued; i++) { int index = args.SongIndexesQueue[i]; sHuntingHornSong song = args.Songs[index]; SongComponent songComponent = new SongComponent() { SongName = GMD.GetMusicSkillNameById(song.BuffId) }; songComponent.SetSong(song.Notes, cachedBrushes); if (insert) { SongQueue.Children.Insert(0, songComponent); } else { SongQueue.Children.Add(songComponent); } } } })); }
private void UpdatePredictedSong(sHuntingHornSong[] predictions) { PredictionSheet.Children.Clear(); foreach (sHuntingHornSong song in predictions) { SongPredComponent predDisplay = new SongPredComponent() { SongName = GMD.GetMusicSkillNameById(song.BuffId) }; predDisplay.UpdateNote(song.Notes[song.NotesLength - 1], cachedBrushes[song.Notes[song.NotesLength - 1] - 1]); PredictionSheet.Children.Add(predDisplay); } }
public void Rebuild(string str) { string origPath = Utility.GetFullPath(str); string rebuildPath = "rebuild_" + Path.GetFileName(str); GMD gmd = new GMD(origPath); gmd.Save(rebuildPath); if (!Utility.CheckFilesAreSame(origPath, rebuildPath)) { Assert.Fail("Hash doesn't match!"); } }
public void Rebuild__q00503_eng() { string origPath = Utility.GetFullPath(@"chunk0/common/text/quest/q00503_eng.gmd"); string rebuildPath = "rebuild__q00503_eng.gmd"; GMD gmd = new GMD(origPath); gmd.Save(rebuildPath); if (!Utility.CheckFilesAreSame(origPath, rebuildPath)) { Assert.Fail("Hash doesn't match!"); } }
public void Rebuild__action_trial_eng() { // Uses skipInvalidMessages, rebuild file will not be the same since it removes the "Invalid Message" strings string origPath = Utility.GetFullPath(@"chunk0/common/text/action_trial_eng.gmd"); string rebuildPath = "rebuild__action_trial_eng.gmd"; GMD gmd = new GMD(origPath); gmd.Save(rebuildPath); if (!Utility.CheckFilesAreSame(origPath, rebuildPath)) { Assert.Fail("Hash doesn't match!"); } }
private void ReconstructQueue() { for (int i = 0; SongQueue.Children.Count < Context.SongsQueued; i++) { int index = Context.SongIndexesQueue[i]; sHuntingHornSong song = Context.Songs[index]; SongComponent songComponent = new SongComponent() { SongName = GMD.GetMusicSkillNameById(song.BuffId) }; songComponent.SetSong(song.Notes, cachedBrushes); SongQueue.Children.Add(songComponent); } }
public void ReaddString__w_sword_eng() { // This won't display correctly in game, because the string order DOES matter string origPath = Utility.GetFullPath(@"common/text/steam/w_sword_eng.gmd"); string newPath = "removestring__w_sword_eng.gmd"; string readdPath = "readdstring__w_sword_eng.gmd"; GMD gmd = new GMD(origPath); gmd.RemoveString("WP_WSWD_044_NAME"); gmd.Save(newPath); GMD newGmd = new GMD(newPath); newGmd.AddString("WP_WSWD_044_NAME", "My new string"); newGmd.Save(readdPath); }
public void AddString__q00503_eng() { string newPath = "addstring__q00503_eng.gmd"; GMD gmd = new GMD(Utility.GetFullPath(@"common/text/quest/q00503_eng.gmd")); gmd.AddString("MY_NEW_STRING", "New string text...."); gmd.Save(newPath); GMD oldGmd = new GMD(Utility.GetFullPath(@"common/text/quest/q00503_eng.gmd")); GMD newGmd = new GMD(newPath); Assert.IsTrue(oldGmd.Header.KeyCount < newGmd.Header.KeyCount); Assert.IsTrue(oldGmd.Header.KeyBlockSize < newGmd.Header.KeyBlockSize); Assert.IsTrue(oldGmd.Header.StringCount < newGmd.Header.StringCount); Assert.IsTrue(oldGmd.Header.StringBlockSize < newGmd.Header.StringBlockSize); Assert.IsNotNull(newGmd.Entries.FirstOrDefault(x => x.Value == "New string text....")); }
public void AddStringAt__armor_eng() { string newPath = "addstringat__armor_eng.gmd"; GMD gmd = new GMD(Utility.GetFullPath(@"common/text/steam/armor_eng.gmd")); // Find index var entryToFind = gmd.Entries.OfType <GMD_Entry>().FirstOrDefault(x => x.Key == "AM_ACCE001_NAME"); int idx = gmd.Entries.IndexOf(entryToFind); gmd.AddString("AM_ACCE001_EXP", "Description for AM_ACCE001_NAME", idx + 1); gmd.Save(newPath); GMD oldGmd = new GMD(Utility.GetFullPath(@"common/text/quest/q00503_eng.gmd")); GMD newGmd = new GMD(newPath); Assert.IsTrue(oldGmd.Header.KeyCount < newGmd.Header.KeyCount); Assert.IsTrue(oldGmd.Header.KeyBlockSize < newGmd.Header.KeyBlockSize); Assert.IsTrue(oldGmd.Header.StringCount < newGmd.Header.StringCount); Assert.IsTrue(oldGmd.Header.StringBlockSize < newGmd.Header.StringBlockSize); Assert.IsNotNull(newGmd.Entries.FirstOrDefault(x => x.Value == "Description for AM_ACCE001_NAME")); }
private static int Search(SearchOptions opts) { string[] files = Directory.GetFiles(opts.Input, "*.gmd", SearchOption.AllDirectories); foreach (var file in files) { var matches = new List <IGMD_Entry>(); try { var gmd = new GMD(file); foreach (var entry in gmd.Entries) { if (opts.Search.Any(x => Regex.IsMatch(entry.Value, x))) { matches.Add(entry); } } if (matches.Count > 0) { Colorful.Console.WriteLine(file, Color.Green); foreach (var entry in matches) { PrintEntry(entry); } Console.WriteLine(); } } catch (Exception ex) { Console.WriteLine("Error: " + ex); } } return(0); }
private static int Print(PrintOptions opts) { GMD gmd; Console.WriteLine("File: " + opts.Path); try { gmd = new GMD(opts.Path); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); return(1); } foreach (var entry in gmd.Entries) { PrintEntry(entry); } return(0); }
public void LinkGmd() { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Character Names|chr_names_*.gmd|All GMD files|*.gmd"; if (ofd.ShowDialog() == true) { try { LinkedGmd = new GMD(ofd.FileName); // Force refresh datagrid, NotifyPropertyChanged doesn't work for some reason var temp = Items; Items = null; Items = temp; } catch (Exception ex) { Log.Error(ex.Message); MessageBox.Show(ex.Message, "Error"); } } }
public void Load__item_eng() { GMD gmd = new GMD(Utility.GetFullPath(@"chunk0/common/text/item_eng.gmd")); }
public void Load(string str) { GMD gmd = new GMD(Utility.GetFullPath(str)); }
public void PlayLevelMusic(GMD stalk, GMD fight) { _bIsPlayingLevelMusic = true; MidiFile stalkMidi = new MidiFile(stalk.MidiData); _stalkSequences = new MusicSequences(); _stalkSequences.FirstTrack = 0; _stalkSequences.NumTracks = stalkMidi.Tracks.Length; foreach (var Track in stalkMidi.Tracks) { _stalkSequences.TrackSections.Add(Track.Sections); } if (fight != null) { MidiFile fightMidi = new MidiFile(fight.MidiData); _fightSequences = new MusicSequences(); _fightSequences.FirstTrack = _stalkSequences.NumTracks; _fightSequences.NumTracks = fightMidi.Tracks.Length; foreach (var Track in fightMidi.Tracks) { _fightSequences.TrackSections.Add(Track.Sections); } // merge stalkMidi.AddTracks(fightMidi); } PitchTo(0f, 0f); lock (this) { _midiSequencer.LoadMidi(stalkMidi, false); _currentTrack = 0; _currentSection = _stalkSequences.TrackSections[0][0]; _midiSequencer.Play(); _midiSequencer.SwitchSection(_currentTrack, _currentSection, 0f); } }
private static void InsertMaDecorationLevel(String input, String output, String style, Boolean showVerbose) { if (output == null) { output = input + ".mdl"; if (showVerbose) { Console.WriteLine("No explicated output. Use the default output."); } } GMD gmd = new GMD(input); if (style == null) { var language = gmd.Header.Language; if (language == 8 /* chS */ || language == 7 /* chT */ || language == 0 /* jpn */ || language == 6 /* kor */) { style = "%s<STYL MOJI_YELLOW_DEFAULT>(%d)</STYL>"; } else { style = "%s <STYL MOJI_YELLOW_DEFAULT>(%d)</STYL>"; } if (showVerbose) { Console.WriteLine("No explicated style. Use the default style."); } } if (showVerbose) { Console.WriteLine($"input = {input}"); Console.WriteLine($"output = {output}"); Console.WriteLine($"style = {style}"); } // Records which decoration has been modified var record = Data.MAX_DECORATION_LEVEL_MAP.Keys.ToDictionary(key => key, key => false); var recordCount = 0; var list = gmd.Entries.OfType <GMD_Entry>().ToList().FindAll(x => x.Key.StartsWith("JU_") && x.Key.EndsWith("_NAME")); foreach (var item in list) { if (!item.Value.Equals("Invalid Message")) { if (Data.MAX_DECORATION_LEVEL_MAP.ContainsKey(item.Key)) { var oldValue = item.Value; item.Value = style.Replace("%s", item.Value).Replace("%d", Data.MAX_DECORATION_LEVEL_MAP[item.Key].ToString()); var newValue = item.Value; if (showVerbose) { Console.WriteLine("Insert max decoration level:"); Console.WriteLine($"> Key = {item.Key}"); Console.WriteLine($"> Old Value = {oldValue}"); Console.WriteLine($"> New Value = {newValue}"); } if (record[item.Key] == false) { record[item.Key] = true; recordCount++; } } else if (!Data.INVALID_DECORATION_LIST.Contains(item.Key)) { Console.WriteLine("Unknown decoration:"); Console.WriteLine($"> Key = {item.Key}"); Console.WriteLine($"> Value = {item.Value}"); } } } // Show warning if not all decorations are modified if (recordCount != record.Count) { Console.WriteLine("Some decorations are missing:"); foreach (var item in record) { if (item.Value == false) { Console.WriteLine($"> {item.Key}"); } } } gmd.Save(output); }
public void Load(string str) { GMD _ = new GMD(Utility.GetTestAsset("game/" + str)); }
public void Load__armor_eng() { GMD gmd = new GMD(Utility.GetFullPath(@"chunk0/common/text/steam/armor_eng.gmd")); }
public void Load__cm_chat_eng() { GMD gmd = new GMD(Utility.GetFullPath(@"chunk5/common/text/cm_chat_eng.gmd")); }
public void Load__cm_facility_kor() { GMD gmd = new GMD(Utility.GetFullPath(@"chunk0/common/text/cm_facility_kor.gmd")); }
public void Load__action_trial_ara() { GMD gmd = new GMD(Utility.GetFullPath(@"chunk0/common/text/action_trial_ara.gmd")); //Assert.AreEqual(gmd.Entries[3].Value, "©CAPCOM CO., LTD. ALL RIGHTS RESERVED."); }