diff --git a/MHFZ_Overlay/ConfigWindow.xaml.cs b/MHFZ_Overlay/ConfigWindow.xaml.cs index 7f45434d..9ce72f69 100644 --- a/MHFZ_Overlay/ConfigWindow.xaml.cs +++ b/MHFZ_Overlay/ConfigWindow.xaml.cs @@ -69,7 +69,7 @@ public static string getFeriasLink() return s.FeriasVersionLink; } - public MonsterInfo[] monsterInfos = new MonsterInfo[] + private MonsterInfo[] monsterInfos = new MonsterInfo[] { new MonsterInfo("[Musou] Arrogant Duremudira", "https://dorielrivalet.github.io/MHFZ-Ferias-English-Project/mons/dolem_n.htm", diff --git a/MHFZ_Overlay/DataLoader.cs b/MHFZ_Overlay/DataLoader.cs index 61bdcccc..dcce5487 100644 --- a/MHFZ_Overlay/DataLoader.cs +++ b/MHFZ_Overlay/DataLoader.cs @@ -22,9 +22,14 @@ public class DataLoader #region DataLoaderVariables //needed for getting data readonly Mem m = new(); - public bool isHighGradeEdition; - public bool isInLauncher; - public bool closedGame; + private bool isHighGradeEdition; + + public bool IsHighGradeEdition + { + get { return isHighGradeEdition; } + set { isHighGradeEdition = value; } + } + int index; /// /// Gets the model. @@ -198,6 +203,5 @@ void WriteByteFromAddress(UIntPtr codecaveAddress, Process proc, long offset1, i } return proccess; } - } } diff --git a/MHFZ_Overlay/MainWindow.xaml.cs b/MHFZ_Overlay/MainWindow.xaml.cs index cf6e4ee4..2b179030 100644 --- a/MHFZ_Overlay/MainWindow.xaml.cs +++ b/MHFZ_Overlay/MainWindow.xaml.cs @@ -109,7 +109,7 @@ protected override void OnSourceInitialized(EventArgs e) /// /// The client. /// - public DiscordRpcClient Client; + private DiscordRpcClient Client; //Called when your application first starts. //For example, just before your main loop, on OnEnable for unity. @@ -262,7 +262,7 @@ void Cleanup() /// /// Is the main loop currently running? /// - public bool isDiscordRPCRunning = false; + private bool isDiscordRPCRunning = false; /// /// Initializes the discord RPC. @@ -291,7 +291,7 @@ private void InitializeDiscordRPC() } //should work fine - presenceTemplate.Buttons = new DiscordRPC.Button[] { }; ; + presenceTemplate.Buttons = new DiscordRPC.Button[] { }; presenceTemplate.Buttons = new DiscordRPC.Button[] { new DiscordRPC.Button() {Label = "【MHF-Z】Overlay "+CurrentProgramVersion, Url = "https://github.com/DorielRivalet/MHFZ_Overlay"}, @@ -300,7 +300,7 @@ private void InitializeDiscordRPC() if (GetDiscordServerInvite != "") { - presenceTemplate.Buttons = new DiscordRPC.Button[] { }; ; + presenceTemplate.Buttons = new DiscordRPC.Button[] { }; presenceTemplate.Buttons = new DiscordRPC.Button[] { new DiscordRPC.Button() {Label = "【MHF-Z】Overlay "+CurrentProgramVersion, Url = "https://github.com/DorielRivalet/MHFZ_Overlay"}, @@ -395,7 +395,9 @@ private static void OpenLink(string destinationurl) System.Diagnostics.Process.Start(sInfo); } - public bool isLatestRelease; + private bool isLatestRelease; + private bool closedGame; + private bool isInLauncherBool; public void CheckGameState() { @@ -418,11 +420,11 @@ public void CheckGameState() if (className == "MHFLAUNCH") { System.Windows.MessageBox.Show("Detected launcher, please restart overlay when fully loading into Mezeporta.", "Error", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); - DataLoader.isInLauncher = true; + isInLauncherBool = true; } else { - DataLoader.isInLauncher = false; + isInLauncherBool = false; } //https://stackoverflow.com/questions/51148/how-do-i-find-out-if-a-process-is-already-running-using-c @@ -432,8 +434,8 @@ public void CheckGameState() mhfProcess.EnableRaisingEvents = true; mhfProcess.Exited += (sender, e) => { - - DataLoader.closedGame = true; + + closedGame = true; Settings s = (Settings)Application.Current.TryFindResource("Settings"); if (s.EnableAutoClose) @@ -448,7 +450,7 @@ public void CheckGameState() System.Windows.MessageBox.Show("Detected closed game, please restart overlay when fully loading into Mezeporta.", "Warning", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Warning); } }; - }; + } } @@ -1487,9 +1489,9 @@ public string GetOverlayMode() if (DataLoader.model.Configuring) return "(Configuring) "; - else if (DataLoader.closedGame) + else if (closedGame) return "(Closed Game) "; - else if (DataLoader.isInLauncher || isInLauncher() == "Yes") //works? + else if (isInLauncherBool || isInLauncher() == "Yes") //works? return "(Launcher) "; else if (isInLauncher() == "NULL") return "(No game detected) "; @@ -1553,8 +1555,8 @@ public static bool ShowCurrentHPPercentage() return false; } - public int currentMonster1MaxHP = 0; - public string currentMonster1HPPercent = ""; + private int currentMonster1MaxHP = 0; + private string currentMonster1HPPercent = ""; /// /// Gets the monster1 ehp percent. @@ -1911,7 +1913,7 @@ public string GetQuestInformation() return ""; case 21731://1st district dure case 21749://sky corridor version - return "Slay 1st District Duremudira | "; ; + return "Slay 1st District Duremudira | "; case 21746://2nd district dure case 21750://sky corridor version return "Slay 2nd District Duremudira | "; @@ -1964,7 +1966,7 @@ public string GetRavienteEvent(int id) /// public string GetQuestState() { - if (DataLoader.isInLauncher) //works? + if (isInLauncherBool) //works? return ""; switch (DataLoader.model.QuestState()) @@ -2015,7 +2017,7 @@ private void UpdateDiscordRPC() return; } - presenceTemplate.Details = string.Format("{0}{1}{2}{3}{4}{5}", GetPartySize(), GetQuestState(),GetCaravanScore(), GetOverlayMode(), GetAreaName(DataLoader.model.AreaID()), GetGameMode(DataLoader.isHighGradeEdition)); + presenceTemplate.Details = string.Format("{0}{1}{2}{3}{4}{5}", GetPartySize(), GetQuestState(),GetCaravanScore(), GetOverlayMode(), GetAreaName(DataLoader.model.AreaID()), GetGameMode(DataLoader.IsHighGradeEdition)); //quest ids: //mp road: 23527 @@ -2616,7 +2618,7 @@ private void OpenConfigButton_Key() { if (IsDragConfigure) return; - if (DataLoader.isInLauncher) + if (isInLauncherBool) System.Windows.MessageBox.Show("Using the configuration menu outside of the game might cause slow performance", "Warning", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Warning); if (configWindow == null || !configWindow.IsLoaded) diff --git a/MHFZ_Overlay/addresses/AddressModel.cs b/MHFZ_Overlay/addresses/AddressModel.cs index ed844a90..d815ab62 100644 --- a/MHFZ_Overlay/addresses/AddressModel.cs +++ b/MHFZ_Overlay/addresses/AddressModel.cs @@ -22,8 +22,8 @@ public abstract class AddressModel : INotifyPropertyChanged public readonly Mem M; - public int SavedMonster1MaxHP = 0; - public int SavedMonster2MaxHP = 0; + private int SavedMonster1MaxHP = 0; + private int SavedMonster2MaxHP = 0; private int SavedMonster3MaxHP = 0; private int SavedMonster4MaxHP = 0; @@ -33,9 +33,21 @@ public abstract class AddressModel : INotifyPropertyChanged public AddressModel(Mem m) => M = m; - public int SelectedMonster = 0; + private int selectedMonster = 0; - public string SavedGearStats = ""; + public int SelectedMonster + { + get { return selectedMonster; } + set { selectedMonster = value; } + } + + private string savedGearStats = ""; + + public string SavedGearStats + { + get { return savedGearStats; } + set { savedGearStats = value; } + } #endregion @@ -675,7 +687,7 @@ public static string LoremImpsum } } - public bool _configuring = false; + private bool _configuring = false; /// /// Shows the monster ehp. @@ -1071,9 +1083,9 @@ public string GetRoadTimerResetMode() else return "Never"; } - public int MaxSharpness = 0; + private int MaxSharpness = 0; - public string TimeLeftPercent = ""; + private string TimeLeftPercent = ""; public string TimeLeftPercentNumber { @@ -1177,7 +1189,19 @@ public string Time } //per quest - public int HighestAtk = 0; + private int highestAtk = 0; + + public int HighestAtk + { + get + { + return highestAtk; + } + set + { + highestAtk = value; + } + } /// /// Shows the color of the highest atk. @@ -1343,8 +1367,6 @@ public string AtkMult } } - public bool isMonsterFocused = false; - /// /// Displays the monster ehp. /// @@ -1965,7 +1987,7 @@ public string getMonsterName(int id, bool isFirstMonster = true) if (monstername != null && monstername != RealMonsterName && isFirstMonster) return string.Format("{0}{1}", GetRankName(RankBand()), RealMonsterName); else - return string.Format("{0}{1}", GetRankName(RankBand()), monstername); ; + return string.Format("{0}{1}", GetRankName(RankBand()), monstername); } #region monster hp @@ -2279,11 +2301,8 @@ public string GetRealWeaponName string className = GetWeaponClass(); string lv = GetWeaponNameFromType(WeaponType()).Contains("Bowgun") ? GetGRWeaponLevel(GRWeaponLvBowguns()) : GetGRWeaponLevel(GRWeaponLv()); - if (GetTextFormat() == "Markdown") - { - if (lv == " Lv. 50" || lv == " Lv. 100") - lv = string.Format("**{0}**", lv); - } + if ((GetTextFormat() == "Markdown") && (lv == " Lv. 50" || lv == " Lv. 100")) + lv = string.Format("**{0}**", lv); var style = WeaponStyle() switch { @@ -4106,7 +4125,19 @@ public static bool Is11GSR999() return false; } - public string MarkdownSavedGearStats = ""; + private string markdownSavedGearStats = ""; + + public string MarkdownSavedGearStats + { + get + { + return markdownSavedGearStats; + } + set + { + markdownSavedGearStats = value; + } + } /// /// Determines whether [is fixed GSR skill value] [the specified skill name]. @@ -7100,8 +7131,6 @@ public static string GetGameRewardInfo "※Attention\r\n・When Guild Poogie's \"Poogie Reward Technique\" is activated, the basic reward frame may exceed the upper limit and all 3 rows (24 frames) may become reward frames.\r\n・When a PT (2-4 people) of the same hunting party goes on a quest with different street name titles set for each other, the \"Street Name Title Skill (equivalent to Luck)\" will be activated with a certain probability. (Priority is given to the \"Great Luck\" skill.)\r\n・If you have a Super Lucky Charm, a Large Lucky Charm, or have purchased the Assist Course, it has the same effect as the Great Luck Skill.\r\n・Some quest rewards have fixed slots, in which case only the specified amount of reward slots will appear, regardless of luck skill, etc.\n\n" + "●\u3000Obtaining Reward Materials\r\nOnce the number of frames has been determined, reward materials will be picked via RNG from a list according to the probability, and will be placed in order from the first frame.\r\nQuest rewards may have a fixed item, and always only the first slot will have a fixed item, not a RNG.\r\nFinally, each reward is sorted by item code.\r\nAdditional rewards for hunting HC Red Rajang, HC tickets and souls for each weapon will be added afterwards.\r\n\r\nIf you have the following charms, the number of materials obtained will be increased.\r\n・Super Lucky Charm:There is a 50% chance that the materials obtained will be doubled.\r\n・Large Lucky Charm:There is a 15% chance that the materials obtained will be doubled.\r\n\r\nThe \"Super Lucky Charm\" and the \"Large Lucky Charm\" can be used together. When they are used together, the \"Super Lucky Charm\" will activate the \"Super Luck\" skill, and then the \"Large Lucky Charm\" will activate the \"Great Luck\" skill.\r\n\r\n※Attention\r\n・In the case of practice quests, when \"no items\" is selected, the drawing ends there and no further drawings will be made.\r\n・Some quests have a fixed quota of rewards, in which case you only get the specified number of rewards, regardless of your charms, skills, etc.\n\n" + "Daily Special\r\nThe following benefits are available once a day (updated at 12:00) in the \"Daily Special\" section of the General Shop.\r\nThe maximum N-point limit is 60,000 P. Others are overwritten each time they are received.\r\n\r\nN points\tTrial course: 1 point\r\nHunter Life Course: +3 points\r\nExtra course: +1 point\r\nPoint Bonus Rights\t3x\r\nGet Halk Pot\t5x\r\nDaily Quest Rights\t1x"; - ; - } } diff --git a/MHFZ_Overlay/controls/CustomProgressBar.xaml.cs b/MHFZ_Overlay/controls/CustomProgressBar.xaml.cs index ba8181ea..5566fe6e 100644 --- a/MHFZ_Overlay/controls/CustomProgressBar.xaml.cs +++ b/MHFZ_Overlay/controls/CustomProgressBar.xaml.cs @@ -156,7 +156,19 @@ public string CurrentHPPercentNumber /// /// The current hp percent /// - public string CurrentHPPercent = ""; + private string currentHPPercent = ""; + + public string CurrentHPPercent + { + get + { + return currentHPPercent; + } + set + { + currentHPPercent = value; + } + } /// /// Gets the descriptor horizontal alignment. @@ -246,7 +258,8 @@ public float Value /// public string Desc { - get => Description; set => Description = value; + get { return Description; } + set { Description = value; } } #endregion }