Jump to content
  • 0

AIOItem - Request buy only works with GM


Question

Posted

Hey there, so, first I have this code, so this AIOItem (a item that don't need to talk with NPCs, if you have on BAG just click and choose the option you want) do not work GMSHOP if the charecter is not a gm (if i put true in accesslevel.properties on option isGM the item works, but when the player hold shift and click on the npc or mob they can see admin menu of npc):

 

Here is the code of RequestBuyItem.java:

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;

import static com.l2jserver.gameserver.model.actor.L2Npc.INTERACTION_DISTANCE;
import static com.l2jserver.gameserver.model.itemcontainer.PcInventory.MAX_ADENA;

import java.util.ArrayList;
import java.util.List;

import com.l2jserver.Config;
import com.l2jserver.gameserver.TradeController;
import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.L2TradeList;
import com.l2jserver.gameserver.model.L2TradeList.L2TradeItem;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance;
import com.l2jserver.gameserver.model.actor.instance.L2MerchantSummonInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.holders.ItemHolder;
import com.l2jserver.gameserver.model.items.L2Item;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.ExBuySellList;
import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.util.Util;

/**
* RequestBuyItem client packet class.
*/
public final class RequestBuyItem extends L2GameClientPacket
{
        private static final String _C__1F_REQUESTBUYITEM = "[C] 1F RequestBuyItem";
        
        private static final int BATCH_LENGTH = 12; // length of the one item
        private int _listId;
        private Item[] _items = null;

        @Override
        protected void readImpl()
        {
                _listId = readD();
                int count = readD();
                if (count <= 0 || count > Config.MAX_ITEM_IN_PACKET || count * BATCH_LENGTH != _buf.remaining())
                {
                        return;
                }

                _items = new Item[count];
                for (int i = 0; i < count; i++)
                {
                        int itemId = readD();
                        long cnt = readQ();
                        if (itemId < 1 || cnt < 1)
                        {
                                _items = null;
                                return;
                        }
                        _items[i] = new Item(itemId, cnt);
                }
        }

        @Override
        protected void runImpl()
        {
                L2PcInstance player = getClient().getActiveChar();
                if (player == null)
                        return;
                
                if (!getClient().getFloodProtectors().getTransaction().tryPerformAction("buy"))
                {
                        player.sendMessage("You buying too fast.");
                        return;
                }

                if (_items == null)
                {
                        sendPacket(ActionFailed.STATIC_PACKET);
                        return;
                }

                // Alt game - Karma punishment
                if (!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && player.getKarma() > 0)
                {
                        sendPacket(ActionFailed.STATIC_PACKET);
                        return;
                }

                L2Object target = player.getTarget();
                L2Character merchant = null;
                if(!player.isUsingAIOItemMultisell())
                {
                        if(target == null 
                                        || (!player.isInsideRadius(target, INTERACTION_DISTANCE, true, false)) // Distance is too far)
                                        || (player.getInstanceId() != target.getInstanceId()))
                        {
                                sendPacket(ActionFailed.STATIC_PACKET);
                                return;
                        }
                        
                        if (target instanceof L2MerchantInstance || target instanceof L2MerchantSummonInstance)
                                merchant = (L2Character)target;
                        else  if (!player.isGM())
                        {
                                sendPacket(ActionFailed.STATIC_PACKET);
                                return;
                        }
                }

                L2TradeList list = null;

                double castleTaxRate = 0;
                double baseTaxRate = 0;

                if (merchant != null)
                {
                        List<L2TradeList> lists;
                        if (merchant instanceof L2MerchantInstance)
                        {
                                lists = TradeController.getInstance().getBuyListByNpcId(((L2MerchantInstance) merchant).getNpcId());
                                castleTaxRate = ((L2MerchantInstance) merchant).getMpc().getCastleTaxRate();
                                baseTaxRate = ((L2MerchantInstance) merchant).getMpc().getBaseTaxRate();
                        }
                        else
                        {
                                lists = TradeController.getInstance().getBuyListByNpcId(((L2MerchantSummonInstance) merchant).getNpcId());
                                baseTaxRate = 50;
                        }
                        
                        if (!player.isGM())
                        {
                                if (lists == null)
                                {
                                        Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId, Config.DEFAULT_PUNISH);
                                        return;
                                }
                                for (L2TradeList tradeList : lists)
                                {
                                        if (tradeList.getListId() == _listId)
                                                list = tradeList;
                                }
                        }
                        else
                                list = TradeController.getInstance().getBuyList(_listId);
                }
                else
                        list = TradeController.getInstance().getBuyList(_listId);

                if (list == null)
                {
                        Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId, Config.DEFAULT_PUNISH);
                        return;
                }

                _listId = list.getListId();

                long subTotal = 0;

                // Check for buylist validity and calculates summary values
                long slots = 0;
                long weight = 0;
                for (Item i : _items)
                {
                        L2TradeItem tradeItem = list.getItemById(i.getItemId());
                        if (tradeItem == null)
                        {
                                Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId + " and item_id " + i.getItemId(), Config.DEFAULT_PUNISH);
                                return;
                        }

                        L2Item template = ItemTable.getInstance().getTemplate(i.getItemId());
                        if (template == null)
                                continue;

            if (!template.isStackable() && i.getCount() > 1)
                        {
                                Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase invalid quantity of items at the same time.", Config.DEFAULT_PUNISH);
                                sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED));
                                return;
                        }

            long price = list.getPriceForItemId(i.getItemId());
            if (price < 0)
            {
                                _log.warning("ERROR, no price found .. wrong buylist ??");
                                sendPacket(ActionFailed.STATIC_PACKET);
                                return;
                        }

                        if (price == 0 && !player.isGM() && Config.ONLY_GM_ITEMS_FREE)
                        {
                                player.sendMessage("Ohh Cheat dont work? You have a problem now!");
                                Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried buy item for 0 adena.", Config.DEFAULT_PUNISH);
                                return;
                        }

                        if (tradeItem.hasLimitedStock())
                        {
                                // trying to buy more then available
                                if (i.getCount() > tradeItem.getCurrentCount())
                                        return;
                        }

                        if ((MAX_ADENA / i.getCount()) < price)
                        {
                                Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + MAX_ADENA + " adena worth of goods.", Config.DEFAULT_PUNISH);
                                return;
                        }
                        // first calculate price per item with tax, then multiply by count
                        price = (long) (price * (1 + castleTaxRate + baseTaxRate));
                        subTotal += i.getCount() * price;
                        if (subTotal > MAX_ADENA)
                        {
                                Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + MAX_ADENA + " adena worth of goods.", Config.DEFAULT_PUNISH);
                                return;
                        }

                        weight += i.getCount() * template.getWeight();
                        if (!template.isStackable())
                                slots += i.getCount();
                        else if (player.getInventory().getItemByItemId(i.getItemId()) == null)
                                slots++;
                }
                
                if (!player.isGM() && (weight > Integer.MAX_VALUE || weight < 0 || !player.getInventory().validateWeight((int) weight)))
                {
                        sendPacket(SystemMessage.getSystemMessage(SystemMessageId.WEIGHT_LIMIT_EXCEEDED));
                        sendPacket(ActionFailed.STATIC_PACKET);
                        return;
                }
                
                if (!player.isGM() && (slots > Integer.MAX_VALUE || slots < 0 || !player.getInventory().validateCapacity((int) slots)))
                {
                        sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SLOTS_FULL));
                        sendPacket(ActionFailed.STATIC_PACKET);
                        return;
                }

                // Charge buyer and add tax to castle treasury if not owned by npc clan
                if ((subTotal < 0) || !player.reduceAdena("Buy", subTotal, player.getLastFolkNPC(), false))
                {
                        sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
                        sendPacket(ActionFailed.STATIC_PACKET);
                        return;
                }

                // Proceed the purchase
                for (Item i : _items)
                {
                        L2TradeItem tradeItem = list.getItemById(i.getItemId());
                        if (tradeItem == null)
                        {
                                Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId + " and item_id " + i.getItemId(), Config.DEFAULT_PUNISH);
                                continue;
                        }

                        if (tradeItem.hasLimitedStock())
                        {
                                if (tradeItem.decreaseCount(i.getCount()))
                                        player.getInventory().addItem("Buy", i.getItemId(), i.getCount(), player, merchant);
                        }
                        else
                                player.getInventory().addItem("Buy", i.getItemId(), i.getCount(), player, merchant);
                }

                // add to castle treasury
                if(!player.isUsingAIOItemMultisell())
                {
                        // add to castle treasury
                        if (merchant instanceof L2MerchantInstance)
                                ((L2MerchantInstance) merchant).getCastle().addToTreasury((long) (subTotal * castleTaxRate));
                }
                
                StatusUpdate su = new StatusUpdate(player);
                player.sendPacket(su);
                player.sendPacket(new ExBuySellList(player, castleTaxRate + baseTaxRate, true));
        }

        private static class Item
        {
                private final int _itemId;
                private final long _count;
                
                public Item(int id, long num)
                {
                        _itemId = id;
                        _count = num;
                }

                public int getItemId()
                {
                        return _itemId;
                }

                public long getCount()
                {
                        return _count;
                }
        }

        @Override
        public String getType()
        {
                return _C__1F_REQUESTBUYITEM;
        }
}

 

