Ejemplo n.º 1
0
 public void checkOffer(int slot)
 {
     this.currentOffer = Server.getGrandExchange().getOfferForSlot(p, slot);
     if (currentOffer != null)
     {
         ItemData.ItemPrice price = currentOffer.getItemPrice();
         p.getPackets().sendConfig(1109, currentOffer.getItem());
         p.getPackets().sendConfig(1110, currentOffer.getTotalAmount());
         p.getPackets().sendConfig(1111, currentOffer.getPriceEach());
         p.getPackets().sendConfig(1112, currentOffer.getSlot());
         p.getPackets().sendConfig(1113, 0);
         p.getPackets().sendConfig(1114, price.getNormalPrice());
         p.getPackets().sendConfig(1116, price.getMaximumPrice());
         p.getPackets().sendConfig(1115, price.getMinimumPrice());
         Item slot1 = currentOffer.getSlot1();
         Item slot2 = currentOffer.getSlot2();
         if (currentOffer is BuyOffer)
         {
             //slot1 = currentOffer.getAmountTraded() == 0 ? null : new Item(currentOffer.getItem(), currentOffer.getAmountTraded());
             //slot2 = (currentOffer.getAmountTraded() == currentOffer.getTotalAmount()) ||  currentOffer.getAmountTraded() == 0 ? null : new Item(995, (currentOffer.getTotalAmount() - currentOffer.getAmountTraded()) * currentOffer.getPriceEach());
         }
         else
         {
             //slot1 = (currentOffer.getAmountTraded() == currentOffer.getTotalAmount()) ||  currentOffer.getAmountTraded() == 0 ? null : new Item(currentOffer.getUnNotedId(), currentOffer.getTotalAmount() - currentOffer.getAmountTraded());
             //slot2 = currentOffer.getAmountTraded() == 0 ? null : new Item(995, (currentOffer.getAmountTraded()) * currentOffer.getPriceEach());
         }
         Item[] items = { slot1, slot2 };
         currentOffer.setSlot1(slot1);
         currentOffer.setSlot2(slot2);
         p.getPackets().sendItems(-1, -1757, 523 + currentOffer.getSlot(), items);
     }
 }
    private SortedList <string, GEItem> ProcessItems(ItemsType items)
    {
        SortedList <string, GEItem> processedItems = new SortedList <string, GEItem>();

        if (items == null)
        {
            return(processedItems);
        }
        foreach (ItemsTypeItem item in items.Item)
        {
            SortedList <string, GEMenuItem> menuItems  = ProcessMenuItems(item.MenuItems, item.id);
            SortedList <string, GEProperty> properties = ProcessProperties(item.Properties);
            SortedList <string, GEText>     texts      = ProcessTexts(item.Texts);
            GEItem newItem = new GEItem(item.id, null, item.activeAtStart, item.equipable, null)
            {
                MenuItems  = menuItems,
                Properties = properties,
                Texts      = texts
            };
            OnReferenceProcessing += delegate(object o, EventArgs e)
            {
                newItem.ItemName    = elementManager.GetTextElement(item.nameTextId);
                newItem.Description = elementManager.GetTextElement(item.descTextId);
            };
            elementManager.AddItem(newItem);
            processedItems.Add(item.id, newItem);
        }
        return(processedItems);
    }
Ejemplo n.º 3
0
    public static MenuItemBundle CreateBundle(GEItem item, MenuItemBundle parent)
    {
        MenuItemBundle newBundle = new MenuItemBundle(item.ItemName.GetText(), parent);

        if (item.Equipable && !item.IsEquipped)
        {
            newBundle.AddMenuItem(new MIEquip(item, newBundle));
        }
        foreach (GEMenuItem action in item.MenuItems.Values)
        {
            newBundle.AddMenuItem(new MIGameElementAction(action.MenuName.GetText(), newBundle, action));
            action.OnActivationChange += newBundle.RefreshOnEvent;
        }
        //Props menuItem
        List <GEProperty> propsToShow = GEProperty.GetPropertiesWithNames(item.Properties.Values);

        if (propsToShow.Count != 0)
        {
            newBundle.AddMenuItem(new MIShowDescription(LabelUtility.Instance.GetLabel(LabelNames.ITEMPROPS), newBundle, () => GEProperty.GetPropertyDescText(propsToShow)));
        }

        newBundle.AddMenuItem(new MIBack(parent));
        Description.GetInstance().AddDescriptionText(item.Description.GetText());
        return(newBundle);
    }
