Removed stream usage from MultiSellChoose clientpacket.

This commit is contained in:
MobiusDevelopment
2023-01-08 12:24:44 +00:00
parent 7c8a32d266
commit 231eb957d9
48 changed files with 1492 additions and 148 deletions

View File

@@ -19,7 +19,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.OptionalLong;
import org.l2jmobius.commons.network.ReadablePacket;
import org.l2jmobius.gameserver.data.ItemTable;
@@ -561,10 +560,17 @@ public class MultiSellChoose implements ClientPacket
// Finally, give the tax to the castle.
if ((npc != null) && list.isApplyTaxes())
{
final OptionalLong taxPaid = entry.getIngredients().stream().filter(i -> i.getId() == Inventory.ADENA_ID).mapToLong(i -> Math.round(i.getCount() * list.getIngredientMultiplier() * list.getTaxRate()) * _amount).reduce(Math::multiplyExact);
if (taxPaid.isPresent())
long taxPaid = 0;
for (ItemChanceHolder ingredient : entry.getIngredients())
{
npc.handleTaxPayment(taxPaid.getAsLong());
if (ingredient.getId() == Inventory.ADENA_ID)
{
taxPaid += Math.round(ingredient.getCount() * list.getIngredientMultiplier() * list.getTaxRate()) * _amount;
}
}
if (taxPaid > 0)
{
npc.handleTaxPayment(taxPaid);
}
}
}