public void abortOffer() { if (currentOffer == null) { p.getPackets().sendMessage("[abortOffer]: Nice try cheater!, If this is bug please report it."); return; } if (currentOffer.isAborted()) { return; } //Both slots appear when aborting items and money. if (currentOffer is BuyOffer) { currentOffer.setSlot1((currentOffer.getAmountItemsLeftToCollect() > 0) ? new Item(currentOffer.getItem(), currentOffer.getAmountItemsLeftToCollect()) : null); currentOffer.setSlot2((currentOffer.getTotalAmountGoldLeftToCollect() > 0) ? new Item(995, currentOffer.getTotalAmountGoldLeftToCollect()) : null); } else if (currentOffer is SellOffer) { currentOffer.setSlot1((currentOffer.getTotalAmountItemsLeftToCollect() > 0) ? new Item(currentOffer.getItem(), currentOffer.getTotalAmountItemsLeftToCollect()) : null); 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); currentOffer.setAborted(true); p.getPackets().updateGEProgress(currentOffer); Server.getGrandExchange().abortOffer(currentOffer); p.getPackets().sendMessage("Abort request acknowledged. Please be aware that your offer may have already been completed."); }
public void abortOffer() { if (currentOffer != null) { if (currentOffer.isAborted()) { return; } Item slot1 = null; Item slot2 = null; if (currentOffer is BuyOffer) { slot1 = currentOffer.getAmountTraded() == 0 ? null : new Item(currentOffer.getItem(), currentOffer.getAmountTraded()); slot2 = currentOffer.getAmountTraded() == currentOffer.getTotalAmount() ? null : new Item(995, (currentOffer.getTotalAmount() - currentOffer.getAmountTraded()) * currentOffer.getPriceEach()); } else { slot1 = currentOffer.getAmountTraded() == currentOffer.getTotalAmount() ? 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); currentOffer.setProgress(currentOffer.getAbortedBarId()); currentOffer.setAborted(true); p.getPackets().updateGEProgress(currentOffer); } }