Skip to content

Commit

Permalink
Fix inventory save routine to ini file so that it doesn't persist old…
Browse files Browse the repository at this point in the history
… slot data for a character
  • Loading branch information
ethanmoffat committed Mar 29, 2022
1 parent 1d70706 commit 2ba0c86
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions EndlessClient/HUD/Panels/InventoryPanel.cs
Expand Up @@ -305,14 +305,16 @@ private void SaveInventoryFile(object sender, EventArgs e)
? inventory.Sections[_playerInfoProvider.LoggedInAccountName]
: new SortedList<string, string>();

var existing = section.Where(x => x.Key.Contains(_characterProvider.MainCharacter.Name)).Select(x => x.Key).ToList();
foreach (var key in existing)
section.Remove(key);

foreach (var item in _childItems)
section[$"{_characterProvider.MainCharacter.Name}.{item.Slot}"] = $"{item.InventoryItem.ItemID}";

inventory.Sections[_playerInfoProvider.LoggedInAccountName] = section;

inventory.Save();

base.UnloadContent();
}

private void HandleItemDoubleClick(object sender, EIFRecord itemData)
Expand Down

0 comments on commit 2ba0c86

Please sign in to comment.