From 75eee0cd52be72ad1a3587e4c077d795dba90249 Mon Sep 17 00:00:00 2001 From: Jamiras Date: Thu, 23 Apr 2026 15:34:40 -0600 Subject: [PATCH] core/unofficial -> promoted/unpromoted --- Source/Data/Achievement.cs | 6 +- Source/Data/AssetBase.cs | 4 +- Source/Parser/PublishedAssets.cs | 1 + .../ViewModels/AchievementsListViewModel.cs | 16 ++--- Source/ViewModels/AssetSourceViewModel.cs | 4 +- Source/ViewModels/AssetViewModelBase.cs | 50 ++++++++-------- .../ViewModels/ConditionsAnalyzerViewModel.cs | 28 ++++----- Source/ViewModels/GameBadgesViewModel.cs | 2 +- Source/ViewModels/GameViewModel.cs | 60 +++++++++---------- Source/ViewModels/NewScriptDialogViewModel.cs | 24 ++++---- Source/ViewModels/ViewerViewModelBase.cs | 2 +- Source/Views/AssetViewer.xaml | 4 +- Source/Views/ConditionsAnalyzerDialog.xaml | 6 +- Source/Views/GameViewer.xaml | 16 ++--- Source/Views/NewScriptDialog.xaml | 2 +- Tests/ViewModels/AssetViewModelBaseTests.cs | 48 +++++++-------- Tests/ViewModels/GameViewModelTests.cs | 24 ++++---- 17 files changed, 149 insertions(+), 148 deletions(-) diff --git a/Source/Data/Achievement.cs b/Source/Data/Achievement.cs index 6623ae36..6456b6af 100644 --- a/Source/Data/Achievement.cs +++ b/Source/Data/Achievement.cs @@ -37,14 +37,14 @@ public Achievement() public Trigger Trigger { get; internal set; } /// - /// Gets the achievement category (3=Core, 5=Unofficial). + /// Gets the achievement category (3=Promoted, 5=Unpromoted). /// public int Category { get; internal set; } /// - /// Gets whether or not the achievement is Unofficial. + /// Gets whether or not the achievement is Unpromoted. /// - public override bool IsUnofficial + public override bool IsUnpromoted { get { return Category == 5; } } diff --git a/Source/Data/AssetBase.cs b/Source/Data/AssetBase.cs index 08a3e222..c13d4a7f 100644 --- a/Source/Data/AssetBase.cs +++ b/Source/Data/AssetBase.cs @@ -35,9 +35,9 @@ public class AssetBase public DateTime LastModified { get; set; } /// - /// Gets whether or not the asset has been published but not promoted to Core. + /// Gets whether or not the asset has been published but not promoted. /// - public virtual bool IsUnofficial + public virtual bool IsUnpromoted { get { return false; } } diff --git a/Source/Parser/PublishedAssets.cs b/Source/Parser/PublishedAssets.cs index 3229f363..6fda3278 100644 --- a/Source/Parser/PublishedAssets.cs +++ b/Source/Parser/PublishedAssets.cs @@ -164,6 +164,7 @@ private static AchievementSetType ConvertType(string type) { case "core": return AchievementSetType.Core; case "bonus": return AchievementSetType.Bonus; + case "challenge": return AchievementSetType.Challenge; case "specialty": return AchievementSetType.Specialty; case "exclusive": return AchievementSetType.Exclusive; default: return AchievementSetType.None; diff --git a/Source/ViewModels/AchievementsListViewModel.cs b/Source/ViewModels/AchievementsListViewModel.cs index 6a30675a..fbf9bdd7 100644 --- a/Source/ViewModels/AchievementsListViewModel.cs +++ b/Source/ViewModels/AchievementsListViewModel.cs @@ -56,18 +56,18 @@ private void CountAchievements(AchievementViewModel[] achievements) var initialPointsLength = points.Length; points.Append(" ("); - var published = achievements.Where(a => !a.Published?.Asset?.IsUnofficial ?? false); - if (published.Any()) + var promoted = achievements.Where(a => !a.Published?.Asset?.IsUnpromoted ?? false); + if (promoted.Any()) { - description.AppendFormat("{0} published, ", published.Count()); - points.AppendFormat("{0} published, ", published.Sum(a => a.Points)); + description.AppendFormat("{0} promoted, ", promoted.Count()); + points.AppendFormat("{0} promoted, ", promoted.Sum(a => a.Points)); } - var unpublished = achievements.Where(a => a.Published?.Asset?.IsUnofficial ?? false); - if (unpublished.Any()) + var unpromoted = achievements.Where(a => a.Published?.Asset?.IsUnpromoted ?? false); + if (unpromoted.Any()) { - description.AppendFormat("{0} unpublished, ", unpublished.Count()); - points.AppendFormat("{0} unpublished, ", unpublished.Sum(a => a.Points)); + description.AppendFormat("{0} unpromoted, ", unpromoted.Count()); + points.AppendFormat("{0} unpromoted, ", unpromoted.Sum(a => a.Points)); } var local = achievements.Where(a => a.Published?.Asset == null); diff --git a/Source/ViewModels/AssetSourceViewModel.cs b/Source/ViewModels/AssetSourceViewModel.cs index 725d9d33..d3b61212 100644 --- a/Source/ViewModels/AssetSourceViewModel.cs +++ b/Source/ViewModels/AssetSourceViewModel.cs @@ -26,10 +26,10 @@ public AssetSourceViewModel(AssetViewModelBase owner, string source) protected readonly AssetViewModelBase _owner; - internal AssetBase Asset + public AssetBase Asset { get { return _asset; } - set + internal set { bool hadAsset = _asset != null; if (hadAsset && value == null) diff --git a/Source/ViewModels/AssetViewModelBase.cs b/Source/ViewModels/AssetViewModelBase.cs index 115eb65d..30948a08 100644 --- a/Source/ViewModels/AssetViewModelBase.cs +++ b/Source/ViewModels/AssetViewModelBase.cs @@ -178,7 +178,7 @@ public bool IsPointsModified private void UpdateModified() { - var coreAsset = Published.Asset; + var publishedAsset = Published.Asset; if (!IsGenerated) { @@ -191,13 +191,13 @@ private void UpdateModified() CompareState = GeneratedCompareState.None; ModificationMessage = "Not generated"; - if (coreAsset != null) + if (publishedAsset != null) { Triggers = Published.TriggerList; - if (coreAsset.IsUnofficial) - TriggerSource = "Unpublished (Not Generated)"; + if (publishedAsset.IsUnpromoted) + TriggerSource = "Unpromoted (Not Generated)"; else - TriggerSource = "Core (Not Generated)"; + TriggerSource = "Promoted (Not Generated)"; } else if (Local.Asset != null) { @@ -210,17 +210,17 @@ private void UpdateModified() { TriggerSource = "Generated"; - if (coreAsset != null) + if (publishedAsset != null) { bool differsFromPublished = !IsModified(Published, false); UpdateModifiedProperties(Local); // reset title/description modified properties if (differsFromPublished) { - if (coreAsset.IsUnofficial) - TriggerSource = "Generated (Same as Unpublished)"; + if (publishedAsset.IsUnpromoted) + TriggerSource = "Generated (Same as Unpromoted)"; else - TriggerSource = "Generated (Same as Core)"; + TriggerSource = "Generated (Same as Promoted)"; } } @@ -229,7 +229,7 @@ private void UpdateModified() CompareState = GeneratedCompareState.LocalDiffers; CanUpdate = true; } - else if (coreAsset != null && IsModified(Published, true)) + else if (publishedAsset != null && IsModified(Published, true)) { if (Local.Asset != null) { @@ -242,10 +242,10 @@ private void UpdateModified() CanUpdate = true; } - if (coreAsset.IsUnofficial) - ModificationMessage = "Unpublished differs from generated"; + if (publishedAsset.IsUnpromoted) + ModificationMessage = "Unpromoted differs from generated"; else - ModificationMessage = "Core differs from generated"; + ModificationMessage = "Promoted differs from generated"; Other = Published; CompareState = (Local.Asset != null) ? GeneratedCompareState.PublishedDiffers : GeneratedCompareState.LocalDiffers; @@ -254,7 +254,7 @@ private void UpdateModified() { if (Local.Asset == null && IsGenerated) { - if (coreAsset == null) + if (publishedAsset == null) { TriggerSource = "Generated (Not in Local)"; ModificationMessage = "Local " + ViewerType + " does not exist"; @@ -262,10 +262,10 @@ private void UpdateModified() } else { - if (coreAsset.IsUnofficial) - TriggerSource = "Generated (Same as Unpublished, not in Local)"; + if (publishedAsset.IsUnpromoted) + TriggerSource = "Generated (Same as Unpromoted, not in Local)"; else - TriggerSource = "Generated (Same as Core, not in Local)"; + TriggerSource = "Generated (Same as Promoted, not in Local)"; ModificationMessage = null; CompareState = GeneratedCompareState.Same; @@ -276,12 +276,12 @@ private void UpdateModified() } else { - if (coreAsset == null) + if (publishedAsset == null) TriggerSource = "Generated (Same as Local)"; - else if (coreAsset.IsUnofficial) - TriggerSource = "Generated (Same as Unpublished and Local)"; + else if (publishedAsset.IsUnpromoted) + TriggerSource = "Generated (Same as Unpromoted and Local)"; else - TriggerSource = "Generated (Same as Core and Local)"; + TriggerSource = "Generated (Same as Promoted and Local)"; ModificationMessage = null; CompareState = GeneratedCompareState.Same; @@ -457,10 +457,10 @@ public override void Refresh() { var generatedAsset = Generated.Asset; var localAsset = Local.Asset; - var coreAsset = Published.Asset; + var publishedAsset = Published.Asset; - Published.Source = (coreAsset == null) ? "Published" : - coreAsset.IsUnofficial ? "Published (Unofficial)" : "Published (Core)"; + Published.Source = (publishedAsset == null) ? "Published" : + publishedAsset.IsUnpromoted ? "Published (Unpromoted)" : "Published (Promoted)"; if (generatedAsset != null) { @@ -469,7 +469,7 @@ public override void Refresh() else { ClearBindings(); - if (coreAsset != null) + if (publishedAsset != null) LoadViewModel(Published); else if (localAsset != null) LoadViewModel(Local); diff --git a/Source/ViewModels/ConditionsAnalyzerViewModel.cs b/Source/ViewModels/ConditionsAnalyzerViewModel.cs index aa85d3a7..3db936fe 100644 --- a/Source/ViewModels/ConditionsAnalyzerViewModel.cs +++ b/Source/ViewModels/ConditionsAnalyzerViewModel.cs @@ -124,7 +124,7 @@ public class Result public int AchievementId { get; internal set; } public int LeaderboardId { get; internal set; } public string Details { get; internal set; } - public bool IsUnofficial { get; internal set; } + public bool IsUnpromoted { get; internal set; } } public ObservableCollection Results { get; private set; } @@ -245,18 +245,18 @@ private void OnDialogResultPropertyChanged(object sender, ModelPropertyChangedEv Progress.IsEnabled = false; } - public static readonly ModelProperty IsCoreAchievementsScannedProperty = ModelProperty.Register(typeof(ConditionsAnalyzerViewModel), "IsAchievementsScanned", typeof(bool), true); - public bool IsCoreAchievementsScanned + public static readonly ModelProperty IsPromotedAchievementsScannedProperty = ModelProperty.Register(typeof(ConditionsAnalyzerViewModel), "IsPromotedAchievementsScanned", typeof(bool), true); + public bool IsPromotedAchievementsScanned { - get { return (bool)GetValue(IsCoreAchievementsScannedProperty); } - set { SetValue(IsCoreAchievementsScannedProperty, value); } + get { return (bool)GetValue(IsPromotedAchievementsScannedProperty); } + set { SetValue(IsPromotedAchievementsScannedProperty, value); } } - public static readonly ModelProperty IsNonCoreAchievementsScannedProperty = ModelProperty.Register(typeof(ConditionsAnalyzerViewModel), "IsAchievementsScanned", typeof(bool), true); - public bool IsNonCoreAchievementsScanned + public static readonly ModelProperty IsUnpromotedAchievementsScannedProperty = ModelProperty.Register(typeof(ConditionsAnalyzerViewModel), "IsUnpromotedAchievementsScanned", typeof(bool), true); + public bool IsUnpromotedAchievementsScanned { - get { return (bool)GetValue(IsNonCoreAchievementsScannedProperty); } - set { SetValue(IsNonCoreAchievementsScannedProperty, value); } + get { return (bool)GetValue(IsUnpromotedAchievementsScannedProperty); } + set { SetValue(IsUnpromotedAchievementsScannedProperty, value); } } public static readonly ModelProperty IsLeaderboardStartScannedProperty = ModelProperty.Register(typeof(ConditionsAnalyzerViewModel), "IsLeaderboardStartScanned", typeof(bool), true); @@ -329,7 +329,7 @@ private void DoSearch() var directory = _settings.DumpDirectory; var filesToRead = 0; - if (IsCoreAchievementsScanned || IsNonCoreAchievementsScanned) + if (IsPromotedAchievementsScanned || IsUnpromotedAchievementsScanned) filesToRead += Snapshot.AchievementGameCount; if (IsLeaderboardCancelScanned || IsLeaderboardStartScanned || IsLeaderboardSubmitScanned) filesToRead += Snapshot.LeaderboardGameCount; @@ -341,7 +341,7 @@ private void DoSearch() var results = new List(); - if (IsCoreAchievementsScanned || IsNonCoreAchievementsScanned) + if (IsPromotedAchievementsScanned || IsUnpromotedAchievementsScanned) { Progress.Label = "Processing Achievements..."; @@ -365,12 +365,12 @@ private void DoSearch() foreach (var achievement in achievements) { var flags = achievement.GetField("Flags").IntegerValue; - if (!IsCoreAchievementsScanned) + if (!IsPromotedAchievementsScanned) { if (flags == 3) continue; } - else if (!IsNonCoreAchievementsScanned) + else if (!IsUnpromotedAchievementsScanned) { if (flags != 3) continue; @@ -386,7 +386,7 @@ private void DoSearch() AchievementId = achievement.GetField("ID").IntegerValue.GetValueOrDefault(), ItemName = achievement.GetField("Title").StringValue, Details = memAddr, - IsUnofficial = flags == 5 + IsUnpromoted = flags == 5 }); } } diff --git a/Source/ViewModels/GameBadgesViewModel.cs b/Source/ViewModels/GameBadgesViewModel.cs index 578627b9..fa0248d4 100644 --- a/Source/ViewModels/GameBadgesViewModel.cs +++ b/Source/ViewModels/GameBadgesViewModel.cs @@ -99,7 +99,7 @@ private bool LoadGameFromCache() var badgeDirectory = Path.Combine(directory, "RACache", "Badge"); foreach (var achievement in publishedAssets.Achievements) { - if (achievement.IsUnofficial) + if (achievement.IsUnpromoted) continue; var path = Path.Combine(badgeDirectory, achievement.BadgeName); diff --git a/Source/ViewModels/GameViewModel.cs b/Source/ViewModels/GameViewModel.cs index d8dba841..a7f9da30 100644 --- a/Source/ViewModels/GameViewModel.cs +++ b/Source/ViewModels/GameViewModel.cs @@ -596,32 +596,32 @@ public int GeneratedAchievementCount private set { SetValue(GeneratedAchievementCountProperty, value); } } - public static readonly ModelProperty CoreAchievementCountProperty = ModelProperty.Register(typeof(GameViewModel), "CoreAchievementCount", typeof(int), 0); - public int CoreAchievementCount + public static readonly ModelProperty PromotedAchievementCountProperty = ModelProperty.Register(typeof(GameViewModel), "PromotedAchievementCount", typeof(int), 0); + public int PromotedAchievementCount { - get { return (int)GetValue(CoreAchievementCountProperty); } - private set { SetValue(CoreAchievementCountProperty, value); } + get { return (int)GetValue(PromotedAchievementCountProperty); } + private set { SetValue(PromotedAchievementCountProperty, value); } } - public static readonly ModelProperty CoreAchievementPointsProperty = ModelProperty.Register(typeof(GameViewModel), "CoreAchievementPoints", typeof(int), 0); - public int CoreAchievementPoints + public static readonly ModelProperty PromotedAchievementPointsProperty = ModelProperty.Register(typeof(GameViewModel), "PromotedAchievementPoints", typeof(int), 0); + public int PromotedAchievementPoints { - get { return (int)GetValue(CoreAchievementPointsProperty); } - private set { SetValue(CoreAchievementPointsProperty, value); } + get { return (int)GetValue(PromotedAchievementPointsProperty); } + private set { SetValue(PromotedAchievementPointsProperty, value); } } - public static readonly ModelProperty UnofficialAchievementCountProperty = ModelProperty.Register(typeof(GameViewModel), "UnofficialAchievementCount", typeof(int), 0); - public int UnofficialAchievementCount + public static readonly ModelProperty UnpromotedAchievementCountProperty = ModelProperty.Register(typeof(GameViewModel), "UnpromotedAchievementCount", typeof(int), 0); + public int UnpromotedAchievementCount { - get { return (int)GetValue(UnofficialAchievementCountProperty); } - private set { SetValue(UnofficialAchievementCountProperty, value); } + get { return (int)GetValue(UnpromotedAchievementCountProperty); } + private set { SetValue(UnpromotedAchievementCountProperty, value); } } - public static readonly ModelProperty UnofficialAchievementPointsProperty = ModelProperty.Register(typeof(GameViewModel), "UnofficialAchievementPoints", typeof(int), 0); - public int UnofficialAchievementPoints + public static readonly ModelProperty UnpromotedAchievementPointsProperty = ModelProperty.Register(typeof(GameViewModel), "UnpromotedAchievementPoints", typeof(int), 0); + public int UnpromotedAchievementPoints { - get { return (int)GetValue(UnofficialAchievementPointsProperty); } - private set { SetValue(UnofficialAchievementPointsProperty, value); } + get { return (int)GetValue(UnpromotedAchievementPointsProperty); } + private set { SetValue(UnpromotedAchievementPointsProperty, value); } } public static readonly ModelProperty LocalAchievementCountProperty = ModelProperty.Register(typeof(GameViewModel), "LocalAchievementCount", typeof(int), 0); @@ -663,34 +663,34 @@ private void ReadPublished() var fileName = Path.Combine(RACacheDirectory, GameId + ".json"); var publishedAssets = new PublishedAssets(fileName, _fileSystemService); - var coreCount = 0; - var corePoints = 0; - var unofficialCount = 0; - var unofficialPoints = 0; + var promotedCount = 0; + var promotedPoints = 0; + var unpromotedCount = 0; + var unpromotedPoints = 0; foreach (var achievement in publishedAssets.Achievements) { if (achievement.Category == 3) { - coreCount++; - corePoints += achievement.Points; + promotedCount++; + promotedPoints += achievement.Points; } else { - unofficialCount++; - unofficialPoints += achievement.Points; + unpromotedCount++; + unpromotedPoints += achievement.Points; } } - CoreAchievementCount = coreCount; - CoreAchievementPoints = corePoints; - UnofficialAchievementCount = unofficialCount; - UnofficialAchievementPoints = unofficialPoints; + PromotedAchievementCount = promotedCount; + PromotedAchievementPoints = promotedPoints; + UnpromotedAchievementCount = unpromotedCount; + UnpromotedAchievementPoints = unpromotedPoints; Title = publishedAssets.Title; ConsoleId = publishedAssets.ConsoleId; - _logger.WriteVerbose(String.Format("Identified {0} core achievements ({1} points)", coreCount, corePoints)); - _logger.WriteVerbose(String.Format("Identified {0} unofficial achievements ({1} points)", unofficialCount, unofficialPoints)); + _logger.WriteVerbose(String.Format("Identified {0} promoted achievements ({1} points)", promotedCount, promotedPoints)); + _logger.WriteVerbose(String.Format("Identified {0} unpromoted achievements ({1} points)", unpromotedCount, unpromotedPoints)); publishedAssets.LoadNotes(); Notes = publishedAssets.Notes; diff --git a/Source/ViewModels/NewScriptDialogViewModel.cs b/Source/ViewModels/NewScriptDialogViewModel.cs index b83b3b49..e7764828 100644 --- a/Source/ViewModels/NewScriptDialogViewModel.cs +++ b/Source/ViewModels/NewScriptDialogViewModel.cs @@ -156,7 +156,7 @@ private void LoadGame(int gameId, string raCacheDirectory) private void LoadAchievements() { - var unofficialAchievements = new List(); + var unpromotedAchievements = new List(); foreach (var publishedAchievement in _publishedAssets.Achievements) { var dumpAchievement = new DumpAsset(publishedAchievement.Id, publishedAchievement.Title) @@ -166,11 +166,11 @@ private void LoadAchievements() ViewerType = "Achievement", }; - if (publishedAchievement.IsUnofficial) + if (publishedAchievement.IsUnpromoted) { - dumpAchievement.IsUnofficial = true; - dumpAchievement.ViewerType = "Unofficial Achievement"; - unofficialAchievements.Add(dumpAchievement); + dumpAchievement.IsUnpromoted = true; + dumpAchievement.ViewerType = "Unpromoted Achievement"; + unpromotedAchievements.Add(dumpAchievement); } else { @@ -181,15 +181,15 @@ private void LoadAchievements() dumpAchievement.PropertyChanged += DumpAsset_PropertyChanged; } - foreach (var unofficialAchievement in unofficialAchievements) - _assets.Add(unofficialAchievement); + foreach (var unpromotedAchievement in unpromotedAchievements) + _assets.Add(unpromotedAchievement); foreach (var localAchievement in _localAssets.Achievements) { var dumpAchievement = _assets.FirstOrDefault(a => a.Id == localAchievement.Id && a.Type == DumpAssetType.Achievement); if (dumpAchievement != null) { - dumpAchievement.IsUnofficial = true; + dumpAchievement.IsUnpromoted = true; dumpAchievement.ViewerType = "Local Achievement"; } else @@ -199,7 +199,7 @@ private void LoadAchievements() Type = DumpAssetType.Achievement, ViewerImage = "/RATools;component/Resources/achievement.png", ViewerType = "Local Achievement", - IsUnofficial = true + IsUnpromoted = true }; dumpAchievement.PropertyChanged += DumpAsset_PropertyChanged; @@ -230,7 +230,7 @@ private void LoadLeaderboards() var dumpLeaderboard = _assets.FirstOrDefault(a => a.Id == localLeaderboard.Id && a.Type == DumpAssetType.Leaderboard); if (dumpLeaderboard != null) { - dumpLeaderboard.IsUnofficial = true; + dumpLeaderboard.IsUnpromoted = true; dumpLeaderboard.ViewerType = "Local Leaderboard"; } else @@ -240,7 +240,7 @@ private void LoadLeaderboards() Type = DumpAssetType.Achievement, ViewerImage = "/RATools;component/Resources/leaderboard.png", ViewerType = "Local Leaderboard", - IsUnofficial = true + IsUnpromoted = true }; dumpLeaderboard.PropertyChanged += DumpAsset_PropertyChanged; @@ -479,7 +479,7 @@ public DumpAsset(int id, string label) MemoryAddresses = new List(); } - public bool IsUnofficial { get; set; } + public bool IsUnpromoted { get; set; } public DumpAssetType Type { get; set; } diff --git a/Source/ViewModels/ViewerViewModelBase.cs b/Source/ViewModels/ViewerViewModelBase.cs index a868855b..02621763 100644 --- a/Source/ViewModels/ViewerViewModelBase.cs +++ b/Source/ViewModels/ViewerViewModelBase.cs @@ -99,7 +99,7 @@ public enum GeneratedCompareState None = 0, /// - /// published by not generated or generated matches core and/or local. no icon + /// published but not generated or generated matches published and/or local. no icon /// Same, diff --git a/Source/Views/AssetViewer.xaml b/Source/Views/AssetViewer.xaml index 0bfc14ee..21dd2d52 100644 --- a/Source/Views/AssetViewer.xaml +++ b/Source/Views/AssetViewer.xaml @@ -96,10 +96,10 @@ - + - + diff --git a/Source/Views/ConditionsAnalyzerDialog.xaml b/Source/Views/ConditionsAnalyzerDialog.xaml index 06d60272..ace7471b 100644 --- a/Source/Views/ConditionsAnalyzerDialog.xaml +++ b/Source/Views/ConditionsAnalyzerDialog.xaml @@ -89,8 +89,8 @@ - - + + @@ -146,7 +146,7 @@ - - + + - + - - + + - + diff --git a/Source/Views/NewScriptDialog.xaml b/Source/Views/NewScriptDialog.xaml index 093139de..b2d1b1b4 100644 --- a/Source/Views/NewScriptDialog.xaml +++ b/Source/Views/NewScriptDialog.xaml @@ -68,7 +68,7 @@