Ejemplo n.º 1
0
  public void generateTask() {
    if (hasTask() && !c.needsNewTask) {
      // c.getDH().sendDialogues(103, 1597);
      return;
    }
    if (hasTask() && c.needsNewTask) {
      int difficulty = getDifficulty(slayerTask);
      if (difficulty == EASY_TASK) {
        // c.getDH().sendDialogues(105, 1597);
        c.needsNewTask = false;
        return;
      }
    }
    int taskLevel = getSlayerDifficulty();

    for (Task slayerTask : Task.values()) {
      if (slayerTask.getDifficulty() == taskLevel) {
        if (c.playerLevel[18] >= slayerTask.getLevelReq()) {
          resizeTable(taskLevel);
          if (!c.needsNewTask) {
            int task = getRandomTask(taskLevel);
            for (int i = 0; i < c.removedTasks.length; i++) {
              if (task == c.removedTasks[i]) {
                c.sendMessage("Unavailable task: " + task);
                generateTask();
                return;
              }
            }
            this.slayerTask = task;
            taskAmount = getTaskAmount(taskLevel);
          } else {
            int task = getRandomTask(getDifficulty(taskLevel - 1));
            for (int i = 0; i < c.removedTasks.length; i++) {
              if (task == c.removedTasks[i]) {
                c.sendMessage("Unavailable task: " + task);
                generateTask();
                return;
              }
            }
            this.slayerTask = task;
            taskAmount = getTaskAmount(getDifficulty(this.slayerTask) - 1);
            c.needsNewTask = false;
          }
          // c.getDH().sendDialogues(102, 1597);
          c.sendMessage(
              "You have been assigned "
                  + taskAmount
                  + " "
                  + Misc.optimizeText(getTaskName(this.slayerTask))
                  + "'s, Good luck "
                  + c.playerName
                  + ".");
          return;
        }
      }
    }
  }
Ejemplo n.º 2
0
 public void process() {
   if (slayerTask == 0) {
     c.getPA().sendFrame126("@or2@  - Task: @gre@Empty ", 29174);
   } else if (slayerTask > 0) {
     c.getPA()
         .sendFrame126(
             "@or2@  - Task: @gre@"
                 + taskAmount
                 + " "
                 + Misc.optimizeText(getTaskName(slayerTask))
                 + "'s ",
             29174);
   }
 }