コード例 #1
0
  protected boolean processConcludeQuest(QuestClient.ConcludeMessage msg) {
    Long mobOid = msg.getMobOid();
    if (!questOid.equals(msg.getQuestOid())) return true;
    if (Log.loggingDebug)
      log.debug("processConcludeQuest: player=" + getPlayerOid() + ", mob=" + mobOid);
    ArrayList<String> templateList = new ArrayList<String>();
    for (CollectionGoalStatus goalStatus : goalsStatus) {
      for (int i = 0; i < goalStatus.getTargetCount(); i++) {
        templateList.add(goalStatus.getTemplateName());
      }
    }

    boolean conclude = false;
    if (templateList.isEmpty()) {
      conclude = true;
    } else {
      List<Long> removeResult = InventoryClient.removeItems(getPlayerOid(), templateList);
      if (removeResult != null) {
        conclude = true;
        for (Long itemOid : removeResult) {
          ObjectManagerClient.deleteObject(itemOid);
        }
      }
    }
    if (conclude) {
      setConcluded(true);
      deactivate();
      updateQuestLog();
      sendStateStatusChange();
    }
    return true;
  }
コード例 #2
0
  /** generate delivery items and give them to the player */
  protected void makeDeliveryItems() {
    Long playerOid = getPlayerOid();
    Long bagOid = playerOid;
    if (Log.loggingDebug)
      log.debug("makeDeliveryItems: playerOid " + playerOid + ", bagOid + " + bagOid);

    // Normally the persistence flag is inherited from the enclosing
    // object, but all we have are OIDs.  Assume this is only used
    // for players and players are always persistent.
    Template overrideTemplate = new Template();
    overrideTemplate.put(Namespace.OBJECT_MANAGER, ObjectManagerClient.TEMPL_PERSISTENT, true);

    for (String templateName : deliveryItems) {
      Long itemOid = ObjectManagerClient.generateObject(templateName, overrideTemplate);
      InventoryClient.addItem(bagOid, playerOid, bagOid, itemOid);
    }
  }