diff --git a/MHFZ_Overlay/Models/Addresses/AddressModelHGE.cs b/MHFZ_Overlay/Models/Addresses/AddressModelHGE.cs index b497c782..54487d61 100644 --- a/MHFZ_Overlay/Models/Addresses/AddressModelHGE.cs +++ b/MHFZ_Overlay/Models/Addresses/AddressModelHGE.cs @@ -718,12 +718,12 @@ public AddressModelHGE(Mem m) public override int CaravanScore() => this.M.ReadInt("mhfo-hd.dll+ED8F764"); /// - public override int CaravanMonster1ID() => this.M.ReadByte("mhfo-hd.dll+2AFA834"); + public override int AlternativeQuestMonster1ID() => this.M.ReadByte("mhfo-hd.dll+2AFA834"); // unsure /// - public override int CaravanMonster2ID() => this.M.ReadByte("mhfo-hd.dll+1C41D12"); + public override int AlternativeQuestMonster2ID() => this.M.ReadByte("mhfo-hd.dll+1C41D12"); /// public override int BlademasterWeaponID() => this.M.Read2Byte("mhfo-hd.dll+DC6BB52"); diff --git a/MHFZ_Overlay/Models/Addresses/AddressModelNotHGE.cs b/MHFZ_Overlay/Models/Addresses/AddressModelNotHGE.cs index 2feb32a6..7452f237 100644 --- a/MHFZ_Overlay/Models/Addresses/AddressModelNotHGE.cs +++ b/MHFZ_Overlay/Models/Addresses/AddressModelNotHGE.cs @@ -626,12 +626,12 @@ public AddressModelNotHGE(Mem m) public override int CaravanScore() => this.M.ReadInt("mhfo.dll+6154FC4"); /// - public override int CaravanMonster1ID() => this.M.ReadByte("mhfo.dll+28C2C84"); + public override int AlternativeQuestMonster1ID() => this.M.ReadByte("mhfo.dll+28C2C84"); // unsure /// - public override int CaravanMonster2ID() => this.M.ReadByte("mhfo.dll+28C2C8C"); + public override int AlternativeQuestMonster2ID() => this.M.ReadByte("mhfo.dll+28C2C8C"); /// public override int BlademasterWeaponID() => this.M.Read2Byte("mhfo.dll+5033F92"); diff --git a/MHFZ_Overlay/Models/Constant/Messages.cs b/MHFZ_Overlay/Models/Constant/Messages.cs index 34ed2b72..59311b2a 100644 --- a/MHFZ_Overlay/Models/Constant/Messages.cs +++ b/MHFZ_Overlay/Models/Constant/Messages.cs @@ -41,6 +41,10 @@ public static class Messages public const string MonsterImageNotLoaded = @"pack://application:,,,/MHFZ_Overlay;component/Assets/Icons/png/monster/none.png"; + public const string MonsterImageBaseLinkGitHub = @"https://raw.githubusercontent.com/DorielRivalet/mhfz-overlay/main/img/monster/"; + + public const string MonsterImageBaseLinkApp = @"pack://application:,,,/MHFZ_Overlay;component/Assets/Icons/png/monster/"; + public const string SecretAchievement = "???"; public const string UnknownMonsterIcon = "https://i.imgur.com/3pQEtzw.png"; diff --git a/MHFZ_Overlay/Services/DatabaseService.cs b/MHFZ_Overlay/Services/DatabaseService.cs index 028b90de..e0e44ff8 100644 --- a/MHFZ_Overlay/Services/DatabaseService.cs +++ b/MHFZ_Overlay/Services/DatabaseService.cs @@ -10,6 +10,7 @@ namespace MHFZ_Overlay.Services; using System; +using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Data; @@ -472,8 +473,11 @@ public void InsertPersonalBest(DataLoader dataLoader, long currentPersonalBest, long runBuffs = (long)dataLoader.Model.GetRunBuffs(); dataLoader.Model.ShowSaveIcon = true; var timeLeft = dataLoader.Model.TimeInt(); + var monster1ID = dataLoader.Model.IsAlternativeQuestName() || dataLoader.Model.IsDure() ? dataLoader.Model.AlternativeQuestMonster1ID() : dataLoader.Model.LargeMonster1ID(); + var monster2ID = dataLoader.Model.IsAlternativeQuestName() || dataLoader.Model.IsDure() ? dataLoader.Model.AlternativeQuestMonster2ID() : dataLoader.Model.LargeMonster2ID(); // TODO dure timedefint address + // TODO arrogant is different? var timeDefIint = questID != Numbers.QuestIDFirstDistrictDuremudira && questID != Numbers.QuestIDSecondDistrictDuremudira ? dataLoader.Model.TimeDefInt() : Numbers.DuremudiraTimeLimitFrames; var finalTimeValue = timeDefIint - timeLeft; @@ -630,15 +634,15 @@ public void InsertPersonalBest(DataLoader dataLoader, long currentPersonalBest, // Convert the elapsed time to a DateTime object string objectiveImage; - // Gathering/etc - if ((dataLoader.Model.ObjectiveType() == 0x0 || dataLoader.Model.ObjectiveType() == 0x02 || dataLoader.Model.ObjectiveType() == 0x1002) && dataLoader.Model.QuestID() != 23527 && dataLoader.Model.QuestID() != 23628 && dataLoader.Model.QuestID() != 21749 && dataLoader.Model.QuestID() != 21750 && dataLoader.Model.QuestID() != Numbers.QuestIDFirstDistrictDuremudira && dataLoader.Model.QuestID() != Numbers.QuestIDSecondDistrictDuremudira) + if (dataLoader.Model.QuestID() == Numbers.QuestIDSecondDistrictDuremudira || dataLoader.Model.QuestID() == Numbers.QuestIDFirstDistrictDuremudira || dataLoader.Model.QuestID() == Numbers.QuestIDArrogantDuremudiraRepel || dataLoader.Model.QuestID() == Numbers.QuestIDArrogantDuremudira) { - objectiveImage = ViewModels.Windows.AddressModel.GetAreaIconFromID(dataLoader.Model.AreaID()); + objectiveImage = dataLoader.Model.GetDuremudiraIcon(dataLoader.Model.QuestID()); } - else if (dataLoader.Model.QuestID() == Numbers.QuestIDSecondDistrictDuremudira || dataLoader.Model.QuestID() == Numbers.QuestIDFirstDistrictDuremudira) + // Gathering/etc + else if ((dataLoader.Model.ObjectiveType() == 0x0 || dataLoader.Model.ObjectiveType() == 0x02 || dataLoader.Model.ObjectiveType() == 0x1002) && dataLoader.Model.QuestID() != 23527 && dataLoader.Model.QuestID() != 23628 && dataLoader.Model.QuestID() != 21749 && dataLoader.Model.QuestID() != 21750) { - objectiveImage = dataLoader.Model.GetMonsterIcon(132); + objectiveImage = ViewModels.Windows.AddressModel.GetAreaIconFromID(dataLoader.Model.AreaID()); } // Tenrou Sky Corridor areas @@ -653,26 +657,20 @@ public void InsertPersonalBest(DataLoader dataLoader, long currentPersonalBest, objectiveImage = ViewModels.Windows.AddressModel.GetAreaIconFromID(dataLoader.Model.AreaID()); } - // Duremudira Arena - else if (dataLoader.Model.AreaID() == 398) - { - objectiveImage = dataLoader.Model.GetMonsterIcon(dataLoader.Model.LargeMonster1ID()); - } - // Hunter's Road Base Camp else if (dataLoader.Model.AreaID() == 459) { objectiveImage = ViewModels.Windows.AddressModel.GetAreaIconFromID(dataLoader.Model.AreaID()); } - // Raviente + // TODO test Raviente else if (dataLoader.Model.AreaID() is 309 or (>= 311 and <= 321) or (>= 417 and <= 422) or 437 or (>= 440 and <= 444)) { - objectiveImage = dataLoader.Model.GetMonsterIcon(dataLoader.Model.LargeMonster1ID()); + objectiveImage = dataLoader.Model.GetMonsterIcon(monster1ID); } else { - objectiveImage = dataLoader.Model.GetMonsterIcon(dataLoader.Model.LargeMonster1ID()); + objectiveImage = dataLoader.Model.GetMonsterIcon(monster1ID); } var objectiveTypeID = model.ObjectiveType(); @@ -3435,7 +3433,7 @@ private static void HandleError(SQLiteTransaction? transaction, Exception ex) // Roll back the transaction if (transaction != null) { - serverVersion = transaction.Connection.ServerVersion; + serverVersion = transaction.Connection?.ServerVersion ?? "null"; transaction.Rollback(); } @@ -17560,12 +17558,403 @@ FROM PersonalBests INNER JOIN Quests ON PersonalBests.RunID = Quests.RunID"; AlterTablePersonalBests(connection, sql, transferDataSql); + } + private void PerformUpdateToVersion_0_37_0(SQLiteConnection connection, DataLoader dataLoader) + { // TODO replace actualoverlaymode speedruns and runbuffs at 0. first do the runbuffs. UpdateRunBuffs(connection, dataLoader); UpdateQuestsActualOverlayMode(connection); UpdateTableActualOverlayMode("PersonalBestAttempts", connection); UpdateTableActualOverlayMode("QuestAttempts", connection); + + UpdateQuestsObjectiveImage(connection); + UpdateQuestsMonsterDictionaries(connection, dataLoader); + } + + /// + /// TODO replace none images + /// + /// + private void UpdateQuestsObjectiveImage(SQLiteConnection conn) + { + if (string.IsNullOrEmpty(this.dataSource)) + { + Logger.Warn(CultureInfo.InvariantCulture, "Cannot update objective images for quests table. dataSource: {0}", this.dataSource); + return; + } + + // Start a transaction + using (var transaction = conn.BeginTransaction()) + { + try + { + using (var cmd0 = new SQLiteCommand(conn)) + { + cmd0.CommandText = @"DROP TRIGGER IF EXISTS prevent_quest_updates"; + cmd0.ExecuteNonQuery(); + } + + using (var cmd = new SQLiteCommand(conn)) + { + cmd.CommandText = "SELECT * FROM Quests"; + + using (var reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + var img = reader["ObjectiveImage"].ToString(); + var runID = long.Parse(reader["RunID"]?.ToString() ?? "0", CultureInfo.InvariantCulture); + var questID = long.Parse(reader["QuestID"]?.ToString() ?? "0", CultureInfo.InvariantCulture); + + if (runID == 0 || img == "" || img == null || questID == 0) + { + continue; + } + + var newImg = questID == Numbers.QuestIDFirstDistrictDuremudira || questID == Numbers.QuestIDSecondDistrictDuremudira ? MonsterImages.MonsterImageID[132] : img.Replace(Messages.MonsterImageBaseLinkGitHub, Messages.MonsterImageBaseLinkApp); + + if (newImg == img) + { + continue; + } + + using (var cmd2 = new SQLiteCommand(conn)) + { + cmd2.CommandText = "UPDATE Quests SET ObjectiveImage = @newImg WHERE RunID = @RunID"; + cmd2.Parameters.AddWithValue("@RunID", runID); + cmd2.Parameters.AddWithValue("@newImg", newImg); + + cmd2.ExecuteNonQuery(); + } + } + } + } + + using (var cmd1 = new SQLiteCommand(conn)) + { + cmd1.CommandText = @"CREATE TRIGGER IF NOT EXISTS prevent_quest_updates + AFTER UPDATE ON Quests + FOR EACH ROW + WHEN NEW.YouTubeID = OLD.YouTubeID + BEGIN + SELECT RAISE(ABORT, 'Cannot update quest fields'); + END;"; + cmd1.ExecuteNonQuery(); + } + + // Commit the transaction + transaction.Commit(); + } + catch (Exception ex) + { + HandleError(transaction, ex); + } + } + + Logger.Debug("Updated speedrun modes in quests table"); + } + + /// + /// For dures/ravi/etc. + /// + /// + private void UpdateQuestsMonsterDictionaries(SQLiteConnection conn, DataLoader dataLoader) + { + if (string.IsNullOrEmpty(this.dataSource)) + { + Logger.Warn(CultureInfo.InvariantCulture, "Cannot update monster dictionaries for quests table. dataSource: {0}", this.dataSource); + return; + } + + // Start a transaction + using (var transaction = conn.BeginTransaction()) + { + try + { + using (var cmd0 = new SQLiteCommand(conn)) + { + cmd0.CommandText = @"DROP TRIGGER IF EXISTS prevent_quest_updates"; + cmd0.ExecuteNonQuery(); + } + + using (var cmd = new SQLiteCommand(conn)) + { + cmd.CommandText = "SELECT * FROM Quests"; + + using (var reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + var questID = long.Parse(reader["QuestID"]?.ToString() ?? "0", CultureInfo.InvariantCulture); + + if (questID != Numbers.QuestIDFirstDistrictDuremudira || questID != Numbers.QuestIDSecondDistrictDuremudira) + { + continue; + } + + string monster1HPString = reader["Monster1HPDictionary"].ToString() ?? "{}"; + + if (monster1HPString == string.Empty || monster1HPString == "{}") + { + continue; + } + + string monster1AttackMultiplierString = reader["Monster1AttackMultiplierDictionary"].ToString() ?? "{}"; + string monster1DefenseRateString = reader["Monster1DefenseRateictionary"].ToString() ?? "{}"; + string monster1SizeMultiplierString = reader["Monster1SizeMultiplierDictionary"].ToString() ?? "{}"; + string monster1StunThresholdString = reader["Monster1StunThresholdDictionary"].ToString() ?? "{}"; + string monster1PartThresholdString = reader["Monster1PartThresholdDictionary"].ToString() ?? "{}"; + + var runID = long.Parse(reader["RunID"]?.ToString() ?? "0", CultureInfo.InvariantCulture); + + var monster1HPDictionary = JsonConvert.DeserializeObject>>(monster1HPString); + var monster1AttackMultiplierDictionary = JsonConvert.DeserializeObject>>(monster1AttackMultiplierString); + var monster1DefenseRateDictionary = JsonConvert.DeserializeObject>>(monster1DefenseRateString); + var monster1SizeMultiplierDictionary = JsonConvert.DeserializeObject>>(monster1SizeMultiplierString); + var monster1StunThresholdDictionary = JsonConvert.DeserializeObject>>(monster1StunThresholdString); + var monster1PartThresholdDictionary = JsonConvert.DeserializeObject>>>(monster1PartThresholdString); + + if (monster1HPDictionary == null || runID == 0 || monster1HPDictionary.Count == 0 || questID == 0) + { + continue; + } + + Dictionary> newMonster1HPDictionary = new(); + Dictionary> newMonster1AttackMultiplierDictionary = new(); + Dictionary> newMonster1DefenseRateDictionary = new(); + Dictionary> newMonster1SizeMultiplierDictionary = new(); + Dictionary> newMonster1StunThresholdDictionary = new(); + Dictionary>> newMonster1PartThresholdDictionary = new(); + + // check if its dure or alt quest + // if it is, change it + // TODO ravi? + foreach (var entry in monster1HPDictionary) + { + var monsterID = entry.Value.FirstOrDefault().Key; + + if (dataLoader.Model.IsDure((int)questID) || dataLoader.Model.IsAlternativeQuestName((int)questID)) + { + switch (questID) + { + case Numbers.QuestIDArrogantDuremudira: + case Numbers.QuestIDArrogantDuremudiraRepel: + monsterID = 167; + break; + case Numbers.QuestIDFirstDistrictDuremudira: + case Numbers.QuestIDSecondDistrictDuremudira: + monsterID = 132; + break; + } + } + + Dictionary monsterEntry = new Dictionary() + { + {monsterID, entry.Value.FirstOrDefault().Value}, + }; + + newMonster1HPDictionary.Add(entry.Key, monsterEntry); + } + + if (monster1AttackMultiplierDictionary != null) + { + foreach (var entry in monster1AttackMultiplierDictionary) + { + var monsterID = entry.Value.FirstOrDefault().Key; + + if (dataLoader.Model.IsDure((int)questID) || dataLoader.Model.IsAlternativeQuestName((int)questID)) + { + switch (questID) + { + case Numbers.QuestIDArrogantDuremudira: + case Numbers.QuestIDArrogantDuremudiraRepel: + monsterID = 167; + break; + case Numbers.QuestIDFirstDistrictDuremudira: + case Numbers.QuestIDSecondDistrictDuremudira: + monsterID = 132; + break; + } + } + + Dictionary monsterEntry = new Dictionary() + { + {monsterID, entry.Value.FirstOrDefault().Value}, + }; + + newMonster1AttackMultiplierDictionary.Add(entry.Key, monsterEntry); + } + } + + if (monster1DefenseRateDictionary != null) + { + foreach (var entry in monster1DefenseRateDictionary) + { + var monsterID = entry.Value.FirstOrDefault().Key; + + if (dataLoader.Model.IsDure((int)questID) || dataLoader.Model.IsAlternativeQuestName((int)questID)) + { + switch (questID) + { + case Numbers.QuestIDArrogantDuremudira: + case Numbers.QuestIDArrogantDuremudiraRepel: + monsterID = 167; + break; + case Numbers.QuestIDFirstDistrictDuremudira: + case Numbers.QuestIDSecondDistrictDuremudira: + monsterID = 132; + break; + } + } + + Dictionary monsterEntry = new Dictionary() + { + {monsterID, entry.Value.FirstOrDefault().Value}, + }; + + newMonster1DefenseRateDictionary.Add(entry.Key, monsterEntry); + } + } + + if (monster1SizeMultiplierDictionary != null) + { + foreach (var entry in monster1SizeMultiplierDictionary) + { + var monsterID = entry.Value.FirstOrDefault().Key; + + if (dataLoader.Model.IsDure((int)questID) || dataLoader.Model.IsAlternativeQuestName((int)questID)) + { + switch (questID) + { + case Numbers.QuestIDArrogantDuremudira: + case Numbers.QuestIDArrogantDuremudiraRepel: + monsterID = 167; + break; + case Numbers.QuestIDFirstDistrictDuremudira: + case Numbers.QuestIDSecondDistrictDuremudira: + monsterID = 132; + break; + } + } + + Dictionary monsterEntry = new Dictionary() + { + {monsterID, entry.Value.FirstOrDefault().Value}, + }; + + newMonster1SizeMultiplierDictionary.Add(entry.Key, monsterEntry); + } + } + + if (monster1StunThresholdDictionary != null) + { + foreach (var entry in monster1StunThresholdDictionary) + { + var monsterID = entry.Value.FirstOrDefault().Key; + + if (dataLoader.Model.IsDure((int)questID) || dataLoader.Model.IsAlternativeQuestName((int)questID)) + { + switch (questID) + { + case Numbers.QuestIDArrogantDuremudira: + case Numbers.QuestIDArrogantDuremudiraRepel: + monsterID = 167; + break; + case Numbers.QuestIDFirstDistrictDuremudira: + case Numbers.QuestIDSecondDistrictDuremudira: + monsterID = 132; + break; + } + } + + Dictionary monsterEntry = new Dictionary() + { + {monsterID, entry.Value.FirstOrDefault().Value}, + }; + + newMonster1StunThresholdDictionary.Add(entry.Key, monsterEntry); + } + } + + if (monster1PartThresholdDictionary != null) + { + foreach (var entry in monster1PartThresholdDictionary) + { + var monsterID = entry.Value.FirstOrDefault().Key; + + if (dataLoader.Model.IsDure((int)questID) || dataLoader.Model.IsAlternativeQuestName((int)questID)) + { + switch (questID) + { + case Numbers.QuestIDArrogantDuremudira: + case Numbers.QuestIDArrogantDuremudiraRepel: + monsterID = 167; + break; + case Numbers.QuestIDFirstDistrictDuremudira: + case Numbers.QuestIDSecondDistrictDuremudira: + monsterID = 132; + break; + } + } + + Dictionary> monsterEntry = new Dictionary>() + { + {monsterID, entry.Value.FirstOrDefault().Value}, + }; + + newMonster1PartThresholdDictionary.Add(entry.Key, monsterEntry); + } + } + + using (var cmd2 = new SQLiteCommand(conn)) + { + cmd2.CommandText = @"UPDATE + Quests + SET + Monster1HPDictionary = @Monster1HPDictionary, + Monster1AttackMultiplierDictionary = @Monster1AttackMultiplierDictionary, + Monster1DefenseRateictionary = @Monster1DefenseRateictionary, + Monster1SizeMultiplierDictionary = @Monster1SizeMultiplierDictionary, + Monster1StunThresholdDictionary = @Monster1StunThresholdDictionary, + Monster1PartThresholdDictionary = @Monster1PartThresholdDictionary WHERE + RunID = @RunID"; + cmd2.Parameters.AddWithValue("@RunID", runID); + cmd2.Parameters.AddWithValue("@Monster1HPDictionary", newMonster1HPDictionary); + cmd2.Parameters.AddWithValue("@Monster1AttackMultiplierDictionary", newMonster1AttackMultiplierDictionary); + cmd2.Parameters.AddWithValue("@Monster1DefenseRateictionary", newMonster1DefenseRateDictionary); + cmd2.Parameters.AddWithValue("@Monster1SizeMultiplierDictionary", newMonster1SizeMultiplierDictionary); + cmd2.Parameters.AddWithValue("@Monster1StunThresholdDictionary", newMonster1StunThresholdDictionary); + cmd2.Parameters.AddWithValue("@Monster1PartThresholdDictionary", newMonster1PartThresholdDictionary); + + cmd2.ExecuteNonQuery(); + } + } + } + } + + using (var cmd1 = new SQLiteCommand(conn)) + { + cmd1.CommandText = @"CREATE TRIGGER IF NOT EXISTS prevent_quest_updates + AFTER UPDATE ON Quests + FOR EACH ROW + WHEN NEW.YouTubeID = OLD.YouTubeID + BEGIN + SELECT RAISE(ABORT, 'Cannot update quest fields'); + END;"; + cmd1.ExecuteNonQuery(); + } + + // Commit the transaction + transaction.Commit(); + } + catch (Exception ex) + { + HandleError(transaction, ex); + } + } + + Logger.Debug("Updated monster dictionaries in quests table"); } private void UpdateQuestsActualOverlayMode(SQLiteConnection conn) diff --git a/MHFZ_Overlay/Services/DiscordService.cs b/MHFZ_Overlay/Services/DiscordService.cs index 2e3fc6dd..f4578d5c 100644 --- a/MHFZ_Overlay/Services/DiscordService.cs +++ b/MHFZ_Overlay/Services/DiscordService.cs @@ -246,12 +246,12 @@ public void UpdateDiscordRPC(DataLoader dataLoader) break; case 21731: // 1st district dure case 21749: // sky corridor version - stateString = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}{5} | Slain: {6} | Encounters: {7}", ViewModels.Windows.AddressModel.GetQuestNameFromID(dataLoader.Model.QuestID()), ViewModels.Windows.AddressModel.GetObjectiveNameFromID(dataLoader.Model.ObjectiveType()), string.Empty, dataLoader.Model.GetObjective1Quantity(), dataLoader.Model.GetRankNameFromID(dataLoader.Model.RankBand()), dataLoader.Model.GetRealMonsterName(), dataLoader.Model.FirstDistrictDuremudiraSlays(), dataLoader.Model.FirstDistrictDuremudiraEncounters()); + stateString = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}{5} | Slain: {6} | Encounters: {7}", ViewModels.Windows.AddressModel.GetDiscordQuestNameFromID(dataLoader.Model.QuestID()), ViewModels.Windows.AddressModel.GetObjectiveNameFromID(dataLoader.Model.ObjectiveType()), string.Empty, dataLoader.Model.GetObjective1Quantity(), dataLoader.Model.GetRankNameFromID(dataLoader.Model.RankBand()), dataLoader.Model.GetRealMonsterName(), dataLoader.Model.FirstDistrictDuremudiraSlays(), dataLoader.Model.FirstDistrictDuremudiraEncounters()); PresenceTemplate.State = stateString.Length <= MaxDiscordRPCStringLength ? stateString : string.Concat(stateString.AsSpan(0, MaxDiscordRPCStringLength - 3), "..."); break; case 21746: // 2nd district dure case 21750: // sky corridor version - stateString = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}{5} | Slain: {6} | Encounters: {7}", ViewModels.Windows.AddressModel.GetQuestNameFromID(dataLoader.Model.QuestID()), ViewModels.Windows.AddressModel.GetObjectiveNameFromID(dataLoader.Model.ObjectiveType()), string.Empty, dataLoader.Model.GetObjective1Quantity(), dataLoader.Model.GetRankNameFromID(dataLoader.Model.RankBand()), dataLoader.Model.GetRealMonsterName(), dataLoader.Model.SecondDistrictDuremudiraSlays(), dataLoader.Model.SecondDistrictDuremudiraEncounters()); + stateString = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}{5} | Slain: {6} | Encounters: {7}", ViewModels.Windows.AddressModel.GetDiscordQuestNameFromID(dataLoader.Model.QuestID()), ViewModels.Windows.AddressModel.GetObjectiveNameFromID(dataLoader.Model.ObjectiveType()), string.Empty, dataLoader.Model.GetObjective1Quantity(), dataLoader.Model.GetRankNameFromID(dataLoader.Model.RankBand()), dataLoader.Model.GetRealMonsterName(), dataLoader.Model.SecondDistrictDuremudiraSlays(), dataLoader.Model.SecondDistrictDuremudiraEncounters()); PresenceTemplate.State = stateString.Length <= MaxDiscordRPCStringLength ? stateString : string.Concat(stateString.AsSpan(0, MaxDiscordRPCStringLength - 3), "..."); break; case 62105: // raviente quests @@ -279,20 +279,20 @@ public void UpdateDiscordRPC(DataLoader dataLoader) case 55605: case 55606: case 55607: - stateString = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}{5}{6} | True Raw: {7} (Max {8}) | Hits: {9}", ViewModels.Windows.AddressModel.GetQuestNameFromID(dataLoader.Model.QuestID()), ViewModels.Windows.AddressModel.GetObjectiveNameFromID(dataLoader.Model.ObjectiveType()), string.Empty, dataLoader.Model.GetObjective1Quantity(), dataLoader.Model.GetRankNameFromID(dataLoader.Model.RankBand()), dataLoader.Model.GetStarGrade(), dataLoader.Model.GetRealMonsterName(), dataLoader.Model.ATK, dataLoader.Model.HighestAtk, dataLoader.Model.HitCountInt()); + stateString = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}{5}{6} | True Raw: {7} (Max {8}) | Hits: {9}", ViewModels.Windows.AddressModel.GetDiscordQuestNameFromID(dataLoader.Model.QuestID()), ViewModels.Windows.AddressModel.GetObjectiveNameFromID(dataLoader.Model.ObjectiveType()), string.Empty, dataLoader.Model.GetObjective1Quantity(), dataLoader.Model.GetRankNameFromID(dataLoader.Model.RankBand()), dataLoader.Model.GetStarGrade(), dataLoader.Model.GetRealMonsterName(), dataLoader.Model.ATK, dataLoader.Model.HighestAtk, dataLoader.Model.HitCountInt()); PresenceTemplate.State = stateString.Length <= MaxDiscordRPCStringLength ? stateString : string.Concat(stateString.AsSpan(0, MaxDiscordRPCStringLength - 3), "..."); break; default: if ((dataLoader.Model.ObjectiveType() == 0x0 || dataLoader.Model.ObjectiveType() == 0x02 || dataLoader.Model.ObjectiveType() == 0x1002 || dataLoader.Model.ObjectiveType() == 0x10) && dataLoader.Model.QuestID() != 23527 && dataLoader.Model.QuestID() != 23628 && dataLoader.Model.QuestID() != 21731 && dataLoader.Model.QuestID() != 21749 && dataLoader.Model.QuestID() != 21746 && dataLoader.Model.QuestID() != 21750) { - stateString = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}{5}{6} | True Raw: {7} (Max {8}) | Hits: {9}", ViewModels.Windows.AddressModel.GetQuestNameFromID(dataLoader.Model.QuestID()), ViewModels.Windows.AddressModel.GetObjectiveNameFromID(dataLoader.Model.ObjectiveType()), dataLoader.Model.GetObjective1CurrentQuantity(), dataLoader.Model.GetObjective1Quantity(), dataLoader.Model.GetRankNameFromID(dataLoader.Model.RankBand()), dataLoader.Model.GetStarGrade(), ViewModels.Windows.AddressModel.GetObjective1Name(dataLoader.Model.Objective1ID()), dataLoader.Model.ATK, dataLoader.Model.HighestAtk, dataLoader.Model.HitCountInt()); + stateString = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}{5}{6} | True Raw: {7} (Max {8}) | Hits: {9}", ViewModels.Windows.AddressModel.GetDiscordQuestNameFromID(dataLoader.Model.QuestID()), ViewModels.Windows.AddressModel.GetObjectiveNameFromID(dataLoader.Model.ObjectiveType()), dataLoader.Model.GetObjective1CurrentQuantity(), dataLoader.Model.GetObjective1Quantity(), dataLoader.Model.GetRankNameFromID(dataLoader.Model.RankBand()), dataLoader.Model.GetStarGrade(), ViewModels.Windows.AddressModel.GetObjective1Name(dataLoader.Model.Objective1ID()), dataLoader.Model.ATK, dataLoader.Model.HighestAtk, dataLoader.Model.HitCountInt()); PresenceTemplate.State = stateString.Length <= MaxDiscordRPCStringLength ? stateString : string.Concat(stateString.AsSpan(0, MaxDiscordRPCStringLength - 3), "..."); } else { var questToggleMonsterMode = ShowDiscordQuestNames() ? string.Empty : GetQuestToggleMode(dataLoader.Model.QuestToggleMonsterMode()).TrimStart(); - stateString = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}{5}{6} | True Raw: {7} (Max {8}) | Hits: {9}", ViewModels.Windows.AddressModel.GetQuestNameFromID(dataLoader.Model.QuestID()), ViewModels.Windows.AddressModel.GetObjectiveNameFromID(dataLoader.Model.ObjectiveType()), dataLoader.Model.GetObjective1Quantity(), dataLoader.Model.GetRankNameFromID(dataLoader.Model.RankBand()), questToggleMonsterMode, dataLoader.Model.GetStarGrade(), dataLoader.Model.GetRealMonsterName(), dataLoader.Model.ATK, dataLoader.Model.HighestAtk, dataLoader.Model.HitCountInt()); + stateString = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}{5}{6} | True Raw: {7} (Max {8}) | Hits: {9}", ViewModels.Windows.AddressModel.GetDiscordQuestNameFromID(dataLoader.Model.QuestID()), ViewModels.Windows.AddressModel.GetObjectiveNameFromID(dataLoader.Model.ObjectiveType()), dataLoader.Model.GetObjective1Quantity(), dataLoader.Model.GetRankNameFromID(dataLoader.Model.RankBand()), questToggleMonsterMode, dataLoader.Model.GetStarGrade(), dataLoader.Model.GetRealMonsterName(), dataLoader.Model.ATK, dataLoader.Model.HighestAtk, dataLoader.Model.HitCountInt()); PresenceTemplate.State = stateString.Length <= MaxDiscordRPCStringLength ? stateString : string.Concat(stateString.AsSpan(0, MaxDiscordRPCStringLength - 3), "..."); } diff --git a/MHFZ_Overlay/ViewModels/Windows/AddressModel.cs b/MHFZ_Overlay/ViewModels/Windows/AddressModel.cs index 0f1bc56a..843c3d71 100644 --- a/MHFZ_Overlay/ViewModels/Windows/AddressModel.cs +++ b/MHFZ_Overlay/ViewModels/Windows/AddressModel.cs @@ -14,6 +14,7 @@ namespace MHFZ_Overlay.ViewModels.Windows; using System.Globalization; using System.IO; using System.Linq; +using System.Security.RightsManagement; using System.Text; using System.Windows; using System.Windows.Automation; @@ -201,9 +202,9 @@ 21747 or return true; } - if (this.CaravanOverride()) + if (this.AlternativeQuestOverride()) { - return this.ShowHPBar(this.CaravanMonster1ID(), this.Monster1HPInt()); + return this.ShowHPBar(this.AlternativeQuestMonster1ID(), this.Monster1HPInt()); } else { @@ -350,25 +351,25 @@ 21747 or public abstract int HalkSkill1(); public abstract int HalkSkill2(); - + public abstract int HalkSkill3(); - + public abstract int HalkElementNone(); - + public abstract int HalkFire(); - + public abstract int HalkThunder(); - + public abstract int HalkWater(); - + public abstract int HalkIce(); - + public abstract int HalkDragon(); - + public abstract int HalkSleep(); - + public abstract int HalkParalysis(); - + public abstract int HalkPoison(); public abstract int RankBand(); @@ -581,10 +582,10 @@ 21747 or public abstract int CaravanScore(); - public abstract int CaravanMonster1ID(); + public abstract int AlternativeQuestMonster1ID(); - // unsure - public abstract int CaravanMonster2ID(); + // TODO unsure + public abstract int AlternativeQuestMonster2ID(); public abstract int BlademasterWeaponID(); @@ -1341,7 +1342,7 @@ 21747 or /// public abstract int ActiveFeature3(); - public abstract int ServerHeartbeatLandAlternative (); + public abstract int ServerHeartbeatLandAlternative(); public abstract int ServerHeartbeatLandMain(); @@ -1350,31 +1351,31 @@ 21747 or public abstract int GuildFoodStart(); public abstract int DivaSongStart(); - + public abstract int GuildPoogie1Skill(); - + public abstract int GuildPoogie2Skill(); - + public abstract int GuildPoogie3Skill(); - + public abstract int DivaPrayerGemRedSkill(); - + public abstract int DivaPrayerGemRedLevel(); - + public abstract int DivaPrayerGemYellowSkill(); - + public abstract int DivaPrayerGemYellowLevel(); - + public abstract int DivaPrayerGemGreenSkill(); - + public abstract int DivaPrayerGemGreenLevel(); - + public abstract int DivaPrayerGemBlueSkill(); - + public abstract int DivaPrayerGemBlueLevel(); - + public abstract bool HalkOn(); - + public abstract bool HalkPotEffectOn(); public abstract int DivaSongFromGuildStart(); @@ -1412,14 +1413,16 @@ public bool HasMonster2 { get { + // road + // TODO replace all instances of magic numbers if (this.QuestID() is 23527 or 23628) { return true; } - if (this.CaravanOverride()) + if (this.AlternativeQuestOverride()) { - return this.ShowHPBar(this.CaravanMonster2ID(), this.Monster2HPInt()) && this.GetNotRoad(); + return this.ShowHPBar(this.AlternativeQuestMonster2ID(), this.Monster2HPInt()) && this.GetNotRoad(); } else { @@ -1552,11 +1555,11 @@ public static bool ShowOverlayStatIcon } /// - /// Gets the name of the quest. + /// Gets the name of the quest for discord. /// /// The identifier. /// - public static string GetQuestNameFromID(int id) + public static string GetDiscordQuestNameFromID(int id) { if (id > 63421 && DiscordService.ShowDiscordQuestNames()) { @@ -1573,6 +1576,13 @@ public static string GetQuestNameFromID(int id) return questValue1 + string.Empty; } + public static string GetQuestName(int questID) + { + EZlion.Mapper.Quest.IDName.TryGetValue(questID, out var questValue1); // returns true + + return questValue1 + string.Empty; + } + // TODO need to create another variable for discordManager. Ideally discordManager state only affects it. public int PreviousHubAreaID { get; set; } @@ -1872,27 +1882,37 @@ public bool IsValidBitfield(uint value, uint all) return (value & all) == value; } - public bool CaravanOverride() + public bool AlternativeQuestOverride() { var s = (Settings)Application.Current.TryFindResource("Settings"); return s.EnableCaravanOverride switch { "Enabled" => true, "Disabled" => false, - "Automatic" => this.IsAlternativeQuestName(), + "Automatic" => this.IsAlternativeQuestName() || this.IsDure(), _ => false, }; } - private bool QuestNameContainsAlternativeTitle() => GetQuestNameFromID(this.QuestID()).Contains("Daily Limited Quest≫") || - GetQuestNameFromID(this.QuestID()).Contains("Daily Quest≫") || - GetQuestNameFromID(this.QuestID()).Contains("Guild Quest≫") || - GetQuestNameFromID(this.QuestID()).Contains("Interception Base≫") || - GetQuestNameFromID(this.QuestID()).Contains("Interception Quest≫") || - GetQuestNameFromID(this.QuestID()).Contains("Interception Urgent Quest≫") || - GetQuestNameFromID(this.QuestID()).Contains("Great Slaying Quest≫") || - GetQuestNameFromID(this.QuestID()).Contains("G Rank Great Slaying≫") || - GetQuestNameFromID(this.QuestID()).Contains("New Weapon Type Acquisition≫"); + private bool QuestNameContainsAlternativeTitle() => GetQuestName(this.QuestID()).Contains("Daily Limited Quest≫") || + GetQuestName(this.QuestID()).Contains("Daily Quest≫") || + GetQuestName(this.QuestID()).Contains("Guild Quest≫") || + GetQuestName(this.QuestID()).Contains("Interception Base≫") || + GetQuestName(this.QuestID()).Contains("Interception Quest≫") || + GetQuestName(this.QuestID()).Contains("Interception Urgent Quest≫") || + GetQuestName(this.QuestID()).Contains("Great Slaying Quest≫") || + GetQuestName(this.QuestID()).Contains("G Rank Great Slaying≫") || + GetQuestName(this.QuestID()).Contains("New Weapon Type Acquisition≫"); + + private bool QuestNameContainsAlternativeTitle(int questID) => GetQuestName(questID).Contains("Daily Limited Quest≫") || + GetQuestName(questID).Contains("Daily Quest≫") || + GetQuestName(questID).Contains("Guild Quest≫") || + GetQuestName(questID).Contains("Interception Base≫") || + GetQuestName(questID).Contains("Interception Quest≫") || + GetQuestName(questID).Contains("Interception Urgent Quest≫") || + GetQuestName(questID).Contains("Great Slaying Quest≫") || + GetQuestName(questID).Contains("G Rank Great Slaying≫") || + GetQuestName(questID).Contains("New Weapon Type Acquisition≫"); private bool PreviousHubAreaIDIsAlternative() => this.PreviousHubAreaID switch { @@ -1901,7 +1921,7 @@ private bool QuestNameContainsAlternativeTitle() => GetQuestNameFromID(this.Ques _ => false, }; - private bool IsAlternativeQuestName() + public bool IsAlternativeQuestName() { if (this.QuestNameContainsAlternativeTitle() || this.PreviousHubAreaIDIsAlternative()) { @@ -1913,6 +1933,18 @@ private bool IsAlternativeQuestName() } } + public bool IsAlternativeQuestName(int questID) + { + if (this.QuestNameContainsAlternativeTitle(questID)) + { + return true; + } + else + { + return false; + } + } + public bool GetNotRoad() { var b = this.RoadOverride(); @@ -1940,9 +1972,9 @@ public string GetPartName(int number, int monsterID) { monsterID = this.RoadSelectedMonster() == 0 ? this.LargeMonster1ID() : this.LargeMonster2ID(); } - else if (this.CaravanOverride()) + else if (this.AlternativeQuestOverride()) { - monsterID = this.CaravanMonster1ID(); + monsterID = this.AlternativeQuestMonster1ID(); } if (this.GetDureName() != "None") @@ -2622,7 +2654,7 @@ public bool DivaSongEnding var expiry = divaSongStart + (60 * 90); double secondsLeft = expiry - ServerHeartbeat; - return secondsLeft <= 60*10; + return secondsLeft <= 60 * 10; } } @@ -3900,6 +3932,34 @@ public string GetDureName() } } + public string GetDureName(int questID) + { + if (questID is 21731 or 21749) + { + return "1st District Duremudira"; + } + else if (questID is 21746 or 21750) + { + return "2nd District Duremudira"; + } + else if (questID is 21747 or 21734) + { + return "3rd District Duremudira"; + } + else if (questID == 21748) + { + return "4th District Duremudira"; + } + else if (questID is 23648 or 23649) + { + return "Arrogant Duremudira"; + } + else + { + return "None"; + } + } + // quest ids // ravi 62105 TODO: same ids in all phases? // violent 62101 @@ -3980,7 +4040,7 @@ public string GetRaviName() } } - public string Monster2Name => this.CaravanOverride() ? this.GetMonsterName(this.CaravanMonster2ID(), false) : this.GetMonsterName(this.LargeMonster2ID(), false); + public string Monster2Name => this.AlternativeQuestOverride() ? this.GetMonsterName(this.AlternativeQuestMonster2ID(), false) : this.GetMonsterName(this.LargeMonster2ID(), false); public string Monster3Name => this.GetMonsterName(this.LargeMonster3ID(), false); @@ -4003,9 +4063,9 @@ public string RealMonsterName { id = this.RoadSelectedMonster() == 0 ? this.LargeMonster1ID() : this.LargeMonster2ID(); } - else if (this.CaravanOverride()) + else if (this.AlternativeQuestOverride()) { - id = this.CaravanMonster1ID(); + id = this.AlternativeQuestMonster1ID(); } else { @@ -4412,9 +4472,9 @@ public string CurrentMonster1Icon { id = this.RoadSelectedMonster() == 0 ? this.LargeMonster1ID() : this.LargeMonster2ID(); } - else if (this.CaravanOverride()) + else if (this.AlternativeQuestOverride()) { - id = this.CaravanMonster1ID(); + id = this.AlternativeQuestMonster1ID(); } else { @@ -4626,9 +4686,9 @@ public string CurrentMonster2Icon { id = this.RoadSelectedMonster() == 0 ? this.LargeMonster2ID() : this.LargeMonster1ID(); } - else if (this.CaravanOverride()) + else if (this.AlternativeQuestOverride()) { - id = this.CaravanMonster2ID(); + id = this.AlternativeQuestMonster2ID(); } else { @@ -11242,6 +11302,18 @@ public string GetRankNameFromID(int id, bool isLargeImageText = false) return this.GetRankName(id); } + public string GetDuremudiraIcon(int questID) + { + return questID switch + { + Numbers.QuestIDArrogantDuremudira => MonsterImages.MonsterImageID[167], + Numbers.QuestIDArrogantDuremudiraRepel => MonsterImages.MonsterImageID[167], + Numbers.QuestIDFirstDistrictDuremudira => MonsterImages.MonsterImageID[132], + Numbers.QuestIDSecondDistrictDuremudira => MonsterImages.MonsterImageID[132], + _ => MonsterImages.MonsterImageID[132], + }; + } + /// /// Gets the monster icon. /// @@ -11268,9 +11340,9 @@ public string GetMonsterIcon(int id, bool forDiscord = false) { id = this.RoadSelectedMonster() == 0 ? this.LargeMonster1ID() : this.LargeMonster2ID(); } - else if (this.CaravanOverride()) + else if (this.AlternativeQuestOverride()) { - id = this.CaravanMonster1ID(); + id = this.AlternativeQuestMonster1ID(); } // Duremudira Arena @@ -11296,7 +11368,7 @@ public string GetMonsterIcon(int id, bool forDiscord = false) /// public string GetStarGrade(bool isLargeImageText = false) { - if ((DiscordService.ShowDiscordQuestNames() && !isLargeImageText) || this.CaravanOverride()) + if ((DiscordService.ShowDiscordQuestNames() && !isLargeImageText) || this.AlternativeQuestOverride()) { return string.Empty; } @@ -11357,6 +11429,18 @@ public bool IsDure() } } + public bool IsDure(int questID) + { + if (this.GetDureName(questID) != "None") + { + return true; + } + else + { + return false; + } + } + /// /// Determines whether [is toggeable difficulty]. /// @@ -11431,9 +11515,9 @@ public string GetRealMonsterName(bool isLargeImageText = false) { id = this.RoadSelectedMonster() == 0 ? this.LargeMonster1ID() : this.LargeMonster2ID(); } - else if (this.CaravanOverride()) + else if (this.AlternativeQuestOverride()) { - id = this.CaravanMonster1ID(); + id = this.AlternativeQuestMonster1ID(); } else { @@ -12343,6 +12427,8 @@ public void InsertQuestInfoIntoDictionaries() // TODO: the above update process should be simplified. refactoring might be needed // in many places, not just this function. var timeInt = this.TimeInt(); + var monster1ID = IsAlternativeQuestName() || IsDure() ? this.AlternativeQuestMonster1ID() : this.LargeMonster1ID(); + var monster2ID = IsAlternativeQuestName() || IsDure() ? this.AlternativeQuestMonster2ID() : this.LargeMonster2ID(); if (this.IsRoad() && this.AreaID() == 459) // Hunter's Road Base Camp { @@ -12440,7 +12526,7 @@ public void InsertQuestInfoIntoDictionaries() this.PreviousMonster1HP = this.Monster1HPInt(); Dictionary monster1HPDictionaryMonsterInfo = new () { - { this.LargeMonster1ID(), this.Monster1HPInt() }, + { monster1ID, this.Monster1HPInt() }, }; this.Monster1HPDictionary.Add(this.TimeInt(), monster1HPDictionaryMonsterInfo); } @@ -12457,7 +12543,7 @@ public void InsertQuestInfoIntoDictionaries() this.PreviousMonster2HP = this.Monster2HPInt(); Dictionary monster2HPDictionaryMonsterInfo = new () { - { this.LargeMonster2ID(), this.Monster2HPInt() }, + {monster2ID, this.Monster2HPInt() }, }; this.Monster2HPDictionary.Add(this.TimeInt(), monster2HPDictionaryMonsterInfo); } @@ -12931,7 +13017,7 @@ public void InsertQuestInfoIntoDictionaries() this.PreviousMonster1AttackMultiplier = this.Monster1AttackMultForDictionary(); Dictionary monster1AttackMultiplierDictionaryMonsterInfo = new () { - { this.LargeMonster1ID(), this.Monster1AttackMultForDictionary() }, + { monster1ID, this.Monster1AttackMultForDictionary() }, }; this.Monster1AttackMultiplierDictionary.Add(this.TimeInt(), monster1AttackMultiplierDictionaryMonsterInfo); } @@ -12948,7 +13034,7 @@ public void InsertQuestInfoIntoDictionaries() this.PreviousMonster1DefenseRate = this.Monster1DefMultForDictionary(); Dictionary monster1DefenseRateDictionaryMonsterInfo = new () { - { this.LargeMonster1ID(), this.Monster1DefMultForDictionary() }, + { monster1ID, this.Monster1DefMultForDictionary() }, }; this.Monster1DefenseRateDictionary.Add(this.TimeInt(), monster1DefenseRateDictionaryMonsterInfo); } @@ -12965,7 +13051,7 @@ public void InsertQuestInfoIntoDictionaries() this.PreviousMonster1SizeMultiplier = this.Monster1SizeMultForDictionary(); Dictionary monster1SizeMultiplierDictionaryMonsterInfo = new () { - { this.LargeMonster1ID(), this.Monster1SizeMultForDictionary() }, + { monster1ID, this.Monster1SizeMultForDictionary() }, }; this.Monster1SizeMultiplierDictionary.Add(this.TimeInt(), monster1SizeMultiplierDictionaryMonsterInfo); } @@ -12982,7 +13068,7 @@ public void InsertQuestInfoIntoDictionaries() this.PreviousMonster1PoisonThreshold = this.Monster1PoisonForDictionary(); Dictionary monster1PoisonThresholdDictionaryMonsterInfo = new () { - { this.LargeMonster1ID(), this.Monster1PoisonForDictionary() }, + { monster1ID, this.Monster1PoisonForDictionary() }, }; this.Monster1PoisonThresholdDictionary.Add(this.TimeInt(), monster1PoisonThresholdDictionaryMonsterInfo); } @@ -12999,7 +13085,7 @@ public void InsertQuestInfoIntoDictionaries() this.PreviousMonster1SleepThreshold = this.Monster1SleepForDictionary(); Dictionary monster1SleepThresholdDictionaryMonsterInfo = new () { - { this.LargeMonster1ID(), this.Monster1SleepForDictionary() }, + { monster1ID, this.Monster1SleepForDictionary() }, }; this.Monster1SleepThresholdDictionary.Add(this.TimeInt(), monster1SleepThresholdDictionaryMonsterInfo); } @@ -13016,7 +13102,7 @@ public void InsertQuestInfoIntoDictionaries() this.PreviousMonster1ParalysisThreshold = this.Monster1ParalysisForDictionary(); Dictionary monster1ParalysisThresholdDictionaryMonsterInfo = new () { - { this.LargeMonster1ID(), this.Monster1ParalysisForDictionary() }, + { monster1ID, this.Monster1ParalysisForDictionary() }, }; this.Monster1ParalysisThresholdDictionary.Add(this.TimeInt(), monster1ParalysisThresholdDictionaryMonsterInfo); } @@ -13033,7 +13119,7 @@ public void InsertQuestInfoIntoDictionaries() this.PreviousMonster1BlastThreshold = this.Monster1BlastForDictionary(); Dictionary monster1BlastThresholdDictionaryMonsterInfo = new () { - { this.LargeMonster1ID(), this.Monster1BlastForDictionary() }, + { monster1ID, this.Monster1BlastForDictionary() }, }; this.Monster1BlastThresholdDictionary.Add(this.TimeInt(), monster1BlastThresholdDictionaryMonsterInfo); } @@ -13050,7 +13136,7 @@ public void InsertQuestInfoIntoDictionaries() this.PreviousMonster1StunThreshold = this.Monster1StunForDictionary(); Dictionary monster1StunThresholdDictionaryMonsterInfo = new () { - { this.LargeMonster1ID(), this.Monster1StunForDictionary() }, + { monster1ID, this.Monster1StunForDictionary() }, }; this.Monster1StunThresholdDictionary.Add(this.TimeInt(), monster1StunThresholdDictionaryMonsterInfo); } @@ -13655,6 +13741,7 @@ public string GetMonster1EHPPercent() /// /// Gets the max faints. + /// TODO optimize /// /// public string GetMaxFaints() @@ -13670,7 +13757,7 @@ public string GetMaxFaints() case "Shiten/Conquest/Pioneer/Daily/Caravan/Interception Quests": return this.AlternativeMaxFaints().ToString(CultureInfo.InvariantCulture); case "Automatic": - if (this.RoadOverride() is not null and false) + if (this.RoadOverride() is not null and false) //TODO test { return this.MaxFaints().ToString(CultureInfo.InvariantCulture); } @@ -13678,7 +13765,7 @@ public string GetMaxFaints() if ( - (this.CaravanOverride() && !( + (this.AlternativeQuestOverride() && !( this.QuestID() == 23603 || this.RankBand() == 70 || this.QuestID() == 23602 || diff --git a/MHFZ_Overlay/Views/Windows/MainWindow.xaml.cs b/MHFZ_Overlay/Views/Windows/MainWindow.xaml.cs index ba67f1e4..9de22eec 100644 --- a/MHFZ_Overlay/Views/Windows/MainWindow.xaml.cs +++ b/MHFZ_Overlay/Views/Windows/MainWindow.xaml.cs @@ -710,7 +710,7 @@ private void CheckIfQuestChanged() if (this.DataLoader.Model.PreviousQuestID != this.DataLoader.Model.QuestID() && this.DataLoader.Model.QuestID() != 0) { this.DataLoader.Model.PreviousQuestID = this.DataLoader.Model.QuestID(); - LoggerInstance.Info(CultureInfo.InvariantCulture, $"In quest: ID {this.DataLoader.Model.PreviousQuestID} | {AddressModel.GetQuestNameFromID(this.DataLoader.Model.PreviousQuestID)}"); + LoggerInstance.Info(CultureInfo.InvariantCulture, $"In quest: ID {this.DataLoader.Model.PreviousQuestID} | {AddressModel.GetQuestName(this.DataLoader.Model.PreviousQuestID)}"); this.ShowQuestName(); } else if (this.DataLoader.Model.QuestID() == 0 && this.DataLoader.Model.PreviousQuestID != 0)