fix: Fixes crafting items with IHasQuality attribute (#1738)

This commit is contained in:
Kamron Batman 2024-04-23 23:33:29 -07:00 • committed by GitHub
parent 7a160bb0fd
commit 98d31bc707
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -549,7 +549,7 @@ namespace Server.Engines.Craft
{ {
amount += item.Amount; amount += item.Amount;
} }
else if ((hq as BaseBeverage)?.Content == RequiredBeverage) else if (hq is not BaseBeverage bev || bev.Content == RequiredBeverage)
{ {
amount += hq.Quantity; amount += hq.Quantity;
} }
@ -561,8 +561,7 @@ namespace Server.Engines.Craft
public bool ConsumeRes( public bool ConsumeRes(
Mobile from, Type typeRes, CraftSystem craftSystem, ref int resHue, ref int maxAmount, Mobile from, Type typeRes, CraftSystem craftSystem, ref int resHue, ref int maxAmount,
ConsumeType consumeType, ref TextDefinition message 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( public bool ConsumeRes(
Mobile from, Type typeRes, CraftSystem craftSystem, ref int resHue, ref int maxAmount, Mobile from, Type typeRes, CraftSystem craftSystem, ref int resHue, ref int maxAmount,
@ -630,7 +629,7 @@ namespace Server.Engines.Craft
} }
} }
types[i] ??= new[] { baseType }; types[i] ??= [baseType];
amounts[i] = craftRes.Amount; amounts[i] = craftRes.Amount;
// For stackable items that can be crafted more than one at a time // For stackable items that can be crafted more than one at a time
@ -733,12 +732,7 @@ namespace Server.Engines.Craft
{ {
for (var i = 0; i < amounts.Length; i++) for (var i = 0; i < amounts.Length; i++)
{ {
amounts[i] /= 2; amounts[i] = Math.Max(1, amounts[i] / 2);
if (amounts[i] < 1)
{
amounts[i] = 1;
}
} }
} }