Ejemplo n.º 4
0
        public bool Check()
        {
            GEItem item = elementManager.GetGameElement(refId) as GEItem;

            if (item == null)
            {
                System.Console.WriteLine("There is no item with the given id! " + refId);
                return(false);
            }
            return(item.IsEquipped == valueToCheck);
        }
Ejemplo n.º 5
0
 public void updateGEProgress(GEItem offer)
 {
     connection.SendPacket(new PacketBuilder().setId(116)
                           .addByte((byte)offer.getSlot())
                           .addByte((byte)offer.getProgress())
                           .addUShort(offer.getDisplayItem())
                           .addInt(offer.getPriceEach())
                           .addInt(offer.getTotalAmount())
                           .addInt(offer.getAmountTraded())
                           .addInt(offer.getTotalAmount() * offer.getPriceEach()).toPacket());
 }
Ejemplo n.º 6
0
            public void Execute(GameElementManager elementManager)
            {
                GEItem item = elementManager.GetItem(refId);

                if (isForEquip)
                {
                    item.Equip(elementManager);
                }
                else
                {
                    item.Unequip(elementManager);
                }
            }
Ejemplo n.º 7
0
 public void newBuyOffer(byte slot)
 {
     this.currentOffer = new BuyOffer(slot, p.getLoginDetails().getLongName());
     myGEItems[slot]   = this.currentOffer;
     p.getPackets().sendConfig(1109, -1);
     p.getPackets().sendConfig(1110, 0);
     p.getPackets().sendConfig(1111, 0);
     p.getPackets().sendConfig(1112, slot);
     p.getPackets().sendConfig(1113, 0);
     p.getPackets().sendConfig(1114, 0);
     p.getPackets().sendConfig(1115, 0);
     p.getPackets().sendConfig(1116, 0);
     openItemSearch();
 }
Ejemplo n.º 8
0
 public void newBuyOffer(byte slot)
 {
     this.slot         = slot;
     this.currentOffer = new BuyOffer();
     p.getPackets().sendConfig(1109, -1);
     p.getPackets().sendConfig(1110, 0);
     p.getPackets().sendConfig(1111, 0);
     p.getPackets().sendConfig(1112, slot);
     p.getPackets().sendConfig(1113, 0);
     p.getPackets().sendConfig(1114, 0);
     p.getPackets().sendConfig(1115, 0);
     p.getPackets().sendConfig(1116, 0);
     openItemSearch();
 }
Ejemplo n.º 9
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());
            }
        }
Ejemplo n.º 10
0
 public void newSellOffer(byte slot)
 {
     this.currentOffer = new SellOffer(slot, p.getLoginDetails().getLongName());
     myGEItems[slot]   = this.currentOffer;
     p.getPackets().sendConfig(1109, -1);
     p.getPackets().sendConfig(1110, 0);
     p.getPackets().sendConfig(1111, 0);
     p.getPackets().sendConfig(1112, slot);
     p.getPackets().sendConfig(1113, 1);
     p.getPackets().sendConfig(1114, 0);
     p.getPackets().sendConfig(1115, 0);
     p.getPackets().sendConfig(1116, 0);
     p.getPackets().displayInventoryInterface(107);
     p.getPackets().setRightClickOptions(1026, 107 * 65536 + 18, 0, 27);
     object[] opts = new object[] { "", "", "", "", "Offer", -1, 0, 7, 4, 93, 7012370 };
     p.getPackets().sendClientScript(149, opts, "IviiiIsssss");
     p.getPackets().sendItems(-1, 65535, 93, p.getInventory().getItems());
 }
