Ejemplo n.º 1
0
  @Override
  public void handleReceived(LlpMessage msg) {
    result = 0;
    reason = "成功";
    partnerList.clear();
    long partnerId = msg.readLong("partnerId");

    Partner partner = online.findPartner(partnerId);
    if (partner == null) {
      result = 1;
      reason = "伙伴不存在";
      return;
    }

    PartnerSendBack partnerSendBack = PartnerJson.instance().getSendBack().get(partner.getIndex());
    if (partnerSendBack != null) {
      Map<Integer, Cell> cellsMap = new HashMap<>();

      Item item = ItemJson.instance().getItem(partnerSendBack.getId());
      if (partnerSendBack.getBind() == 1) { // 使用绑定材料,物品绑定
        item.bind();
      }
      BagServer.add(online, item, partnerSendBack.getNum(), cellsMap, EItemGet.partnerOut);
      BagMessage.sendBag(online, cellsMap);
    }

    online.getPartnerMap().remove(partner.getId());
    partner.setOperateFlag(EpartnerOperate.delete);
    partnerList.add(partner);
    TipServer.costPartner(online, partner); // ======提示======
  }
Ejemplo n.º 2
0
 public PartnerSendBack stringToPartnerSendBack(String string) {
   String[] strs = string.split(":");
   PartnerSendBack p = new PartnerSendBack();
   p.setId(Translate.stringToInt(strs[0]));
   p.setNum(Translate.stringToInt(strs[1]));
   p.setBind(Translate.stringToInt(strs[2]));
   return p;
 }