What is the problem guys? this tool is a troll!

 

Thank you

 

Recommended Posts

  • 0
Posted

I've already answer your post :D

The code is correct...

If you have something else to ask... do it... but i'm not giving support ( only trough forum ).

 

ok, AIOItem handler is correct...the code is correct (but don't work)..well well... idk what i need to do!

But thanks for your help

  • 0
Posted

didnt see the code but you need npc oid to perform the most server bypasses.

 

Well the problem is that the code is working when he has GM access and not working when use with normal access character...

From the code i read i did not see restriction for access level ... i saw only some messages and checks that include if player is GM...

  • 0
Posted

Well the problem is that the code is working when he has GM access and not working when use with normal access character...

From the code i read i did not see restriction for access level ... i saw only some messages and checks that include if player is GM...

 

idk maybe he gets incorrect bypass when he is not gm, for example only gms may use admincommands or specific bypasses. They did this in order to avoid L2Phx bypass expoiting throuth moded html packets... But idk if thats the problem...

  • 0
Posted

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;

import static com.l2jserver.gameserver.model.actor.L2Npc.INTERACTION_DISTANCE;
import static com.l2jserver.gameserver.model.itemcontainer.PcInventory.MAX_ADENA;

import java.util.ArrayList;
import java.util.List;

import com.l2jserver.Config;
import com.l2jserver.gameserver.TradeController;
import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.L2TradeList;
import com.l2jserver.gameserver.model.L2TradeList.L2TradeItem;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance;
import com.l2jserver.gameserver.model.actor.instance.L2MerchantSummonInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.holders.ItemHolder;
import com.l2jserver.gameserver.model.items.L2Item;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.ExBuySellList;
import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.util.Util;

/**
* RequestBuyItem client packet class.
*/
public final class RequestBuyItem extends L2GameClientPacket
{
        private static final String _C__1F_REQUESTBUYITEM = "[C] 1F RequestBuyItem";
        
        private static final int BATCH_LENGTH = 12; // length of the one item
        private int _listId;
        private Item[] _items = null;

        @Override
        protected void readImpl()
        {
                _listId = readD();
                int count = readD();
                if (count <= 0 || count > Config.MAX_ITEM_IN_PACKET || count * BATCH_LENGTH != _buf.remaining())
                {
                        return;
                }

                _items = new Item[count];
                for (int i = 0; i < count; i++)
                {
                        int itemId = readD();
                        long cnt = readQ();
                        if (itemId < 1 || cnt < 1)
                        {
                                _items = null;
                                return;
                        }
                        _items[i] = new Item(itemId, cnt);
                }
        }

        @Override
        protected void runImpl()
        {
                L2PcInstance player = getClient().getActiveChar();
                if (player == null)
                        return;
                
                if (!getClient().getFloodProtectors().getTransaction().tryPerformAction("buy"))
                {
                        player.sendMessage("You buying too fast.");
                        return;
                }

                if (_items == null)
                {
                        sendPacket(ActionFailed.STATIC_PACKET);
                        return;
                }

                // Alt game - Karma punishment
                if (!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && player.getKarma() > 0)
                {
                        sendPacket(ActionFailed.STATIC_PACKET);
                        return;
                }

                L2Object target = player.getTarget();
                L2Character merchant = null;
                if(!player.isUsingAIOItemMultisell())
                {
                        if(target == null 
                                        || (!player.isInsideRadius(target, INTERACTION_DISTANCE, true, false)) // Distance is too far)
                                        || (player.getInstanceId() != target.getInstanceId()))
                        {
                                sendPacket(ActionFailed.STATIC_PACKET);
                                return;
                        }
                        
                        if (target instanceof L2MerchantInstance || target instanceof L2MerchantSummonInstance)
                                merchant = (L2Character)target;
                        else  if (!player.isGM())
                        {
                                sendPacket(ActionFailed.STATIC_PACKET);
                                return;
                        }
                }

                L2TradeList list = null;

                double castleTaxRate = 0;
                double baseTaxRate = 0;

                if (merchant != null)
                {
                        List<L2TradeList> lists;
                        if (merchant instanceof L2MerchantInstance)
                        {
                                lists = TradeController.getInstance().getBuyListByNpcId(((L2MerchantInstance) merchant).getNpcId());
                                castleTaxRate = ((L2MerchantInstance) merchant).getMpc().getCastleTaxRate();
                                baseTaxRate = ((L2MerchantInstance) merchant).getMpc().getBaseTaxRate();
                        }
                        else
                        {
                                lists = TradeController.getInstance().getBuyListByNpcId(((L2MerchantSummonInstance) merchant).getNpcId());
                                baseTaxRate = 50;
                        }
                        
                        if (!player.isGM())
                        {
                                if (lists == null)
                                {
                                        Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId, Config.DEFAULT_PUNISH);
                                        return;
                                }
                                for (L2TradeList tradeList : lists)
                                {
                                        if (tradeList.getListId() == _listId)
                                                list = tradeList;
                                }
                        }
                        else
                                list = TradeController.getInstance().getBuyList(_listId);
                }
                else
                        list = TradeController.getInstance().getBuyList(_listId);

                if (list == null)
                {
                        Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId, Config.DEFAULT_PUNISH);
                        return;
                }

                _listId = list.getListId();

                long subTotal = 0;

                // Check for buylist validity and calculates summary values
                long slots = 0;
                long weight = 0;
                for (Item i : _items)
                {
                        L2TradeItem tradeItem = list.getItemById(i.getItemId());
                        if (tradeItem == null)
                        {
                                Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId + " and item_id " + i.getItemId(), Config.DEFAULT_PUNISH);
                                return;
                        }

                        L2Item template = ItemTable.getInstance().getTemplate(i.getItemId());
                        if (template == null)
                                continue;

            if (!template.isStackable() && i.getCount() > 1)
                        {
                                Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase invalid quantity of items at the same time.", Config.DEFAULT_PUNISH);
                                sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED));
                                return;
                        }

            long price = list.getPriceForItemId(i.getItemId());
            if (price < 0)
            {
                                _log.warning("ERROR, no price found .. wrong buylist ??");
                                sendPacket(ActionFailed.STATIC_PACKET);
                                return;
                        }

                        if (price == 0 && !player.isGM() && Config.ONLY_GM_ITEMS_FREE)
                        {
                                player.sendMessage("Ohh Cheat dont work? You have a problem now!");
                                Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried buy item for 0 adena.", Config.DEFAULT_PUNISH);
                                return;
                        }

                        if (tradeItem.hasLimitedStock())
                        {
                                // trying to buy more then available
                                if (i.getCount() > tradeItem.getCurrentCount())
                                        return;
                        }

                        if ((MAX_ADENA / i.getCount()) < price)
                        {
                                Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + MAX_ADENA + " adena worth of goods.", Config.DEFAULT_PUNISH);
                                return;
                        }
                        // first calculate price per item with tax, then multiply by count
                        price = (long) (price * (1 + castleTaxRate + baseTaxRate));
                        subTotal += i.getCount() * price;
                        if (subTotal > MAX_ADENA)
                        {
                                Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + MAX_ADENA + " adena worth of goods.", Config.DEFAULT_PUNISH);
                                return;
                        }

                        weight += i.getCount() * template.getWeight();
                        if (!template.isStackable())
                                slots += i.getCount();
                        else if (player.getInventory().getItemByItemId(i.getItemId()) == null)
                                slots++;
                }
                
                if (!player.isGM() && (weight > Integer.MAX_VALUE || weight < 0 || !player.getInventory().validateWeight((int) weight)))
                {
                        sendPacket(SystemMessage.getSystemMessage(SystemMessageId.WEIGHT_LIMIT_EXCEEDED));
                        sendPacket(ActionFailed.STATIC_PACKET);
                        return;
                }
                
                if (!player.isGM() && (slots > Integer.MAX_VALUE || slots < 0 || !player.getInventory().validateCapacity((int) slots)))
                {
                        sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SLOTS_FULL));
                        sendPacket(ActionFailed.STATIC_PACKET);
                        return;
                }

                // Charge buyer and add tax to castle treasury if not owned by npc clan
                if ((subTotal < 0) || !player.reduceAdena("Buy", subTotal, player.getLastFolkNPC(), false))
                {
                        sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
                        sendPacket(ActionFailed.STATIC_PACKET);
                        return;
                }

                // Proceed the purchase
                for (Item i : _items)
                {
                        L2TradeItem tradeItem = list.getItemById(i.getItemId());
                        if (tradeItem == null)
                        {
                                Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId + " and item_id " + i.getItemId(), Config.DEFAULT_PUNISH);
                                continue;
                        }

                        if (tradeItem.hasLimitedStock())
                        {
                                if (tradeItem.decreaseCount(i.getCount()))
                                        player.getInventory().addItem("Buy", i.getItemId(), i.getCount(), player, merchant);
                        }
                        else
                                player.getInventory().addItem("Buy", i.getItemId(), i.getCount(), player, merchant);
                }

                // add to castle treasury
                if(!player.isUsingAIOItemMultisell())
                {
                        // add to castle treasury
                        if (merchant instanceof L2MerchantInstance)
                                ((L2MerchantInstance) merchant).getCastle().addToTreasury((long) (subTotal * castleTaxRate));
                }
                
                StatusUpdate su = new StatusUpdate(player);
                player.sendPacket(su);
                player.sendPacket(new ExBuySellList(player, castleTaxRate + baseTaxRate, true));
        }

        private static class Item
        {
                private final int _itemId;
                private final long _count;
                
                public Item(int id, long num)
                {
                        _itemId = id;
                        _count = num;
                }

                public int getItemId()
                {
                        return _itemId;
                }

                public long getCount()
                {
                        return _count;
                }
        }

        @Override
        public String getType()
        {
                return _C__1F_REQUESTBUYITEM;
        }
}

 