Ejemplo n.º 11
0
 public void updateSearchItem(int item)
 {
     p.getPackets().sendConfig(1109, item);
     p.getPackets().sendConfig(1110, 0);
     ItemData.Item def = ItemData.forId(item);
     if (def == null)
     {
         return;
     }
     p.getPackets().sendConfig(1109, item);
     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 BuyOffer(slot, p.getLoginDetails().getUsername());
     currentOffer.setTotalAmount(0);
     currentOffer.setItem(item);
     currentOffer.setPriceEach(def.getPrice().getNormalPrice());
     p.getPackets().sendInterface(0, 752, 6, 137);         // Removes the item search
 }
Ejemplo n.º 12
0
        public void updateSlotStates()
        {
            Item[] items = { currentOffer.getSlot1(), currentOffer.getSlot2() };
            p.getPackets().sendItems(-1, -1757, 523 + currentOffer.getSlot(), items);

            /*
             * Deletes the offer from database completely.
             * Only if amount you were willing to sell/(buy?) was completed
             * Or you clicked abort item
             * And taken both items out of Slot1 and Slot2.
             * Otherwise it just saves how much you taken out of both slots (if anything).
             */
            if (((currentOffer.getAmountTraded() == currentOffer.getTotalAmount()) || currentOffer.isAborted()) && currentOffer.getSlot1() == null && currentOffer.getSlot2() == null)
            {
                Server.getGrandExchange().removeOffer(currentOffer);
                resetInterface();
                currentOffer = null;
            }
            else
            {
                Server.getGrandExchange().updateGEItemSlotsDatabase(currentOffer);
            }
        }
Ejemplo n.º 13
0
 public void collectSlot2()
 {
     if (currentOffer != null)
     {
         if (currentOffer.getSlot2() != null)
         {
             if (p.getInventory().addItem(995, currentOffer.getSlot2().getItemAmount()))
             {
                 currentOffer.setSlot2(null);
                 Item[] items = { currentOffer.getSlot1(), currentOffer.getSlot2() };
                 p.getPackets().sendItems(-1, -1757, 523 + currentOffer.getSlot(), items);
             }
             if (((currentOffer.getAmountTraded() == currentOffer.getTotalAmount()) || currentOffer.isAborted()) && currentOffer.getSlot1() == null && currentOffer.getSlot2() == null)
             {
                 if (Server.getGrandExchange().removeOffer(currentOffer))
                 {
                     resetInterface();
                     currentOffer = null;
                 }
             }
         }
     }
 }
Ejemplo n.º 14
0
 public void AddItem(GEItem item)
 {
     AddToDic(items, item);
 }
