Skip to content

Commit

Permalink
Merge pull request #32 from DeadStarlin/master
Browse files Browse the repository at this point in the history
Update AchievementHandler.cs according to data Gibbed collected
  • Loading branch information
Rudokhvist authored Sep 16, 2024
2 parents ec5d53e + 78138e4 commit 5d0debf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ASFAchievementManager/AchievementHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ internal SetAchievementsCallback(JobID jobID, CMsgClientStoreUserStatsResponse m
uint? stat_value = response?.stats?.Find(statElement => statElement.stat_id == statNum)?.stat_value;
bool isSet = stat_value != null && (stat_value & ((uint) 1 << bitNum)) != 0;

bool restricted = achievement.Children.Find(child => child.Name == "permission") != null;
bool restricted = achievement.Children.Find(child => child.Name == "permission" && child.Value != null) != null;

string? dependancyName = (achievement.Children.Find(child => child.Name == "progress") == null) ? "" : achievement.Children.Find(child => child.Name == "progress")?.Children?.Find(child => child.Name == "value")?.Children?.Find(child => child.Name == "operand1")?.Value;

Expand Down Expand Up @@ -146,7 +146,7 @@ internal SetAchievementsCallback(JobID jobID, CMsgClientStoreUserStatsResponse m
foreach (KeyValue stat in keyValues.Children.Find(child => child.Name == "stats")?.Children ?? []) {
if (stat.Children.Find(child => child.Name == "type")?.Value == "1") {
if (uint.TryParse(stat.Name, out uint statNum)) {
bool restricted = stat.Children.Find(child => child.Name == "permission") != null;
bool restricted = int.TryParse(stat.Children.Find(child => child.Name == "permission")?.Value, out int value) && value > 1;
string? name = stat.Children.Find(child => child.Name == "name")?.Value;
if (name != null) {
StatData? parentStat = result.Find(item => item.DependancyName == name);
Expand Down

0 comments on commit 5d0debf

Please sign in to comment.