The only code i can read in this topic... but in that code there are no problems...

 

  • 0
Posted

Hey dudes, here I have the sample of a bypass:

 

data/html/aioitem/gmshopmain.htm:

<html><title>Gm-Shop</title>
<body>
<center>
<table>
<tr>
<td><img src="L2UI.GM_icon_light" width=32 height=32></td>
<td><img src="icon.etc_alphabet_S_i00" width=32 height=32></td>
<td><img src="icon.etc_alphabet_H_i00" width=32 height=32></td>
<td><img src="icon.etc_alphabet_O_i00" width=32 height=32></td>
<td><img src="icon.etc_alphabet_P_i00" width=32 height=32></td>
<td><img src="L2UI.GM_icon_light" width=32 height=32></td>
</tr>
</table>
<br>
<br>
<table>
<tr>
<td><img src="L2UI_CH3.shortcut_next_down" width=16 height=16></td>
<td><button action="bypass -h Aioitem_chat_aioitem/AIOShop/shop1" width=32 height=32 back="icon.armor_t95_u_i03" fore="icon.armor_t95_u_i03"></td>
<td><button value="Armors" action="bypass -h Aioitem_chat_aioitem/AIOShop/shop1" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button value="Weapons" action="bypass -h Aioitem_chat_aioitem/AIOShop/shop2" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button action="bypass -h Aioitem_chat_aioitem/AIOShop/shop2" width=32 height=32 back="icon.weapon_sacredumors_i00" fore="icon.weapon_sacredumors_i00"></td>
<td><img src="L2UI_CH3.shortcut_prev_down" width=16 height=16></td>
</tr><tr>
<td><img src="L2UI_CH3.shortcut_next_down" width=16 height=16></td>
<td><button action="bypass -h Aioitem_chat_aioitem/AIOShop/shop3" width=32 height=32 back="icon.accessary_queen_of_ice_necklace_i00" fore="icon.accessary_queen_of_ice_necklace_i00"></td>
<td><button value="Jewels" action="bypass -h Aioitem_chat_aioitem/AIOShop/shop3" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button value="Others" action="bypass -h Aioitem_chat_aioitem/AIOShop/shop12" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button action="bypass -h Aioitem_chat_aioitem/AIOShop/shop12" width=32 height=32 back="icon.vesper_cloack_i00" fore="icon.vesper_cloack_i00"></td>
<td><img src="L2UI_CH3.shortcut_prev_down" width=16 height=16></td>
</tr><tr>
<td><img src="L2UI_CH3.shortcut_next_down" width=16 height=16></td>
<td><button action="bypass -h Aioitem_shop_multisell 90042" width=32 height=32 back="BranchSys.icon.br_aga_redblue_pekingopera_i00" fore="BranchSys.icon.br_aga_redblue_pekingopera_i00"></td>
<td><button value="Agathions" action="bypass -h Aioitem_shop_multisell 90042" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button value="Accessory" action="bypass -h Aioitem_chat_aioitem/AIOShop/shop14" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button action="bypass -h Aioitem_chat_aioitem/AIOShop/shop14" width=32 height=32 back="BranchSys.icon.br_birthday_cake_i00" fore="BranchSys.icon.br_birthday_cake_i00"></td>
<td><img src="L2UI_CH3.shortcut_prev_down" width=16 height=16></td>
</tr><tr>
<td><img src="L2UI_CH3.shortcut_next_down" width=16 height=16></td>
<td><button action="bypass -h Aioitem_shop_multisell 100016" width=32 height=32 back="icon.etc_spell_shot_gold_i01" fore="icon.etc_spell_shot_gold_i01"></td>
<td><button value="Soulshots" action="bypass -h Aioitem_shop_multisell 100016" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button value="Scrolls" action="bypass -h Aioitem_shop_multisell 900019" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button action="bypass -h Aioitem_shop_multisell 900019" width=32 height=32 back="icon.etc_blessed_scrl_of_ench_wp_s_i05" fore="icon.etc_blessed_scrl_of_ench_wp_s_i05"></td>
<td><img src="L2UI_CH3.shortcut_prev_down" width=16 height=16></td>
</tr><tr>
<td><img src="L2UI_CH3.shortcut_next_down" width=16 height=16></td>
<td><button action="bypass -h Aioitem_shop_multisell 100018" width=32 height=32 back="icon.etc_potion_gold_i00" fore="icon.etc_potion_gold_i00"></td>
<td><button value="Potions" action="bypass -h Aioitem_shop_multisell 100018" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button value="Dyes" action="bypass -h Aioitem_shop_multisell 900022" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button action="bypass -h Aioitem_shop_multisell 900022" width=32 height=32 back="icon.etc_wit_hena_i01" fore="icon.etc_wit_hena_i01"></td>
<td><img src="L2UI_CH3.shortcut_prev_down" width=16 height=16></td>
</tr><tr>
<td><img src="L2UI_CH3.shortcut_next_down" width=16 height=16></td>
<td><button action="bypass -h Aioitem_shop_multisell 900023" width=32 height=32 back="icon.etc_shining_bolt_i00" fore="icon.etc_shining_bolt_i00"></td>
<td><button value="Consumable" action="bypass -h Aioitem_shop_multisell 900023" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button value="Crystal" action="bypass -h Aioitem_shop_multisell 10021" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button action="bypass -h Aioitem_shop_multisell 10021" width=32 height=32 back="icon.etc_crystal_gold_i00" fore="icon.etc_crystal_gold_i00"></td>
<td><img src="L2UI_CH3.shortcut_prev_down" width=16 height=16></td>
</tr>
</table></center>
<center>
<table>
<tr>
<td><button value="PROXIMO"action="bypass -h Aioitem_chat_aioitem/AIOShop/shop13" width=100 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
</tr>
</table>
<br>
Compre tudo o que quiser aqui comigo!

