Skip to content

Commit

Permalink
feat: add more achievements
Browse files Browse the repository at this point in the history
  • Loading branch information
DorielRivalet committed Aug 7, 2023
1 parent 4d233e9 commit 0c45548
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 4 deletions.
28 changes: 27 additions & 1 deletion MHFZ_Overlay/Models/Collections/Achievements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5309,7 +5309,7 @@ that beautiful bird regains its brilliance
Description = string.Empty,
Rank = AchievementRank.Platinum,
Image = @"pack://application:,,,/MHFZ_Overlay;component/Assets/Icons/png/extreme_poison.png",
Objective = "Defeat Zenith★4 Gasurabazura solo without Poison Cure.",
Objective = "Defeat Zenith★4 Gasurabazura solo without Anti-Venom.",
IsSecret = true,
Hint = "No cures allowed! But your halk is allowed to help.",
}
Expand Down Expand Up @@ -5340,5 +5340,31 @@ that beautiful bird regains its brilliance
Hint = string.Empty,
}
},
{
408, new Achievement()
{
CompletionDate = DateTime.UnixEpoch,
Title = "Challenge Acepted",
Description = string.Empty,
Rank = AchievementRank.Silver,
Image = @"pack://application:,,,/MHFZ_Overlay;component/Assets/Icons/achievement/stamp.jpg",
Objective = "Accept a rare gacha challenge.",
IsSecret = false,
Hint = string.Empty,
}
},
{
409, new Achievement()
{
CompletionDate = DateTime.UnixEpoch,
Title = "No cheats allowed!",
Description = string.Empty,
Rank = AchievementRank.Bronze,
Image = @"pack://application:,,,/MHFZ_Overlay;component/Assets/Icons/achievement/unknown_red.jpg",
Objective = "Enter the Konami Code on the start of a quest.",
IsSecret = true,
Hint = "Sorry, but that cheat code won't give you 30 more tries on this quest.",
}
},
});
}
108 changes: 105 additions & 3 deletions MHFZ_Overlay/Services/AchievementService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2377,7 +2377,7 @@ join playerGear in databaseManagerInstance.AllPlayerGear on quest.RunID equals p
return false;
}

case 361: // TODO gacha stuff
case 361: // TODO challenges stuff
case 362:
case 363:
case 364:
Expand Down Expand Up @@ -2420,12 +2420,114 @@ join playerGear in databaseManagerInstance.AllPlayerGear on quest.RunID equals p
case 401:
case 402:
case 403:
return false;
case 404:
completedQuests = from quest in databaseManagerInstance.AllQuests
join activeSkills in databaseManagerInstance.AllActiveSkills on quest.RunID equals activeSkills.RunID
where quest.QuestID == Numbers.QuestIDLV9999CrimsonFatalis && quest.PartySize == 1 &&
!(activeSkills.ActiveSkill1ID == 193 || activeSkills.ActiveSkill1ID == 194 ||
activeSkills.ActiveSkill2ID == 193 || activeSkills.ActiveSkill2ID == 194 ||
activeSkills.ActiveSkill3ID == 193 || activeSkills.ActiveSkill3ID == 194 ||
activeSkills.ActiveSkill4ID == 193 || activeSkills.ActiveSkill4ID == 194 ||
activeSkills.ActiveSkill5ID == 193 || activeSkills.ActiveSkill5ID == 194 ||
activeSkills.ActiveSkill6ID == 193 || activeSkills.ActiveSkill6ID == 194 ||
activeSkills.ActiveSkill7ID == 193 || activeSkills.ActiveSkill7ID == 194 ||
activeSkills.ActiveSkill8ID == 193 || activeSkills.ActiveSkill8ID == 194 ||
activeSkills.ActiveSkill9ID == 193 || activeSkills.ActiveSkill9ID == 194 ||
activeSkills.ActiveSkill10ID == 193 || activeSkills.ActiveSkill10ID == 194 ||
activeSkills.ActiveSkill11ID == 193 || activeSkills.ActiveSkill11ID == 194 ||
activeSkills.ActiveSkill12ID == 193 || activeSkills.ActiveSkill12ID == 194 ||
activeSkills.ActiveSkill13ID == 193 || activeSkills.ActiveSkill13ID == 194 ||
activeSkills.ActiveSkill14ID == 193 || activeSkills.ActiveSkill14ID == 194 ||
activeSkills.ActiveSkill15ID == 193 || activeSkills.ActiveSkill15ID == 194 ||
activeSkills.ActiveSkill16ID == 193 || activeSkills.ActiveSkill16ID == 194 ||
activeSkills.ActiveSkill17ID == 193 || activeSkills.ActiveSkill17ID == 194 ||
activeSkills.ActiveSkill18ID == 193 || activeSkills.ActiveSkill18ID == 194 ||
activeSkills.ActiveSkill19ID == 193 || activeSkills.ActiveSkill19ID == 194)
select quest;
if (completedQuests != null && completedQuests.Any())
{
return true;
}
else
{
return false;
}
case 405:
completedQuests = from quest in databaseManagerInstance.AllQuests
join playerGear in databaseManagerInstance.AllPlayerGear on quest.RunID equals playerGear.RunID
where quest.QuestID == Numbers.QuestIDZ4Gasurabazura && quest.PartySize == 1 && playerGear.PlayerInventoryDictionary != null &&
!(JsonConvert.DeserializeObject<Dictionary<int, List<Dictionary<int, int>>>>(playerGear.PlayerInventoryDictionary)?.Values
.SelectMany(list => list)
.Any(innerDict => innerDict.ContainsKey(13607)) ?? false)
select quest;
if (completedQuests != null && completedQuests.Any())
{
return true;
}
else
{
return false;
}
case 406:
case 407:
{
return false;
case 407: // TODO test
completedQuests = from quest in databaseManagerInstance.AllQuests
join playerGear in databaseManagerInstance.AllPlayerGear on quest.RunID equals playerGear.RunID
where quest.QuestID == Numbers.QuestIDUpperShitenUnknown &&
quest.PartySize == 1 &&
playerGear.PlayerInventoryDictionary != null &&
(JsonConvert.DeserializeObject<Dictionary<int, List<Dictionary<int, int>>>>(playerGear.PlayerInventoryDictionary)?.Values
.SelectMany(list => list)
.All(innerDict => innerDict.ContainsKey(0)) ?? false)
select quest;
if (completedQuests != null && completedQuests.Any())
{
return true;
}
else
{
return false;
}
case 408:
return false;
case 409:
{
var keyboardCode = new List<string> { "W", "W", "S", "S", "A", "D", "A", "D", "D2", "D1", };
var gamepadCode = new List<string> { "DPadUp", "DPadUp", "DPadDown", "DPadDown", "DPadLeft", "DPadRight", "DPadLeft", "DPadRight", "B", "A", };

var foundData = from quest in databaseManagerInstance.AllQuests
where (quest.KeyStrokesDictionary != null &&
JsonConvert.DeserializeObject<Dictionary<int, string>>(quest.KeyStrokesDictionary) != null &&
quest.GamepadInputDictionary != null &&
JsonConvert.DeserializeObject<Dictionary<int, string>>(quest.GamepadInputDictionary) != null)
select quest;

if (foundData == null)
{
return false;
}

var foundCode = from quest in databaseManagerInstance.AllQuests
where (JsonConvert.DeserializeObject<Dictionary<int, string>>(quest.KeyStrokesDictionary)?.Values
.Select((keyValue) => keyValue.Trim())
.Take(keyboardCode.Count)
.SequenceEqual(keyboardCode) ?? false)
||
(JsonConvert.DeserializeObject<Dictionary<int, string>>(quest.GamepadInputDictionary)?.Values
.Select((keyValue) => keyValue.Trim())
.Take(gamepadCode.Count)
.SequenceEqual(gamepadCode) ?? false)
select quest;

if (foundCode != null && foundCode.Any())
{
return true;
}
else
{
return false;
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions MHFZ_Overlay/Views/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2096,6 +2096,7 @@ private void GlobalHookMouseUpExt(object sender, MouseEventExtArgs e)
}
}

// TODO: its finicky
private void GlobalHookKeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (this.keyImages.TryGetValue(e.KeyCode, out var image))
Expand Down

0 comments on commit 0c45548

Please sign in to comment.