diff --git a/Loki/Item.cs b/Loki/Item.cs index a58c96e..62af7ae 100644 --- a/Loki/Item.cs +++ b/Loki/Item.cs @@ -44,7 +44,7 @@ public float Durability public int Quality { get; } public int Variant { get; } public long CrafterId { get; } - public string CrafterName { get; } + public string CrafterName { get; set; } public bool HasCrafterTag => CrafterId != 0; diff --git a/Loki/MainWindow.xaml.cs b/Loki/MainWindow.xaml.cs index 1fbf54f..8ac7ff9 100644 --- a/Loki/MainWindow.xaml.cs +++ b/Loki/MainWindow.xaml.cs @@ -102,6 +102,7 @@ public async void LoadProfile(CharacterFile character) try { Profile = await Task.Run(() => PlayerProfile.Read(File.OpenRead(character.FilePath))); + character.PlayerName = Profile.PlayerName; } catch (Exception ex) { @@ -127,6 +128,16 @@ public async void SaveProfile(CharacterFile character) await Task.Run(() => { + + // Re-Tag any items with new character name if needed. + foreach (var slot in profile.Player.Inventory.Slots) + { + if (slot.Item != null && slot.Item.CrafterId == profile.PlayerId) + { + slot.Item.CrafterName = profile.PlayerName; + } + } + if (makeBackup) Backup.BackupCharacter(character);