From 856c11d0bd23b271fa4c38864c349459bc51f6fa Mon Sep 17 00:00:00 2001 From: Doriel Rivalet <100863878+DorielRivalet@users.noreply.github.com> Date: Sun, 2 Oct 2022 03:37:24 -0300 Subject: [PATCH] feat: add update notifier --- .vs/MHFZ_Overlay/v17/.futdcache.v1 | Bin 425 -> 0 bytes MHFZ_Overlay/App.config | 2 +- MHFZ_Overlay/DataLoader.cs | 72 ++++++++++++ MHFZ_Overlay/Dictionary.cs | 52 ++++----- MHFZ_Overlay/MHFZ_Overlay.csproj | 1 + MHFZ_Overlay/MainWindow.xaml.cs | 18 +-- MHFZ_Overlay/Settings.Designer.cs | 2 +- MHFZ_Overlay/Settings.settings | 2 +- MHFZ_Overlay/addresses/AddressModel.cs | 37 ++++++- MHFZ_Overlay/addresses/AddressModelHGE.cs | 4 + MHFZ_Overlay/addresses/AddressModelNotHGE.cs | 7 +- MHFZ_Overlay/addresses/README.md | 109 ++++++++++++++----- MHFZ_Overlay/app.manifest | 1 + README.md | 5 +- 14 files changed, 242 insertions(+), 70 deletions(-) delete mode 100644 .vs/MHFZ_Overlay/v17/.futdcache.v1 diff --git a/.vs/MHFZ_Overlay/v17/.futdcache.v1 b/.vs/MHFZ_Overlay/v17/.futdcache.v1 deleted file mode 100644 index d362addf295449be5b590dc83bab975c139b791e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 425 zcmZQ(U|@)Hwu&jwFUl@1NK8(RNiNPvEGme}%}9$+$t*6&Nvw>|OD!jrua{h0P?Vp= z1T>!4IX^EgGrhDZu_QA;kJTkLsWhD685 - False + True True diff --git a/MHFZ_Overlay/DataLoader.cs b/MHFZ_Overlay/DataLoader.cs index d0a09886..ce16b09a 100644 --- a/MHFZ_Overlay/DataLoader.cs +++ b/MHFZ_Overlay/DataLoader.cs @@ -1,9 +1,12 @@ using Memory; using MHFZ_Overlay.addresses; +using Squirrel; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Threading.Tasks; +using System.Windows; namespace MHFZ_Overlay { @@ -17,15 +20,84 @@ public class DataLoader readonly Mem m = new(); public bool isHighGradeEdition; int index; + /// + /// Gets the model. + /// + /// + /// The model. + /// public AddressModel model { get; } #endregion + /// + /// Called when [application install]. + /// + /// The version. + /// The tools. + private static void OnAppInstall(SemanticVersion version, IAppTools tools) + { + MessageBox.Show("【MHF-Z】Overlay is now installed. Creating a shortcut."); + tools.CreateShortcutForThisExe(ShortcutLocation.StartMenu | ShortcutLocation.Desktop); + } + + /// + /// Called when [application uninstall]. + /// + /// The version. + /// The tools. + private static void OnAppUninstall(SemanticVersion version, IAppTools tools) + { + MessageBox.Show("【MHF-Z】Overlay has been uninstalled. Removing shortcut."); + tools.RemoveShortcutForThisExe(ShortcutLocation.StartMenu | ShortcutLocation.Desktop); + } + + /// + /// Called when [application run]. + /// + /// The version. + /// The tools. + /// if set to true [first run]. + private static void OnAppRun(SemanticVersion version, IAppTools tools, bool firstRun) + { + tools.SetProcessAppUserModelId(); + // show a welcome message when the app is first installed + if (firstRun) MessageBox.Show("【MHF-Z】Overlay is now running! Thanks for installing【MHF-Z】Overlay"); + } + + /// + /// Updates my application. + /// + private static async Task UpdateMyApp() + { + using var mgr = new UpdateManager("https://github.com/DorielRivalet/MHFZ_Overlay/releases/latest"); + var newVersion = await mgr.UpdateApp(); + + // optionally restart the app automatically, or ask the user if/when they want to restart + if (newVersion != null) + { + //https://stackoverflow.com/questions/14819426/how-to-create-hyperlink-in-messagebox-show#14820039 + System.Windows.MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("New version available on GitHub, would you like to download?", "【MHF-Z】Overlay Update Available", System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Asterisk, MessageBoxResult.No); if (messageBoxResult.ToString() == "Yes") { System.Diagnostics.Process.Start("https://github.com/DorielRivalet/MHFZ_Overlay/releases/latest"); } + //UpdateManager.RestartApp(); + } + } + /// /// Initializes a new instance of the class. /// public DataLoader() { + // run Squirrel first, as the app may exit after these run + SquirrelAwareApp.HandleEvents( + onInitialInstall: OnAppInstall, + onAppUninstall: OnAppUninstall, + onEveryRun: OnAppRun); + + _ = UpdateMyApp(); + // ... other app init code after ... + + + int PID = m.GetProcIdFromName("mhf"); if (PID > 0) { diff --git a/MHFZ_Overlay/Dictionary.cs b/MHFZ_Overlay/Dictionary.cs index fe72bc92..e201cb41 100644 --- a/MHFZ_Overlay/Dictionary.cs +++ b/MHFZ_Overlay/Dictionary.cs @@ -1210,19 +1210,19 @@ public class MapAreaList {306,"Highlands Night Area 6" }, {307,"Highlands Day Area 7" }, {308,"Highlands Night Area 7" }, - {309,"Solitude Island" }, + {309,"Solitude Island 9 (Area 3)" }, {310,"Campaign Tent" }, //in quest? - {311,"Raviente Balloon" }, - {312,"Raviente Balloon" }, - {313,"Solitude Island" }, - {314,"Solitude Isle 1" }, - {315,"Solitude Island" }, - {316,"Solitude Island" }, - {317,"Solitude Isle 2" }, - {318,"Solitude Island" }, - {319,"Solitude Island" }, - {320,"Solitude Isle 3" }, - {321,"Solitude Island" }, + {311,"Raviente Balloon (Day)" }, + {312,"Raviente Balloon (Sunset)" }, + {313,"Raviente Balloon (Night)"}, + {314,"Solitude Island 1 (Area 1)" }, + {315,"Solitude Island 2 (Area 1)" }, + {316,"Solitude Island 3 (Area 1)" }, + {317,"Solitude Island 4 (Area 2)" }, + {318,"Solitude Island 5 (Area 2)" }, + {319,"Solitude Island 6 (Area 2)" }, + {320,"Solitude Island 7 (Area 3)" }, + {321,"Solitude Island 8 (Area 3)" }, {322,"Tidal Island Day Base Camp" }, {323,"Tidal Island Day Area 1" }, {324,"Tidal Island Day Area 2" }, @@ -1318,12 +1318,12 @@ public class MapAreaList {414,"Duremudira Door" }, {415,"Urgent Tower" }, {416,"4th District Tower" }, - {417,"Berserk Raviente Base Camp Slay 1" }, - {418,"Berserk Raviente Combat 01" }, - {419,"Berserk Raviente Combat 02" }, - {420,"Berserk Raviente Combat 03" }, - {421,"Berserk Raviente Combat 04" }, - {422,"Berserk Raviente Combat 05" }, + {417,"Berserk Raviente Base Camp" }, + {418,"Berserk Raviente Combat Phase 1" }, + {419,"Berserk Raviente Combat Phase 2" }, + {420,"Berserk Raviente Combat Phase 3" }, + {421,"Berserk Raviente Combat Phase 4" }, + {422,"Berserk Raviente Combat Phase 5" }, {423,"Painted Falls Day Base Camp" }, {424,"Painted Falls Night Base Camp" }, {425,"Painted Falls Day Area 1" }, @@ -1338,14 +1338,14 @@ public class MapAreaList {434,"Painted Falls Night Area 5" }, {435,"Painted Falls Day Area 6" }, {436,"Painted Falls Night Area 6" }, - {437,"Guanzorumu Arena 01" }, - {438,"Berserk Raviente Base Camp" }, - {439,"Guanzorumu Arena 02" }, - {440,"Berserk Raviente Support 01" }, - {441,"Berserk Raviente Support 02" }, - {442,"Berserk Raviente Support 03" }, - {443,"Berserk Raviente Support 04" }, - {444,"Berserk Raviente Support 05" }, + {437,"Berserk Raviente Base Camp (Support)" },//TODO: test + {438,"Guanzorumu Arena Base Camp" }, + {439,"Guanzorumu Arena Area 1" }, + {440,"Berserk Raviente Support Phase 1" }, + {441,"Berserk Raviente Support Phase 2" }, + {442,"Berserk Raviente Support Phase 3" }, + {443,"Berserk Raviente Support Phase 4" }, + {444,"Berserk Raviente Support Phase 5" }, {445,"Diva Hall" }, {446,"Amatsu Arena 1" }, {447,"Amatsu Arena 2" }, diff --git a/MHFZ_Overlay/MHFZ_Overlay.csproj b/MHFZ_Overlay/MHFZ_Overlay.csproj index bad871ec..ec526302 100644 --- a/MHFZ_Overlay/MHFZ_Overlay.csproj +++ b/MHFZ_Overlay/MHFZ_Overlay.csproj @@ -51,6 +51,7 @@ + diff --git a/MHFZ_Overlay/MainWindow.xaml.cs b/MHFZ_Overlay/MainWindow.xaml.cs index a506140a..3d1437d9 100644 --- a/MHFZ_Overlay/MainWindow.xaml.cs +++ b/MHFZ_Overlay/MainWindow.xaml.cs @@ -1,27 +1,18 @@ using DiscordRPC; -using MHFZ_Overlay.addresses; -using MHFZ_Overlay.controls; -using Microsoft.VisualBasic; using System; -using System.Diagnostics.Metrics; using System.Drawing; using System.Globalization; using System.Runtime.InteropServices; -using System.Text.RegularExpressions; using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Data; -using System.Windows.Forms; using System.Windows.Input; using System.Windows.Interop; using System.Windows.Media; -using System.Windows.Media.Media3D; using System.Windows.Threading; -using static System.Net.WebRequestMethods; using Application = System.Windows.Application; using Brush = System.Windows.Media.Brush; -using Brushes = System.Windows.Media.Brushes; using Color = System.Windows.Media.Color; using DataFormats = System.Windows.DataFormats; using DataObject = System.Windows.DataObject; @@ -32,6 +23,7 @@ using Point = System.Windows.Point; //using static System.Globalization.CultureInfo; + namespace MHFZ_Overlay { /// @@ -2220,6 +2212,14 @@ public bool IsDure() return false; } + public bool IsRavi() + { + if (DataLoader.model.getRaviName() != "None") + return true; + else + return false; + } + //dure and road /// /// In the arena? diff --git a/MHFZ_Overlay/Settings.Designer.cs b/MHFZ_Overlay/Settings.Designer.cs index a8e996d0..f0c67710 100644 --- a/MHFZ_Overlay/Settings.Designer.cs +++ b/MHFZ_Overlay/Settings.Designer.cs @@ -493,7 +493,7 @@ public double Monster1PartY { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] + [global::System.Configuration.DefaultSettingValueAttribute("True")] public bool AlwaysShowPlayerInfo { get { return ((bool)(this["AlwaysShowPlayerInfo"])); diff --git a/MHFZ_Overlay/Settings.settings b/MHFZ_Overlay/Settings.settings index dce16fe4..2f47908f 100644 --- a/MHFZ_Overlay/Settings.settings +++ b/MHFZ_Overlay/Settings.settings @@ -120,7 +120,7 @@ 685 - False + True True diff --git a/MHFZ_Overlay/addresses/AddressModel.cs b/MHFZ_Overlay/addresses/AddressModel.cs index bdb1356b..29e31257 100644 --- a/MHFZ_Overlay/addresses/AddressModel.cs +++ b/MHFZ_Overlay/addresses/AddressModel.cs @@ -67,7 +67,7 @@ public abstract class AddressModel : INotifyPropertyChanged #endregion - #region abstract bool + #region abstract vars abstract public bool IsNotRoad(); abstract public int HitCountInt(); @@ -223,6 +223,14 @@ public abstract class AddressModel : INotifyPropertyChanged abstract public int RoadSelectedMonster(); + abstract public int RavienteTriggeredEvent(); + + //normal and violent. berserk support + abstract public int RavienteAreaID(); + + abstract public int GreatSlayingPoints(); + abstract public int GreatSlayingPointsSaved(); + #endregion public bool HasMonster1 => ShowHPBar(LargeMonster1ID(), Monster1HPInt()); @@ -2054,6 +2062,33 @@ public string getDureName() return "None"; } + //quest ids + //ravi 62105 TODO: same ids in all phases? + //violent 62101 + //berserk + //berserk practice + // support 1 55803 + //extreme + /// + /// Gets the name of the ravi. + /// + /// + public string getRaviName() + { + if (QuestID() == 21731 || QuestID() == 21749) + return "1st District Duremudira"; + else if (QuestID() == 21746 || QuestID() == 21750) + return "2nd District Duremudira"; + else if (QuestID() == 21747 || QuestID() == 21734) + return "3rd District Duremudira"; + else if (QuestID() == 21748) + return "4th District Duremudira"; + else if (QuestID() == 23648 || QuestID() == 23649) + return "Arrogant Duremudira"; + else + return "None"; + } + public string Monster1Name => getDureName() != "None" ? getDureName() : getMonsterName(GetNotRoad() || RoadSelectedMonster() == 0 ? LargeMonster1ID() : LargeMonster2ID()); //monster 1 is used for the first display and road uses 2nd choice to store 2nd monster public string Monster2Name => getMonsterName(LargeMonster2ID()); public string Monster3Name => getMonsterName(LargeMonster3ID()); diff --git a/MHFZ_Overlay/addresses/AddressModelHGE.cs b/MHFZ_Overlay/addresses/AddressModelHGE.cs index 5684c23c..9a8347f3 100644 --- a/MHFZ_Overlay/addresses/AddressModelHGE.cs +++ b/MHFZ_Overlay/addresses/AddressModelHGE.cs @@ -267,5 +267,9 @@ public int LargeMonster2Road() public override int Objective1CurrentQuantityMonster() => M.Read2Byte("mhfo-hd.dll+ECB2A38"); public override int Objective1CurrentQuantityItem() => M.Read2Byte("mhfo-hd.dll+DC6C2F2"); + public override int RavienteTriggeredEvent() => 1; + public override int RavienteAreaID() => 1; + public override int GreatSlayingPoints() => 1; + public override int GreatSlayingPointsSaved() => 1; } } diff --git a/MHFZ_Overlay/addresses/AddressModelNotHGE.cs b/MHFZ_Overlay/addresses/AddressModelNotHGE.cs index 7abe9156..8037b85f 100644 --- a/MHFZ_Overlay/addresses/AddressModelNotHGE.cs +++ b/MHFZ_Overlay/addresses/AddressModelNotHGE.cs @@ -124,8 +124,8 @@ public int LargeMonster2Road() //new addresses - //public override int AreaID() => M.Read2Byte("mhfo.dll+5034388"); - public override int AreaID() => M.Read2Byte("mhfo.dll+6124B6E"); + public override int AreaID() => M.Read2Byte("mhfo.dll+5034388"); + public override int RavienteAreaID() => M.Read2Byte("mhfo.dll+6124B6E"); public override int GRankNumber() => M.Read2Byte("mhfo.dll+613DD30"); public override int GSR() => M.Read2Byte("mhfo.dll+50349A2"); public override int RoadFloor() => M.Read2Byte("mhfo.dll+5C47600"); @@ -202,5 +202,8 @@ public int LargeMonster2Road() public override int Objective1CurrentQuantityMonster() => M.Read2Byte("mhfo.dll+60792E6"); public override int Objective1CurrentQuantityItem() => M.Read2Byte("mhfo.dll+5034732"); + public override int RavienteTriggeredEvent() => M.Read2Byte("mhfo.dll+61005C6"); + public override int GreatSlayingPoints() => M.ReadInt("mhfo.dll+5B45FF8"); + public override int GreatSlayingPointsSaved() => M.ReadInt("mhfo.dll+61005C4"); } } diff --git a/MHFZ_Overlay/addresses/README.md b/MHFZ_Overlay/addresses/README.md index d750e338..324abec3 100644 --- a/MHFZ_Overlay/addresses/README.md +++ b/MHFZ_Overlay/addresses/README.md @@ -156,7 +156,7 @@ | 4 | Lower | | 5 | Lower | | 6 | Lower | -| 7 | Lower | +| 7 | Lower (also Raviente) | | 8 | Lower | | 9 | Lower | |10 | Lower | @@ -202,7 +202,7 @@ |50 || |51 || |52 || -|53 | G Rank | +|53 | G Rank (also Berserk Raviente) | |54 | Musou 1 (Repel/20m/Lower Shiten)| |55 | Musou 2 (Slay/10m/Upper Shiten)| |56 | Twinhead (Rajang+Voljang)| @@ -1116,19 +1116,19 @@ |306 | Highlands Night Area 6| |307 | Highlands Day Area 7| |308 | Highlands Night Area 7| -|309 | Solitude Island| +|309 | Solitude Island 9 (Area 3)| |310 |Campaign Tent| -|311 | Raviente Balloon| -|312 | Raviente Balloon| -|313 | Solitude Island| -|314 | Solitude Isle 1| -|315 |Solitude Island| -|316 | Solitude Island| -|317 | Solitude Isle 2| -|318 | Solitude Island| -|319 | Solitude Island| -|320 | Solitude Isle 3| -|321 | Solitude Island| +|311 | Raviente Balloon (Day)| +|312 | Raviente Balloon (Sunset)| +|313 | Solitude Island (Night)| +|314 | Solitude Island 1 (Area 1)| +|315 |Solitude Island 2 (Area 1) | +|316 | Solitude Island 3 (Area 1)| +|317 | Solitude Island 4 (Area 2)| +|318 | Solitude Island 5 (Area 2)| +|319 | Solitude Island 6 (Area 2)| +|320 | Solitude Island 7 (Area 3)| +|321 | Solitude Island 8 (Area 3)| |322 | Tidal Island Day Base Camp| |323 | Tidal Island Day Area 1| |324 | Tidal Island Day Area 2| @@ -1224,12 +1224,12 @@ |414 | Duremudira Door| |415 | Urgent Tower| |416 | 4th District Tower| -|417 | Berserk Raviente Base Camp Slay 1| -|418 |Berserk Raviente Combat 01| -|419 | Berserk Raviente Combat 02| -|420 | Berserk Raviente Combat 03| -|421 | Berserk Raviente Combat 04| -|422 |Berserk Raviente Combat 05| +|417 | Berserk Raviente Base Camp| +|418 |Berserk Raviente Combat Phase 1| +|419 | Berserk Raviente Combat Phase 2| +|420 | Berserk Raviente Combat Phase 3| +|421 | Berserk Raviente Combat Phase 4| +|422 |Berserk Raviente Combat Phase 5| |423 |Painted Falls Day Base Camp| |424 | Painted Falls Night Base Camp| |425 | Painted Falls Day Area 1| @@ -1244,14 +1244,14 @@ |434 | Painted Falls Night Area 5| |435 |Painted Falls Day Area 6| |436 | Painted Falls Night Area 6| -|437 | Guanzorumu Arena 01| -|438 | Berserk Raviente Base Camp| -|439 | Guanzorumu Arena 02| -|440 | Berserk Raviente Support 01| -|441 | Berserk Raviente Support 02| -|442 | Berserk Raviente Support 03| -|443 | Berserk Raviente Support 04| -|444 | Berserk Raviente Support 05| +|437 | Berserk Raviente Base Camp (Support)| +|438 | Guanzorumu Arena 1| +|439 | Guanzorumu Arena 2| +|440 | Berserk Raviente Support Phase 1| +|441 | Berserk Raviente Support Phase 2| +|442 | Berserk Raviente Support Phase 3| +|443 | Berserk Raviente Support Phase 4| +|444 | Berserk Raviente Support Phase 5| |445 | Diva Hall| |446 | Amatsu Arena 1| |447 | Amatsu Arena 2| @@ -1663,3 +1663,56 @@ |1|Heaven| |2|Storm| |3|Extreme| + +### Raviente Trigger Events + +|ID| Event| +|--|------| +|0|Slay 1| +|1|Sedation 1| +|2|Destruction 1| +|3|Slay 2| +|4|Sedation 2| +|5|Sedation 3| +|6|Slay 4| +|7|Slay 5| +|8|Sedation 5| +|9|Slay 6| +|10|Slay 7| +|11|Sedation 7| +|12|Sedation 8| +|13|Slay 9| + +### Violent Raviente Trigger Events + +|ID| Event| +|--|------| +|0|Slay 1| +|1|Sedation 1| +|2|Destruction 1| +|3|Slay 2| +|4|Sedation 2| +|5|Sedation 3| +|6|Slay 4| +|7|Slay 5| +|8|Sedation 5| +|9|Slay 6| +|10|Slay 7| +|11|Slay 8| +|12|Sedation 7| +|13|Slay 9| + +### Berserk Raviente (Practice) Trigger Events + +|ID| Event| +|--|------| +|0|Slay 1| +|1|Sedation 1| +|2|Support and Combat 1| +|3|Destruction 2| +|4|Destruction 3| +|5|Destruction 4| +|6|Support 2| +|7|Sedation 4| +|8|Sedation 5| +|9|Sedation 6| diff --git a/MHFZ_Overlay/app.manifest b/MHFZ_Overlay/app.manifest index 4d5c3f9e..abee9dbe 100644 --- a/MHFZ_Overlay/app.manifest +++ b/MHFZ_Overlay/app.manifest @@ -1,6 +1,7 @@  + 1 diff --git a/README.md b/README.md index 54266879..08e9ac93 100644 --- a/README.md +++ b/README.md @@ -98,13 +98,15 @@ If the monster HP shown is less than what its actual values should be, restart b - With Monster EHP enabled, if you cart, the max EHP turns into the current EHP, along with some other info max values - Sometimes when exiting Drag and Drop the monster HP information disappears - Spawning in the same area as the monster doesn't load the information properly. Fix: re-enter area -- Duremudira HP not showing. Fix: enable *Always Show Monster Info*, load another quest showing the HP bars (not just the numbers), then retry. +- Duremudira/Road/Raviente HP not showing. Fix: enable *Always Show Monster Info*, load another quest showing the HP bars (not just the numbers), then retry. - Monster size values not shown correctly - Monster HP values are less than the actual values when not loading properly - Damage numbers over 1000 not working - Yamas and Berukyurosu information not working - Daily quests not working +Fully reinstalling the game or .NET dependencies may fix some bugs. + [Check more bugs here](https://github.com/DorielRivalet/MHFZ_Overlay/issues?q=is%3Aissue+is%3Aopen+label%3Abug) ## Features not yet implemented @@ -133,6 +135,7 @@ If the monster HP shown is less than what its actual values should be, restart b - Zenith information in Road - Settings import/export - Discord Rich Presence Party Size +- Raviente Support Part Info [Check more possible future features here](https://github.com/DorielRivalet/MHFZ_Overlay/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement)