Exemplo n.º 1
0
 public static void declineTrade(MapleCharacter c) {
   MapleTrade trade = c.getTrade();
   if (trade != null) {
     if (trade.getPartner() != null) {
       MapleCharacter other = trade.getPartner().getChr();
       other.getTrade().cancel();
       other.setTrade(null);
       other.message(c.getName() + " has declined your trade request.");
     }
     trade.cancel();
     c.setTrade(null);
   }
 }
Exemplo n.º 2
0
 public static void completeTrade(MapleCharacter c) {
   c.getTrade().lock();
   MapleTrade local = c.getTrade();
   MapleTrade partner = local.getPartner();
   if (partner.isLocked()) {
     local.complete1();
     partner.complete1();
     if (!local.fitsInInventory() || !partner.fitsInInventory()) {
       cancelTrade(c);
       c.message("There is not enough inventory space to complete the trade.");
       partner.getChr().message("There is not enough inventory space to complete the trade.");
       return;
     }
     if (local.getChr().getLevel() < 15) {
       if (local.getChr().getMesosTraded() + local.exchangeMeso > 1000000) {
         cancelTrade(c);
         local.getChr().getClient().getSession().write(MaplePacketCreator.sendMesoLimit());
         return;
       } else {
         local.getChr().addMesosTraded(local.exchangeMeso);
       }
     } else if (c.getTrade().getChr().getLevel() < 15) {
       if (c.getMesosTraded() + c.getTrade().exchangeMeso > 1000000) {
         cancelTrade(c);
         c.getClient().getSession().write(MaplePacketCreator.sendMesoLimit());
         return;
       } else {
         c.addMesosTraded(local.exchangeMeso);
       }
     }
     local.complete2();
     partner.complete2();
     partner.getChr().setTrade(null);
     c.setTrade(null);
   }
 }