Skip to content

Commit

Permalink
add support for stack-increasing mods
Browse files Browse the repository at this point in the history
  • Loading branch information
codengine committed Mar 28, 2024
1 parent 42d287d commit 85c7be0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Changelog

## v0.12.5

### Features

- Added support for mods that increase the maximum inventory size (closes #23)

## v0.12.4

### Features

- Add Item/Structure/Construction plater tool (Menu -> Tools)
- Added Item/Structure/Construction plater tool (Menu -> Tools)

### Bugfixes

Expand Down
6 changes: 3 additions & 3 deletions SOTFEdit/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// app, or any theme specific resource dictionaries)
)]
[assembly: AssemblyCompany("codengine")]
[assembly: AssemblyFileVersion("0.12.4")]
[assembly: AssemblyInformationalVersion("0.12.4")]
[assembly: AssemblyFileVersion("0.12.5")]
[assembly: AssemblyInformationalVersion("0.12.5")]
[assembly: AssemblyProduct("SOTFEdit")]
[assembly: AssemblyTitle("SOTFEdit")]
[assembly: AssemblyVersion("0.12.4")]
[assembly: AssemblyVersion("0.12.5")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[assembly: Guid("d59ec208-5fc6-4336-a9db-dbeb36938f78")]
12 changes: 9 additions & 3 deletions SOTFEdit/Model/Item.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Windows.Media.Imaging;
using SOTFEdit.Infrastructure;
using SOTFEdit.Model.SaveData.Storage.Module;
using SOTFEdit.Model.Storage;

namespace SOTFEdit.Model;

public class Item
public class Item : ICloneable
{
private string? _normalizedLowercaseName;
private string? _normalizedLowercaseType;
Expand All @@ -20,7 +21,7 @@ public class Item
public bool IsWearableCloth { get; init; } = false;
public bool IsPlatable { get; init; } = false;
public DefaultMinMax? Durability { get; init; }
public StorageMax? StorageMax { get; init; }
public StorageMax? StorageMax { get; set; }
public HashSet<int>? ModHashes { get; init; }
public string? Image { get; init; }
public string? Wiki { get; init; }
Expand All @@ -39,6 +40,11 @@ private string NormalizedLowercaseType
get { return _normalizedLowercaseType ??= TranslationHelper.Normalize(Type).ToLower(); }
}

public object Clone()
{
return MemberwiseClone();
}

private BitmapImage? GetThumbImage()
{
return GetThumbPath()?.LoadAppLocalImage();
Expand Down
3 changes: 3 additions & 0 deletions SOTFEdit/ViewModel/InventoryPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ private void OnSelectedSavegameChanged(SelectedSavegameChangedEvent m)
var item = _itemList.GetItem(itemBlock.ItemId);
if (item?.StorageMax?.Inventory is { } maxInInventory && maxInInventory < itemBlock.TotalCount)
{
item = (Item)item.Clone();
item.StorageMax = new StorageMax(itemBlock.TotalCount, item.StorageMax?.Shelf ?? 0,
item.StorageMax?.Holder);
Logger.Info(
$"Defined max in inventory for {item.Id} is lower ({maxInInventory}) than in savedata ({itemBlock.TotalCount})");
}
Expand Down

0 comments on commit 85c7be0

Please sign in to comment.