Trade issue (#117)

* Update Game.java

Adding ShiftDropping to items with the wield option as default.

The options still have double Drop like the shiftdrop for use option as default.

* Trade issues

Resolved issues around the trading system:
1. Can't trade anymore when other player isn't close;
2. Trade interface now close when other player disconnect or click the minimap;
3. Players cant no longer store items in the trade interface;
4. Items are properly distributed after any player closes the trade interface;
5. Added a message saying 'Trade completed.' after a trade is completed;
This commit is contained in:
Gptaqbc
2019-10-27 14:45:59 -04:00
committed by Daniel Ginovker
parent 43713164cc
commit 8e874e6310
3 changed files with 35 additions and 12 deletions
@@ -2431,10 +2431,13 @@ public class ClickingButtons implements PacketType {
}
Client ot = (Client) PlayerHandler.players[player.tradeWith];
if (ot == null) {
if (ot == null || !ot.inTrade) {
player.getTrading().declineTrade();
player.getActionSender().sendMessage(
"Trade declined as the other player has disconnected.");
ot.getTrading().declineTrade();
ot.getActionSender().sendMessage(
"Trade declined as you disconnected.");
break;
}
player.getPlayerAssistant().sendFrame126(
@@ -2525,6 +2528,11 @@ public class ClickingButtons implements PacketType {
ot1.acceptedTrade = true;
player.getTrading().giveItems();
ot1.getTrading().giveItems();
//here
player.getActionSender().sendMessage(
"@red@Trade completed.");
ot1.getActionSender().sendMessage(
"@red@Trade completed.");
break;
}
ot1.getPlayerAssistant().sendFrame126(
@@ -20,8 +20,9 @@ public class ClickingStuff implements PacketType {
if(player.isShopping)
player.isShopping = false;
if (player.inTrade) {
if (!player.acceptedTrade) {
Client opponent = (Client) PlayerHandler.players[player.tradeWith];
Client opponent = (Client) PlayerHandler.players[player.tradeWith];
if (!player.acceptedTrade || !opponent.inTrade || opponent == null) {
opponent = (Client) PlayerHandler.players[player.tradeWith];
opponent.tradeAccepted = false;
player.tradeAccepted = false;
opponent.tradeStatus = 0;
@@ -32,8 +33,9 @@ public class ClickingStuff implements PacketType {
opponent.getActionSender().sendMessage("@red@Other player has declined the trade.");
Misc.println("trade reset");
player.getTrading().declineTrade();
opponent.getTrading().declineTrade();
}
}
}
if(player.openDuel && player.duelStatus >= 1 && player.duelStatus <= 4) {
Client o = (Client) PlayerHandler.players[player.duelingWith];