</center>
<br>
</body>
</html>

 

Now here a bypass of a other shop from aioitem, shop1.htm (data/html/aioitem/AIOShop/shop1.htm):

<html><title>Gm-Shop</title>
<body>
<center>
<table>
<tr>
<td><img src="L2UI.GM_icon_light" width=32 height=32></td>
<td><img src="icon.etc_alphabet_S_i00" width=32 height=32></td>
<td><img src="icon.etc_alphabet_H_i00" width=32 height=32></td>
<td><img src="icon.etc_alphabet_O_i00" width=32 height=32></td>
<td><img src="icon.etc_alphabet_P_i00" width=32 height=32></td>
<td><img src="L2UI.GM_icon_light" width=32 height=32></td>
</tr>
</table>
<br>
<br>
<table>
<tr>
<td><img src="L2UI_CH3.shortcut_next_down" width=16 height=16></td>
<td><button action="bypass -h Aioitem_shop_multisell 990002" width=32 height=32 back="icon.armor_t99_u_i00" fore="icon.armor_t99_u_i00"></td>
<td><button value="Elegia" action="bypass -h Aioitem_shop_multisell 990002" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button value="Vorpal" action="bypass -h Aioitem_shop_multisell 990003" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button action="bypass -h Aioitem_shop_multisell 990003" width=32 height=32 back="icon.armor_t95_u_i03" fore="icon.armor_t95_u_i03"></td>
<td><img src="L2UI_CH3.shortcut_prev_down" width=16 height=16></td>
</tr><tr>
<td><img src="L2UI_CH3.shortcut_next_down" width=16 height=16></td>
<td><button action="bypass -h Aioitem_shop_multisell 990004" width=32 height=32 back="icon.armor_t94_u_i01" fore="icon.armor_t94_u_i01"></td>
<td><button value="Vesper" action="bypass -h Aioitem_shop_multisell 990004" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button value="Moirai" action="bypass -h Aioitem_shop_multisell 990005" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button action="bypass -h Aioitem_shop_multisell 990005" width=32 height=32 back="icon.armor_t101_u_i00" fore="icon.armor_t101_u_i00"></td>
<td><img src="L2UI_CH3.shortcut_prev_down" width=16 height=16></td>
</tr><tr>
<td><img src="L2UI_CH3.shortcut_next_down" width=16 height=16></td>
<td><button action="bypass -h Aioitem_shop_multisell 990006" width=32 height=32 back="icon.armor_t93_u_i00" fore="icon.armor_t93_u_i00"></td>
<td><button value="Dynasty" action="bypass -h Aioitem_shop_multisell 990006" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button value="S Grade" action="bypass -h Aioitem_shop_multisell 990007" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button action="bypass -h Aioitem_shop_multisell 990007" width=32 height=32 back="icon.armor_t89_ul_i00" fore="icon.armor_t89_ul_i00"></td>
<td><img src="L2UI_CH3.shortcut_prev_down" width=16 height=16></td>
</tr><tr>
<td><img src="L2UI_CH3.shortcut_next_down" width=16 height=16></td>
<td><button action="bypass -h Aioitem_shop_multisell 900001" width=32 height=32 back="icon.armor_t76_ul_i00" fore="icon.armor_t76_ul_i00"></td>
<td><button value="A Grade" action="bypass -h Aioitem_shop_multisell 900001" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button value="B Grade" action="bypass -h Aioitem_shop_multisell 900002" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button action="bypass -h Aioitem_shop_multisell 900002" width=32 height=32 back="icon.armor_t59_ul_i00" fore="icon.armor_t59_ul_i00"></td>
<td><img src="L2UI_CH3.shortcut_prev_down" width=16 height=16></td>
</tr><tr>
<td><img src="L2UI_CH3.shortcut_next_down" width=16 height=16></td>
<td><button action="bypass -h Aioitem_shop_multisell 900003" width=32 height=32 back="icon.armor_t63_u_i00" fore="icon.armor_t63_u_i00"></td>
<td><button value="C Grade" action="bypass -h Aioitem_shop_multisell 900003" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button value="D/No-Grade" action="bypass -h Aioitem_shop_multisell 900004" width=70 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
<td><button action="bypass -h Aioitem_shop_multisell 900004" width=32 height=32 back="icon.armor_t43_u_i00" fore="icon.armor_t43_u_i00"></td>
<td><img src="L2UI_CH3.shortcut_prev_down" width=16 height=16></td>
</tr>
</table></center>
<center>
<table>
<tr>
<td><button value="Inicio"action="bypass -h Aioitem_chat_aioitem/gmshopmain" width=100 height=32 back="L2UI_CT1.Windows_DF_Drawer_Bg_Darker" fore="L2UI_CT1.Windows_DF_Drawer_Bg_Darker"></td>
</tr>
</table>
<br>
<table>
<tr>
<td><img src="L2UI_CT1.MiniMap_DF_ICN_Center" width=32 height=32></td>
<td><img src="icon.etc_alphabet_a_i00" width=32 height=32></td>
<td><img src="icon.etc_alphabet_r_i00" width=32 height=32></td>
<td><img src="icon.etc_m_i00" width=32 height=32></td>
<td><img src="icon.etc_alphabet_o_i00" width=32 height=32></td>
<td><img src="icon.etc_alphabet_r_i00" width=32 height=32></td>
<td><img src="L2UI_CT1.MiniMap_DF_ICN_Center" width=32 height=32></td>
</tr>
</table>
</center>
<br>
</body>
</html>

 

