ethos Posted February 28, 2011 Posted February 28, 2011 Well as the title says this is a patch to fix the multisell quantity bug when a player is trying to buy an amount of item that exceeding the slots in his inventory or either exceeding his current weight limit. Example without patch: lets say you got 80 maximum slots and u go to buy 81 or more blessed scrolls from your custom multisell. Well in my case without this patch after the items was created in your inventory your client was getting crashed and keep crashing on login until u clear those items from your database. Example with patch: again you got 80 maximum slots and u go to buy 81 or more blessed scrolls from your custom multisell. You will get a message "Your Inventory is full". or i you try to buy something that u could get more than 100% weight limit you will get a message "You exceeded your Weight Limit." Tested and working with core L2j Server Interlude rev4709 but im sure this will work in other cores too... A note that this patch maybe already applied to your core so just ignore it.! Hope this helps u..! Index: java/net/sf/l2j/gameserver/clientpackets/MultiSellChoose.java =================================================================== --- java/net/sf/l2j/gameserver/clientpackets/MultiSellChoose.java (revision 4507) +++ java/net/sf/l2j/gameserver/clientpackets/MultiSellChoose.java (working copy) @@ -97,6 +97,36 @@ MultiSellEntry entry = prepareEntry(merchant, templateEntry, applyTaxes, maintainEnchantment, enchantment); + /** Fix that checks if the amount to be purchased + is exceeding the slots or weight limit and + returns a message to the player [Custom] */ + + int slots = 0; + int weight = 0; + for (MultiSellIngredient e : entry.getProducts()) + { + if (e.getItemId() < 0) + continue; + L2Item template = ItemTable.getInstance().getTemplate(e.getItemId()); + if (template == null) + continue; + if (!template.isStackable()) + slots += e.getItemCount() * _amount; + else if (player.getInventory().getItemByItemId(e.getItemId()) == null) + slots++; + weight += e.getItemCount() * _amount * template.getWeight(); + } + if (!inv.validateWeight(weight)) + { + player.sendPacket(new SystemMessage(SystemMessageId.WEIGHT_LIMIT_EXCEEDED)); + return; + } + if (!inv.validateCapacity(slots)) + { + player.sendPacket(new SystemMessage(SystemMessageId.SLOTS_FULL)); + return; + } + // Generate a list of distinct ingredients and counts in order to check if the correct item-counts // are possessed by the player FastList<MultiSellIngredient> _ingredientsList = new FastList<MultiSellIngredient>(); Quote
v1hack Posted February 28, 2011 Posted February 28, 2011 i think this issue was solved in 1987 so you are to late lol :D Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.