mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Corrected option handling on GE interface
This commit is contained in:
parent
18d5d80fba
commit
3837bd3c26
2 changed files with 28 additions and 16 deletions
|
|
@ -112,7 +112,7 @@ public class GrandExchangeInterface extends ComponentPlugin {
|
|||
GrandExchangeOffer offer;
|
||||
GrandExchangeRecords records = GrandExchangeRecords.getInstance(player);
|
||||
if (index > -1 && (offer = records.getOffer(records.getOfferRecords()[index])) != null) {
|
||||
StockMarket.withdraw(player, offer, slot >> 1);
|
||||
StockMarket.withdraw(player, offer, slot >> 1, opcode);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class StockMarket : InterfaceListener {
|
|||
209,211 -> if (openedOffer == null){
|
||||
SystemLogger.logGE("[WARN] Player tried to withdraw item with null openedOffer!")
|
||||
return@on false
|
||||
} else withdraw(player, openedOffer, (button - 209) shr 1)
|
||||
} else withdraw(player, openedOffer, (button - 209) shr 1, op)
|
||||
190 -> confirmOffer(player, tempOffer, openedIndex).also { return@on true }
|
||||
194 -> player.interfaceManager.openChatbox(Components.OBJDIALOG_389)
|
||||
203 -> abortOffer(player, openedOffer)
|
||||
|
|
@ -342,7 +342,7 @@ class StockMarket : InterfaceListener {
|
|||
}
|
||||
|
||||
@JvmStatic
|
||||
fun withdraw(player: Player, offer: GrandExchangeOffer, index: Int)
|
||||
fun withdraw(player: Player, offer: GrandExchangeOffer, index: Int, op: Int)
|
||||
{
|
||||
val item = offer.withdraw[index]
|
||||
if(item == null)
|
||||
|
|
@ -351,20 +351,32 @@ class StockMarket : InterfaceListener {
|
|||
return
|
||||
}
|
||||
|
||||
if(hasSpaceFor(player, item))
|
||||
{
|
||||
addItem(player, item.id, item.amount)
|
||||
}
|
||||
else
|
||||
{
|
||||
when (op) {
|
||||
// withdraw notes
|
||||
155 -> {
|
||||
val note = item.noteChange
|
||||
if(note == -1 || !hasSpaceFor(player, Item(note, item.amount)))
|
||||
{
|
||||
if (note == -1) {
|
||||
sendMessage(player, "This item cannot be noted")
|
||||
return
|
||||
}
|
||||
if (hasSpaceFor(player, Item(note, item.amount))) {
|
||||
addItem(player, note, item.amount)
|
||||
} else {
|
||||
playAudio(player, Sounds.GE_TRADE_ERROR_4039)
|
||||
sendMessage(player, "You do not have enough room in your inventory.")
|
||||
return
|
||||
}
|
||||
else addItem(player, note, item.amount)
|
||||
}
|
||||
// withdraw items
|
||||
196 -> {
|
||||
if (hasSpaceFor(player, item)) {
|
||||
addItem(player, item.id, item.amount)
|
||||
} else {
|
||||
playAudio(player, Sounds.GE_TRADE_ERROR_4039)
|
||||
sendMessage(player, "You do not have enough room in your inventory.")
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
offer.withdraw[index] = null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue