Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conflict with EquipmentAndQuickSlots mod #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions SimpleSort/BepInExPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,19 @@ private static void SortByType(SortType type, Inventory inventory, bool asc, boo
{
int amount = Mathf.Min(items[i].m_shared.m_maxStackSize - items[i].m_stack, items[i + 1].m_stack);
items[i].m_stack += amount;
if (amount == items[i + 1].m_stack)
{
items.RemoveAt(i + 1);
}
else
if (amount == items[i + 1].m_stack) {
items[i + 1].m_stack -= amount;
items.RemoveAt(i+1);

// Dummy call, only using it to remove all items from inventory where stack size <= 0
// This needs to be done because the reference to the original items list gets broken somehow when using EquipmentAndQuickSlots mod
Traverse.Create(inventory).Method("RemoveItem", new object[]{"", 0}).GetValue();
} else {
items[i + 1].m_stack -= amount;
}
}
}

switch (type)
{
case SortType.Name:
Expand Down