Handler created for CommitToTradeMsg
This commit is contained in:
@@ -474,47 +474,6 @@ public class CharacterItemManager {
|
||||
return modifyCommitToTrade();
|
||||
}
|
||||
|
||||
public synchronized boolean commitToTrade(CommitToTradeMsg msg) {
|
||||
|
||||
PlayerCharacter source = (PlayerCharacter) this.getOwner();
|
||||
|
||||
if (source == null || !source.isAlive())
|
||||
return false;
|
||||
|
||||
|
||||
this.setTradeCommitted((byte) 1);
|
||||
|
||||
ClientConnection ccOther = this.getTradingWith();
|
||||
|
||||
if (ccOther == null)
|
||||
return false;
|
||||
|
||||
PlayerCharacter other = ccOther.getPlayerCharacter();
|
||||
|
||||
if (other == null || !other.isAlive())
|
||||
return false;
|
||||
|
||||
CharacterItemManager tradingWith = other.charItemManager;
|
||||
|
||||
if (tradingWith == null)
|
||||
return false;
|
||||
|
||||
if (!canTrade(source, other))
|
||||
return false;
|
||||
|
||||
modifyCommitToTrade();
|
||||
|
||||
if (this.getTradeCommitted() == (byte) 1 && tradingWith.getTradeCommitted() == (byte) 1) {
|
||||
int tradeID = this.tradeID;
|
||||
CloseTradeWindowMsg ctwm1 = new CloseTradeWindowMsg(source, tradeID);
|
||||
CloseTradeWindowMsg ctwm2 = new CloseTradeWindowMsg(other, tradeID);
|
||||
this.commitTrade();
|
||||
this.closeTradeWindow(ctwm1, false);
|
||||
other.charItemManager.closeTradeWindow(ctwm2, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public synchronized boolean modifyCommitToTrade() {
|
||||
CharacterItemManager man1 = this;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user