Thanks

  • 0
Posted

guys, sorry for double post, but the forum don't accept too much lines...

 

here have the code (are correct too):

game/data/scripts/handlers/aioitemhandler/AIOShopHandler.java

package handlers.aioitemhandler;

import java.util.logging.Logger;

import com.l2jserver.gameserver.TradeController;
import com.l2jserver.gameserver.datatables.MultiSell;
import com.l2jserver.gameserver.handler.IAIOItemHandler;
import com.l2jserver.gameserver.model.L2TradeList;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.BuyList;
import com.l2jserver.gameserver.network.serverpackets.ExBuySellList;


public class AIOShopHandler implements IAIOItemHandler
{
private static final Logger _log = Logger.getLogger(AIOShopHandler.class.getName());
private static final String BYPASS = "shop";

@Override
public String getBypass()
{
	return BYPASS;
}

@Override
public void onBypassUse(L2PcInstance player, String command)
{
	String[] subCommand = command.split(" ");
	/*
	 * Check for null pointers
	 */
	if (subCommand.length < 2)
	{
		_log.severe("Wrong bypass: " + command + " for the AIO Item");
		return;
	}

	String actualCmd = subCommand[0];

	/*
	 * subCommand parameter npe checked here due common task. If you are planning to add new cmds and they dont have to have subCommand parameters necessary, move this to the buylist, multisell and needed commands
	 */
	if ((subCommand[1] == null) || subCommand[1].isEmpty())
	{
		_log.severe("Wrong buylist window/multisell in the AIOItem: " + command);
		return;
	}

	/*
	 * Get the shopId/muiltisell id which gona be used
	 */
	int shopId = 0;
	try
	{
		shopId = Integer.valueOf(subCommand[1]);
	}
	catch (NumberFormatException nfe)
	{
		_log.severe("Wrong shop id passed: " + subCommand[1]);
	}
	if (shopId == 0)
	{
		return;
	}

	/*
	 * Handles the bypasses to open buylists windows
	 */
	if (actualCmd.equalsIgnoreCase("buylist"))
	{
		player.tempInventoryDisable();

		L2TradeList list = TradeController.getInstance().getBuyList(shopId);
		if (list == null)
		{
			_log.severe("The buylist shop id " + shopId + " does not exist!");
			_log.severe("Check the command [" + command + "] in the AIO Item");
			return;
		}

		player.setIsUsingAIOItemMultisell(true);
		player.sendPacket(new BuyList(list, player.getAdena(), 0));
		player.sendPacket(new ExBuySellList(player, 0, false));
	}

	/*
	 * Handles the bypasses to open a multisell window
	 */
	else if (actualCmd.equalsIgnoreCase("multisell"))
	{
		player.setIsUsingAIOItemMultisell(true);
		MultiSell.getInstance().separateAndSend(shopId, player, null, false); // false = multisell, true = exc_multisell
	}
}
}

Guest
This topic is now closed to further replies.


×
×
  • Create New...