Ejemplo n.º 1
0
        public void offerSellItem(int inventorySlot)
        {
            if (currentOffer == null)
            {
                p.getPackets().sendMessage("[offerSellItem]: Nice try cheater!, If this is bug please report it.");
                return;
            }

            Item item = p.getInventory().getSlot(inventorySlot);

            if (item != null && item.getItemId() > 0 && item.getItemAmount() > 0)
            {
                int           itemToShow = item.getItemId();
                ItemData.Item def        = item.getDefinition();

                if (def == null)
                {
                    p.getPackets().sendMessage("Item: " + item.getItemId() + " cannot be found in item definitions, please report it.");
                    return;
                }

                if (def.isNoted())
                {
                    itemToShow = ItemData.getUnNotedItem(item.getItemId());
                    if (itemToShow == item.getItemId())
                    {
                        // item is only noted (this is definetly itemData.xml file issue).
                        p.getPackets().sendMessage("Item: " + item.getItemId() + " An unnoted equivalent of this item cannot be found, please report it.");
                        return;
                    }
                    else
                    {
                        //update item def with un-noted def.
                        def = ItemData.forId(itemToShow);
                        item.setItemId(itemToShow);
                    }
                }

                if (def.isPlayerBound() || (def.getPrice().getNormalPrice() == 0 && def.getPrice().getMaximumPrice() == 0 && def.getPrice().getMinimumPrice() == 0))
                {
                    //look at unNoted item price, of a item which was previously noted.
                    p.getPackets().sendMessage("This item cannot be sold on the Grand Exchange.");
                    return;
                }
                p.getPackets().sendConfig(1109, item.getItemId());
                p.getPackets().sendConfig(1110, item.getItemAmount());
                p.getPackets().sendConfig(1114, def.getPrice().getNormalPrice());
                p.getPackets().sendConfig(1116, def.getPrice().getMaximumPrice());
                p.getPackets().sendConfig(1115, def.getPrice().getMinimumPrice());
                p.getPackets().sendConfig(1111, def.getPrice().getNormalPrice());
                p.getPackets().modifyText(def.getExamine(), 105, 142); //item examine text.

                currentOffer.setItem(item.getItemId());
                currentOffer.setTotalAmount(item.getItemAmount());
                currentOffer.setPriceEach(def.getPrice().getNormalPrice());
            }
        }
Ejemplo n.º 2
0
        public void offerSellItem(int inventorySlot)
        {
            Item item = p.getInventory().getSlot(inventorySlot);

            if (item != null && item.getItemId() > 0 && item.getItemAmount() > 0)
            {
                int           itemToShow = item.getItemId();
                ItemData.Item def        = item.getDefinition();

                if (def == null)
                {
                    p.getPackets().sendMessage("This item cannot be found in item definitions, please report it.");
                    return;
                }

                if (def.isNoted())
                {
                    itemToShow = ItemData.getUnNotedItem(item.getItemId());
                    if (itemToShow == item.getItemId())   // item is only noted
                    {
                        p.getPackets().sendMessage("An unnoted equivalent of this item cannot be found, please report it.");
                        return;
                    }
                    else
                    {
                        def = ItemData.forId(itemToShow); //update item def with un-noted def.. to fix price.
                    }
                }

                if (def.isPlayerBound() || (def.getPrice().getNormalPrice() == 0 && def.getPrice().getMaximumPrice() == 0 && def.getPrice().getMinimumPrice() == 0))
                { //look at unNoted item price, of a item which was previously noted.
                    p.getPackets().sendMessage("This item cannot be sold on the Grand Exchange.");
                    return;
                }

                p.getPackets().sendConfig(1109, itemToShow);
                p.getPackets().sendConfig(1110, item.getItemAmount());
                p.getPackets().sendConfig(1114, def.getPrice().getNormalPrice());
                p.getPackets().sendConfig(1116, def.getPrice().getMaximumPrice());
                p.getPackets().sendConfig(1115, def.getPrice().getMinimumPrice());
                p.getPackets().sendConfig(1111, def.getPrice().getNormalPrice());
                currentOffer = new SellOffer(item.getItemId(), item.getItemAmount(), def.getPrice().getNormalPrice(), slot, p.getLoginDetails().getUsername());
                currentOffer.setUnNotedId(item.getDefinition().isNoted() ? itemToShow : item.getItemId());
            }
        }