diff --git a/CoCEd/ViewModel/GameVM.Core.cs b/CoCEd/ViewModel/GameVM.Core.cs index e8c0a72..b4bd7e5 100644 --- a/CoCEd/ViewModel/GameVM.Core.cs +++ b/CoCEd/ViewModel/GameVM.Core.cs @@ -225,17 +225,17 @@ public void OnKeyItemAddedOrRemoved(string name, bool isOwned) } } - //Not sure how I can make the code better as I can't apply the same trick to chest without complicating the code further. void UpdateInventory() { _inventory.Clear(); - int count = IsRevamp ? 10 : 5; // max inventory slots are 5 in CoC and 10 in CoC-Revamp-Mod - if (GetObj("itemSlots") != null) //For serialized saves. + AmfObject itemSlots = IsRevamp ? GetObj("itemSlots") : null; + if (itemSlots != null) // for CoC-Revamp-Mod ≥v1.4.15 { - foreach (var pair in GetObj("itemSlots")) _inventory.Add(pair.ValueAsObject); + foreach (var pair in itemSlots) _inventory.Add(pair.ValueAsObject); } - else //For legacy item slots used in Vanilla and Revamp 1.4.15-pre. + else // for CoC and CoC-Revamp-Mod