예제 #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); // ======提示======
  }
예제 #2
0
  /** 血战发奖 */
  public void sendWard() {

    long hongMark = BloodServer.getHongMark();
    long lanMark = BloodServer.getLanMark();
    List<Long> hongRest = new ArrayList<>();
    for (Long rid : hong) {
      Blood blood = bloodMap.get(rid);
      if (blood.getMark() > 4) {
        hongRest.add(rid);
      }
    }
    List<Long> lanRest = new ArrayList<>();
    for (Long rid : lan) {
      Blood blood = bloodMap.get(rid);
      if (blood.getMark() > 4) {
        lanRest.add(rid);
      }
    }

    if (lanMark == hongMark) {
      String content = StringControl.yel("血战圆满结束, 双方平局");
      BulletinManager.instance().addBulletinRock(content, 1);
    }
    sort(lanRest);
    sort(hongRest);
    // 蓝色发奖励
    for (int i = 0; i < lanRest.size(); i++) {
      Map<Item, Integer> itemIds = new HashMap<Item, Integer>();
      Item itemBlue = ItemJson.instance().getItem(21043);
      Item itemGreen = ItemJson.instance().getItem(21042);

      if (i == 0) {
        if (lanMark > hongMark) {
          itemIds.put(itemBlue, 5);
          MailServer.send(
              lanRest.get(i),
              "血战奖励",
              "再刚刚结束的血战中,您勇冠三军,获得了以下奖励,请您查收,希望您再接再厉,再创辉煌~!",
              itemIds,
              0,
              0,
              0,
              0,
              null);
          String content =
              StringControl.yel(
                  "血战圆满结束,"
                      + StringControl.grn(bloodMap.get(lanRest.get(i)).getNick())
                      + "是本次血战胜方积分榜第一名");
          BulletinManager.instance().addBulletinRock(content, 1);
        } else {
          itemIds.put(itemBlue, 4);
          MailServer.send(
              lanRest.get(i), "血战基础奖励", "参与血战活动并取得了本阵营的第一名,恭喜您。", itemIds, 0, 0, 0, 0, null);
        }

      } else if (i == 1) {
        if (lanMark > hongMark) {
          itemIds.put(itemBlue, 4);
          MailServer.send(
              lanRest.get(i),
              "血战奖励",
              "再刚刚结束的血战中,您勇冠三军,获得了以下奖励,请您查收,希望您再接再厉,再创辉煌~!",
              itemIds,
              0,
              0,
              0,
              0,
              null);
        } else {
          itemIds.put(itemBlue, 3);
          MailServer.send(
              lanRest.get(i), "血战基础奖励", "参与血战活动并取得了本阵营的第二名,恭喜您。", itemIds, 0, 0, 0, 0, null);
        }
      } else if (i == 2) {
        if (lanMark > hongMark) {
          itemIds.put(itemBlue, 3);
          MailServer.send(
              lanRest.get(i),
              "血战奖励",
              "再刚刚结束的血战中,您勇冠三军,获得了以下奖励,请您查收,希望您再接再厉,再创辉煌~!",
              itemIds,
              0,
              0,
              0,
              0,
              null);
        } else {
          itemIds.put(itemBlue, 2);
          MailServer.send(
              lanRest.get(i), "血战基础奖励", "参与血战活动并取得了本阵营的第三名,恭喜您。", itemIds, 0, 0, 0, 0, null);
        }
      } else if (i <= 9 && i >= 3) {
        if (lanMark > hongMark) {
          itemIds.put(itemBlue, 2);
          MailServer.send(
              lanRest.get(i),
              "血战奖励",
              "再刚刚结束的血战中,您勇冠三军,获得了以下奖励,请您查收,希望您再接再厉,再创辉煌~!",
              itemIds,
              0,
              0,
              0,
              0,
              null);
        } else {
          itemIds.put(itemBlue, 1);
          MailServer.send(
              lanRest.get(i), "血战基础奖励", "参与血战活动并取得了本阵营的前十名,恭喜您。", itemIds, 0, 0, 0, 0, null);
        }
      } else {
        if (lanMark > hongMark) {
          itemIds.put(itemBlue, 1);
          itemIds.put(itemGreen, 1);
          MailServer.send(
              lanRest.get(i),
              "血战奖励",
              "再刚刚结束的血战中,您勇冠三军,获得了以下奖励,请您查收,希望您再接再厉,再创辉煌~!",
              itemIds,
              0,
              0,
              0,
              0,
              null);
        } else {
          itemIds.put(itemGreen, 1);
          MailServer.send(
              lanRest.get(i), "血战基础奖励", "参与血战活动并获得了好成绩,恭喜您。", itemIds, 0, 0, 0, 0, null);
        }
      }
    }
    // 红色发奖励
    for (int i = 0; i < hongRest.size(); i++) {
      Map<Item, Integer> itemIds = new HashMap<Item, Integer>();
      Item itemBlue = ItemJson.instance().getItem(21043);
      Item itemGreen = ItemJson.instance().getItem(21042);
      if (i == 0) {
        if (hongMark > lanMark) {
          itemIds.put(itemBlue, 5);
          MailServer.send(
              hongRest.get(i),
              "血战奖励",
              "再刚刚结束的血战中,您勇冠三军,获得了以下奖励,请您查收,希望您再接再厉,再创辉煌~!",
              itemIds,
              0,
              0,
              0,
              0,
              null);
          String content =
              StringControl.yel(
                  "血战圆满结束,"
                      + StringControl.grn(bloodMap.get(hongRest.get(i)).getNick())
                      + "是本次血战胜方积分榜第一名");
          BulletinManager.instance().addBulletinRock(content, 1);
        } else {
          itemIds.put(itemBlue, 4);
          MailServer.send(
              hongRest.get(i), "血战基础奖励", "参与血战活动并取得了本阵营的第一名,恭喜您。", itemIds, 0, 0, 0, 0, null);
        }
      } else if (i == 1) {
        if (hongMark > lanMark) {
          itemIds.put(itemBlue, 4);
          MailServer.send(
              hongRest.get(i),
              "血战奖励",
              "再刚刚结束的血战中,您勇冠三军,获得了以下奖励,请您查收,希望您再接再厉,再创辉煌~!",
              itemIds,
              0,
              0,
              0,
              0,
              null);
        } else {
          itemIds.put(itemBlue, 3);
          MailServer.send(
              hongRest.get(i), "血战基础奖励", "参与血战活动并取得了本阵营的第二名,恭喜您。", itemIds, 0, 0, 0, 0, null);
        }
      } else if (i == 2) {
        if (hongMark > lanMark) {
          itemIds.put(itemBlue, 3);
          MailServer.send(
              hongRest.get(i),
              "血战奖励",
              "再刚刚结束的血战中,您勇冠三军,获得了以下奖励,请您查收,希望您再接再厉,再创辉煌~!",
              itemIds,
              0,
              0,
              0,
              0,
              null);
        } else {
          itemIds.put(itemBlue, 2);
          MailServer.send(
              hongRest.get(i), "血战基础奖励", "参与血战活动并取得了本阵营的第三名,恭喜您。", itemIds, 0, 0, 0, 0, null);
        }
      } else if (i <= 9 && i >= 3) {
        if (hongMark > lanMark) {
          itemIds.put(itemBlue, 2);
          MailServer.send(
              hongRest.get(i),
              "血战奖励",
              "再刚刚结束的血战中,您勇冠三军,获得了以下奖励,请您查收,希望您再接再厉,再创辉煌~!",
              itemIds,
              0,
              0,
              0,
              0,
              null);
        } else {
          itemIds.put(itemBlue, 1);
          MailServer.send(
              hongRest.get(i), "血战基础奖励", "参与血战活动并取得了本阵营的前十名,恭喜您。", itemIds, 0, 0, 0, 0, null);
        }
      } else {
        if (hongMark > lanMark) {
          itemIds.put(itemBlue, 1);
          itemIds.put(itemGreen, 1);
          MailServer.send(
              hongRest.get(i),
              "血战奖励",
              "再刚刚结束的血战中,您勇冠三军,获得了以下奖励,请您查收,希望您再接再厉,再创辉煌~!",
              itemIds,
              0,
              0,
              0,
              0,
              null);
        } else {
          itemIds.put(itemGreen, 1);
          MailServer.send(
              hongRest.get(i), "血战基础奖励", "参与血战活动并获得了好成绩,恭喜您。", itemIds, 0, 0, 0, 0, null);
        }
      }
    }
  }