Ejemplo n.º 15
0
        public void confirmOffer()
        {
            /*
             * Confirm a Buyer or Seller listing.
             */
            if (currentOffer == null)
            {
                p.getPackets().sendMessage("[confirmOffer]: Nice try cheater!, If this is bug please report it.");
                return;
            }

            long gpAmountCalculated = Math.BigMul(currentOffer.getTotalAmount(), currentOffer.getPriceEach());

            if (gpAmountCalculated > Inventory.MAX_ITEM_AMOUNT)
            {
                if (currentOffer is BuyOffer)
                {
                    p.getPackets().sendMessage("You won't be able to cover the offer, it exceeds maximum gold.");
                    return;
                }
                else if (currentOffer is SellOffer)
                {
                    p.getPackets().sendMessage("You can't sell that many, it would create too much gold to be able to take out.");
                    return;
                }
            }

            if (currentOffer is BuyOffer)
            {
                int gpAmount = (int)gpAmountCalculated;
                if (currentOffer.getTotalAmount() <= 0)
                {
                    p.getPackets().sendMessage("You must choose the quantity you wish to buy!");
                    return;
                }
                else if (!p.getInventory().hasItemAmount(995, gpAmount))
                {
                    p.getPackets().sendMessage("You don't have enough coins in your inventory to cover the offer.");
                    return;
                }
                else if (!p.getInventory().deleteItem(995, gpAmount))
                {
                    return;
                }
            }
            else if (currentOffer is SellOffer)
            {
                if (currentOffer.getTotalAmount() <= 0)
                {
                    p.getPackets().sendMessage("You must choose the quantity you wish to sell!");
                    return;
                }
                else if (!p.getInventory().hasItemAmount(currentOffer.getItem(), currentOffer.getTotalAmount()))
                {
                    p.getPackets().sendMessage("You do not have enough of this item in your inventory to cover the offer.");
                    return;
                }
                if (ItemData.forId(currentOffer.getItem()).isNoted() || ItemData.forId(currentOffer.getItem()).isStackable())
                {
                    if (!p.getInventory().deleteItem(currentOffer.getItem(), currentOffer.getTotalAmount()))
                    {
                        p.getPackets().sendMessage("[confirmOffer]: Nice try cheater!, you don't have this item!.");
                        return;
                    }
                }
                else
                {
                    //UnNoted variant of this item, so remove multiple items from inventory.
                    int amountTotalDeleted = p.getInventory().deleteItemAndShowAmountDeleted(currentOffer.getUnNotedId(), currentOffer.getTotalAmount());
                    currentOffer.setTotalAmount(amountTotalDeleted);
                    p.getPackets().sendConfig(1110, currentOffer.getTotalAmount());
                }
            }

            p.getPackets().sendConfig(1113, -1);
            p.getPackets().sendConfig(1112, -1);
            currentOffer.setSubmitting(true);
            p.getPackets().updateGEProgress(currentOffer);
            Server.getGrandExchange().addOffer(currentOffer);
            GEItem offer = currentOffer;

            currentOffer = null;
            Event updateGEProgressEvent = new Event(500);

            updateGEProgressEvent.setAction(() => {
                updateGEProgressEvent.stop();
                offer.setSubmitting(false); //done submitting = orangebar
                p.getPackets().updateGEProgress(offer);
            });
            Server.registerEvent(updateGEProgressEvent);
        }
Ejemplo n.º 16
0
        public void checkOffer(byte slot)
        {
            this.currentOffer = myGEItems[slot];

            /*
             * The line below always gets the GEItem by player and GE slot from database.
             * It's alot slower to keep retrieving it from database.
             * Line above this comment uses the preloaded GEItems
             * That should be the same thing, But faster.
             */
            //this.currentOffer = Server.getGrandExchange().getOfferByPlayerSlot(p, slot);

            if (currentOffer == null)
            {
                p.getPackets().sendMessage("[checkOffer]: Nice try cheater!, If this is bug please report it.");
                return;
            }

            ItemData.ItemPrice price = currentOffer.getItemPrice();
            ItemData.Item      def   = ItemData.forId(currentOffer.getItem());

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

            p.getPackets().sendConfig(1109, currentOffer.getItem());
            p.getPackets().sendConfig(1110, currentOffer.getTotalAmount());
            p.getPackets().sendConfig(1111, currentOffer.getPriceEach());
            p.getPackets().sendConfig(1112, currentOffer.getSlot());
            p.getPackets().sendConfig(1113, 0);
            p.getPackets().sendConfig(1114, price.getNormalPrice());
            p.getPackets().sendConfig(1116, price.getMaximumPrice());
            p.getPackets().sendConfig(1115, price.getMinimumPrice());
            p.getPackets().modifyText(def.getExamine(), 105, 142); //item examine text.

            if (currentOffer is BuyOffer)
            {
                //A Buyer can have how much of the item's he bought shown even if they aborted the currentOffer.
                currentOffer.setSlot1((currentOffer.getAmountItemsLeftToCollect() > 0) ? new Item(currentOffer.getItem(), currentOffer.getAmountItemsLeftToCollect()) : null);

                /**If Buyer Aborted the item buying, it shows UnBought item gold + Overpay gold
                 * If Buyer doesn't abort the item it shows just Overpay gold.
                 */
                if (currentOffer.isAborted())
                {
                    currentOffer.setSlot2((currentOffer.getTotalAmountGoldLeftToCollect() > 0) ? new Item(995, currentOffer.getTotalAmountGoldLeftToCollect()) : null);
                }
                else
                {
                    currentOffer.setSlot2((currentOffer.getAmountCollectedGold() < currentOffer.getAmountOverpaid()) ? new Item(995, currentOffer.getAmountOverpaid()) : null);
                }
            }
            else if (currentOffer is SellOffer)
            {
                //If Seller Aborted the item selling, it shows UnSold items
                currentOffer.setSlot1((currentOffer.isAborted() && currentOffer.getTotalAmountItemsLeftToCollect() > 0) ? new Item(currentOffer.getItem(), currentOffer.getTotalAmountItemsLeftToCollect()) : null);

                //Always shows Seller Item Sold Gold + Overpay gold (shows how much money you made from sales + overpays.)
                currentOffer.setSlot2((currentOffer.getAmountGoldLeftToCollect() > 0) ? new Item(995, currentOffer.getAmountGoldLeftToCollect()) : null);
            }

            Item[] items = { currentOffer.getSlot1(), currentOffer.getSlot2() };
            p.getPackets().sendItems(-1, -1757, 523 + currentOffer.getSlot(), items);
        }
