コード例 #1
0
 public void chat(String message) {
   chr.getClient().getSession().write(MaplePacketCreator.getTradeChat(chr, message, true));
   if (partner != null) {
     partner
         .getChr()
         .getClient()
         .getSession()
         .write(MaplePacketCreator.getTradeChat(chr, message, false));
   }
 }
コード例 #2
0
 public void addItem(IItem item) {
   items.add(item);
   chr.getClient().getSession().write(MaplePacketCreator.getTradeItemAdd((byte) 0, item));
   if (partner != null) {
     partner
         .getChr()
         .getClient()
         .getSession()
         .write(MaplePacketCreator.getTradeItemAdd((byte) 1, item));
   }
 }
コード例 #3
0
 public void setMeso(int meso) {
   if (locked) {
     throw new RuntimeException("Trade is locked.");
   }
   if (meso < 0) {
     System.out.println("[h4x] " + chr.getName() + " Trying to trade < 0 mesos");
     return;
   }
   if (chr.getMeso() >= meso) {
     chr.gainMeso(-meso, false, true, false);
     this.meso += meso;
     chr.getClient().getSession().write(MaplePacketCreator.getTradeMesoSet((byte) 0, this.meso));
     if (partner != null) {
       partner
           .getChr()
           .getClient()
           .getSession()
           .write(MaplePacketCreator.getTradeMesoSet((byte) 1, this.meso));
     }
   } else {
   }
 }
コード例 #4
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);
   }
 }
コード例 #5
0
 private void lock() {
   locked = true;
   partner.getChr().getClient().getSession().write(MaplePacketCreator.getTradeConfirmation());
 }