Skip to content

Commit

Permalink
fix: Fixes crafting items with IHasQuality attribute (#1738)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamronbatman committed Apr 24, 2024
1 parent 7a160bb commit 98d31bc
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions Projects/UOContent/Engines/Craft/Core/CraftItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ public int GetQuantity(Container cont, Type[] types)
{
amount += item.Amount;
}
else if ((hq as BaseBeverage)?.Content == RequiredBeverage)
else if (hq is not BaseBeverage bev || bev.Content == RequiredBeverage)
{
amount += hq.Quantity;
}
Expand All @@ -561,8 +561,7 @@ public int GetQuantity(Container cont, Type[] types)
public bool ConsumeRes(
Mobile from, Type typeRes, CraftSystem craftSystem, ref int resHue, ref int maxAmount,
ConsumeType consumeType, ref TextDefinition message
) =>
ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, false);
) => ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, false);

public bool ConsumeRes(
Mobile from, Type typeRes, CraftSystem craftSystem, ref int resHue, ref int maxAmount,
Expand Down Expand Up @@ -630,7 +629,7 @@ public int GetQuantity(Container cont, Type[] types)
}
}

types[i] ??= new[] { baseType };
types[i] ??= [baseType];
amounts[i] = craftRes.Amount;

// For stackable items that can be crafted more than one at a time
Expand Down Expand Up @@ -733,12 +732,7 @@ public int GetQuantity(Container cont, Type[] types)
{
for (var i = 0; i < amounts.Length; i++)
{
amounts[i] /= 2;

if (amounts[i] < 1)
{
amounts[i] = 1;
}
amounts[i] = Math.Max(1, amounts[i] / 2);
}
}

Expand Down

0 comments on commit 98d31bc

Please sign in to comment.