Ejemplo n.º 17
0
 public MIEquip(GEItem geItem, MenuItemBundle parentBundle) : base(LabelUtility.Instance.GetLabel(LabelNames.PICKUP), parentBundle)
 {
     elementManager = ObjectManager.CurrentGEM;
     this.geItem    = geItem;
     description    = Description.GetInstance();
 }
Ejemplo n.º 18
0
 public void collectSlot1(bool noted)
 {
     if (currentOffer != null)
     {
         if (currentOffer.getSlot1() != null)
         {
             int  item      = currentOffer.getSlot1().getItemId();
             bool stackable = ItemData.forId(item).isStackable();
             if (noted)
             {
                 int notedId = ItemData.getNotedItem(item);
                 if (notedId == item)
                 {
                     // Cant be withdrawn as a note.
                     if (stackable)
                     {
                         // arrows etc
                         if (p.getInventory().getTotalFreeSlots() == 0 && !p.getInventory().hasItem(item))
                         {
                             p.getPackets().sendMessage("Your inventory is full.");
                         }
                         else
                         {
                             if (p.getInventory().addItem(item, currentOffer.getSlot1().getItemAmount()))
                             {
                                 //currentOffer.setTotalAmount(currentOffer.getTotalAmount() - currentOffer.getSlot1().getItemAmount());
                                 p.getPackets().sendMessage("This item cannot be collected as a note.");
                                 currentOffer.setSlot1(null);
                             }
                         }
                     }
                     else
                     {
                         // isnt noted... and isnt stackable, withdraw as regular items
                         for (int i = 0; i < currentOffer.getSlot1().getItemAmount(); i++)
                         {
                             if (!p.getInventory().addItem(item))
                             {
                                 break;
                             }
                             currentOffer.getSlot1().setItemAmount(currentOffer.getSlot1().getItemAmount() - 1);
                             //currentOffer.setTotalAmount(currentOffer.getTotalAmount() - 1);
                             if (currentOffer.getSlot1().getItemAmount() <= 0)
                             {
                                 currentOffer.setSlot1(null);
                                 break;
                             }
                         }
                         p.getPackets().sendMessage("This item cannot be collected as a note.");
                     }
                 }
                 else
                 {
                     // is noted
                     if (p.getInventory().getTotalFreeSlots() == 0 && !p.getInventory().hasItem(notedId))
                     {
                         p.getPackets().sendMessage("Your inventory is full.");
                     }
                     else
                     {
                         if (p.getInventory().addItem(notedId, currentOffer.getSlot1().getItemAmount()))
                         {
                             //	currentOffer.setTotalAmount(currentOffer.getTotalAmount() - currentOffer.getSlot1().getItemAmount());
                             currentOffer.setSlot1(null);
                         }
                     }
                 }
             }
             else
             {
                 // Unnoted
                 if (stackable)
                 {
                     // arrows etc
                     if (p.getInventory().getTotalFreeSlots() == 0 && !p.getInventory().hasItem(item))
                     {
                         p.getPackets().sendMessage("Your inventory is full.");
                     }
                     else
                     {
                         if (p.getInventory().addItem(item, currentOffer.getSlot1().getItemAmount()))
                         {
                             //currentOffer.setTotalAmount(currentOffer.getTotalAmount() - currentOffer.getSlot1().getItemAmount());
                             currentOffer.setSlot1(null);
                         }
                     }
                 }
                 else
                 {
                     //regular items
                     for (int i = 0; i < currentOffer.getSlot1().getItemAmount(); i++)
                     {
                         if (!p.getInventory().addItem(item))
                         {
                             break;
                         }
                         //currentOffer.setTotalAmount(currentOffer.getTotalAmount() - 1);
                         currentOffer.getSlot1().setItemAmount(currentOffer.getSlot1().getItemAmount() - 1);
                         if (currentOffer.getSlot1().getItemAmount() <= 0)
                         {
                             currentOffer.setSlot1(null);
                             break;
                         }
                     }
                 }
             }
             Item[] items = { currentOffer.getSlot1(), currentOffer.getSlot2() };
             p.getPackets().sendItems(-1, -1757, 523 + currentOffer.getSlot(), items);
             if (((currentOffer.getAmountTraded() == currentOffer.getTotalAmount()) || currentOffer.isAborted()) && currentOffer.getSlot1() == null && currentOffer.getSlot2() == null)
             {
                 if (Server.getGrandExchange().removeOffer(currentOffer))
                 {
                     resetInterface();
                     currentOffer = null;
                 }
             }
         }
     }
 }
Ejemplo n.º 19
0
        public void confirmOffer()
        {
            if (currentOffer == null)
            {
                return;
            }
            if (currentOffer is BuyOffer)
            {
                int gpAmount = currentOffer.getTotalAmount() * currentOffer.getPriceEach();
                if (currentOffer.getTotalAmount() <= 0)
                {
                    p.getPackets().sendMessage("You must choose the quantity you wish to buy!");
                    return;
                }
                else if (!p.getInventory().hasItemAmount(995, gpAmount))
                {
                    p.getPackets().sendMessage("You don't have enough coins in your inventory to cover the offer.");
                    return;
                }
                else if (!p.getInventory().deleteItem(995, gpAmount))
                {
                    return;
                }
            }
            else if (currentOffer is SellOffer)
            {
                if (currentOffer.getTotalAmount() <= 0)
                {
                    p.getPackets().sendMessage("You must choose the quantity you wish to sell!");
                    return;
                }
                else if (!p.getInventory().hasItemAmount(currentOffer.getItem(), currentOffer.getTotalAmount()))
                {
                    p.getPackets().sendMessage("You do not have enough of this item in your inventory to cover the offer.");
                    return;
                }
                if (ItemData.forId(currentOffer.getItem()).isNoted() || ItemData.forId(currentOffer.getItem()).isStackable())
                {
                    if (!p.getInventory().deleteItem(currentOffer.getItem(), currentOffer.getTotalAmount()))
                    {
                        return;
                    }
                }
                else
                {
                    //UnNoted variant of this item, so remove multiple items from inventory.
                    int i = 0;
                    for (int j = 0; j < currentOffer.getTotalAmount(); j++)
                    {
                        if (!p.getInventory().deleteItem(currentOffer.getUnNotedId()))
                        {
                            currentOffer.setTotalAmount(i);
                            p.getPackets().sendConfig(1110, currentOffer.getTotalAmount());
                            break;
                        }
                        i++;
                    }
                }
            }
            p.getPackets().sendConfig(1113, -1);
            p.getPackets().sendConfig(1112, -1);
            currentOffer.setProgress(currentOffer.getSubmittingId());
            p.getPackets().updateGEProgress(currentOffer);
            Server.getGrandExchange().addOffer(currentOffer);
            GEItem offer = currentOffer;

            currentOffer = null;
            Event updateGEProgressEvent = new Event(500);

            updateGEProgressEvent.setAction(() => {
                updateGEProgressEvent.stop();
                offer.setProgress(offer.getOrangeBarId());
                p.getPackets().updateGEProgress(offer);
            });
            Server.registerEvent(updateGEProgressEvent);
        }