コード例 #1
0
  @Override
  public boolean onDialogEvent(final QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;
    DialogAction dialog = env.getDialog();
    int var = qs.getQuestVarById(0);
    int targetId = env.getTargetId();

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 798928:
          { // Yulia
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 0) {
                    return sendQuestDialog(env, 1011);
                  }
                }
              case SETPRO1:
                {
                  return defaultCloseDialog(env, 0, 1); // 1
                }
            }
            break;
          }
        case 798975:
          { // Sulla
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 1) {
                    return sendQuestDialog(env, 1352);
                  } else if (var == 6) {
                    return sendQuestDialog(env, 3057);
                  } else if (var == 9) {
                    return sendQuestDialog(env, 4080);
                  }
                }
              case SETPRO2:
                {
                  return defaultCloseDialog(env, 1, 2); // 2
                }
              case SETPRO7:
                {
                  return defaultCloseDialog(env, 6, 7); // 7
                }
              case SETPRO10:
                {
                  return defaultCloseDialog(env, 9, 10); // 10
                }
            }
            break;
          }
        case 798981:
          { // Philon
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 2) {
                    return sendQuestDialog(env, 1693);
                  }
                }
              case SETPRO3:
                {
                  return defaultCloseDialog(env, 2, 3); // 3
                }
            }
            break;
          }
        case 798513:
          { // Machiah
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 7) {
                    return sendQuestDialog(env, 3398);
                  }
                }
              case SETPRO8:
                {
                  return defaultCloseDialog(env, 7, 8); // 8
                }
            }
            break;
          }
        case 798225:
          { // Pyrrha
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 8) {
                    return sendQuestDialog(env, 3739);
                  }
                }
              case SETPRO9:
                {
                  return defaultCloseDialog(env, 8, 9); // 9
                }
            }
            break;
          }
        case 798979:
          { // Gelon
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 10) {
                    return sendQuestDialog(env, 1608);
                  }
                }
              case SETPRO11:
                {
                  return defaultCloseDialog(env, 10, 11); // 11
                }
            }
            break;
          }
        case 798990:
          { // Titus
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 11) {
                    return sendQuestDialog(env, 1949);
                  }
                }
              case SETPRO12:
                {
                  return defaultCloseDialog(env, 11, 12, 182206613, 1, 0, 0); // 12
                }
            }
            break;
          }
        case 730295:
          { // Drakan Stone Statue
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 12) {
                    return sendQuestDialog(env, 3995);
                  }
                }
              case SETPRO13:
                {
                  if (var == 12) {
                    if (player.getInventory().getItemCountByItemId(182206613) > 0) {
                      removeQuestItem(env, 182206613, 1);
                      WorldMapInstance newInstance =
                          InstanceService.getNextAvailableInstance(300160000);
                      InstanceService.registerPlayerWithInstance(newInstance, player);
                      TeleportService2.teleportTo(
                          player,
                          300160000,
                          newInstance.getInstanceId(),
                          744.761f,
                          940.3738f,
                          149.28333f,
                          (byte) 91);
                      return true;
                    } else return sendQuestDialog(env, 10001);
                  }
                }
            }
            break;
          }
        case 730229:
          { // Traveller's Bag
            if (dialog == DialogAction.USE_OBJECT) {
              if (var == 15) {
                return true; // loot
              }
            }
            break;
          }
        case 730226:
          { // Western Petrified Mass
            if (var == 3 && dialog == DialogAction.USE_OBJECT) {
              return useQuestObject(env, 3, 4, false, 0); // 4
            }
            break;
          }
        case 730227:
          { // Eastern Petrified Mass
            if (var == 4 && dialog == DialogAction.USE_OBJECT) {
              return useQuestObject(env, 4, 5, false, 0); // 5
            }
            break;
          }
        case 730228:
          { // Southern Petrified Mass
            if (var == 5 && dialog == DialogAction.USE_OBJECT) {
              return useQuestObject(env, 5, 6, false, 0); // 6
            }
            break;
          }
        case 700604:
          { // Hidden Switch
            if (var == 13 && dialog == DialogAction.USE_OBJECT) {
              return useQuestObject(env, 13, 14, false, 0); // 14
            }
            break;
          }
        case 700603:
          { // Hidden Library Exit
            if (var == 16 && dialog == DialogAction.USE_OBJECT) {
              TeleportService2.teleportTo(
                  player, 210050000, 349.332f, 1368.0781f, 336.43332f, (byte) 100);
              return true;
            }
            break;
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798928) { // Yulia
        if (env.getDialog() == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 10002);
        } else {
          return sendQuestEndDialog(env);
        }
      }
    }
    return false;
  }
コード例 #2
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) {
      return false;
    }
    int var = qs.getQuestVars().getQuestVars();
    int targetId = env.getTargetId();
    DialogAction dialog = env.getDialog();

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 204182:
          { // Heimdall
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 0) {
                    return sendQuestDialog(env, 1011);
                  }
                }
              case SETPRO1:
                {
                  return defaultCloseDialog(env, 0, 1); // 1
                }
            }
            break;
          }
        case 203550:
          { // Munin
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 1) {
                    return sendQuestDialog(env, 1352);
                  } else if (var == 10) {
                    return sendQuestDialog(env, 4080);
                  }
                }
              case SETPRO2:
                {
                  return defaultCloseDialog(env, 1, 2); // 2
                }
              case SETPRO10:
                {
                  return defaultCloseDialog(env, 10, 10, true, false); // reward
                }
            }
            break;
          }
        case 790003:
          { // Urd
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 2) {
                    return sendQuestDialog(env, 1693);
                  }
                }
              case SETPRO3:
                {
                  return defaultCloseDialog(env, 2, 3); // 3
                }
            }
            break;
          }
        case 790002:
          { // Verdandi
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 3) {
                    return sendQuestDialog(env, 2034);
                  }
                }
              case SETPRO4:
                {
                  return defaultCloseDialog(env, 3, 4); // 4
                }
            }
            break;
          }
        case 203546:
          { // Skuld
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 4) {
                    return sendQuestDialog(env, 2375);
                  } else if (var == 9) {
                    return sendQuestDialog(env, 3739);
                  }
                }
              case SETPRO5:
                {
                  if (var == 4) {
                    changeQuestStep(env, 4, 95, false); // 95
                    WorldMapInstance newInstance =
                        InstanceService.getNextAvailableInstance(320070000);
                    InstanceService.registerPlayerWithInstance(newInstance, player);
                    TeleportService2.teleportTo(
                        player,
                        320070000,
                        newInstance.getInstanceId(),
                        268.47397f,
                        251.80275f,
                        125.8369f);
                    return closeDialogWindow(env);
                  }
                }
              case SETPRO9:
                {
                  changeQuestStep(env, 9, 10, false); // 10
                  TeleportService2.teleportTo(player, 220010000, 1, 383.0f, 1896.0f, 327.625f);
                  return closeDialogWindow(env);
                }
            }
            break;
          }
        case 204264:
          { // Skuld 2
            switch (dialog) {
              case USE_OBJECT:
                {
                  if (var == 99 && !isStigmaEquipped(env)) {
                    return sendQuestDialog(env, 3057);
                  }
                }
              case QUEST_SELECT:
                {
                  if (var == 95) {
                    return sendQuestDialog(env, 2716);
                  } else if (var == 96) {
                    return sendQuestDialog(env, 3057);
                  } else if (var == 97) {
                    return sendQuestDialog(env, 3398);
                  }
                }
              case SETPRO6:
                {
                  if (var == 95) {
                    playQuestMovie(env, 156);
                    return closeDialogWindow(env);
                  }
                }
              case SELECT_ACTION_3058:
                {
                  if (var == 96) {
                    if (giveQuestItem(env, getStoneId(player), 1) && !isStigmaEquipped(env)) {
                      long existendStigmaShards =
                          player.getInventory().getItemCountByItemId(141000001);
                      if (existendStigmaShards < 60) {
                        if (!player.getInventory().isFull()) {
                          ItemService.addItem(player, 141000001, 60 - existendStigmaShards);
                          changeQuestStep(env, 96, 99, false); // 99
                          return sendQuestDialog(env, 3058);
                        } else {
                          return closeDialogWindow(env);
                        }
                      } else {
                        changeQuestStep(env, 96, 99, false); // 99
                        return sendQuestDialog(env, 3058);
                      }
                    } else {
                      return closeDialogWindow(env);
                    }
                  } else if (var == 99) {
                    return sendQuestDialog(env, 3058);
                  }
                }
              case SETPRO7:
                {
                  if (var == 99) {
                    PacketSendUtility.sendPacket(
                        player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 1));
                    return true;
                  }
                }
              case SETPRO8:
                {
                  if (var == 97) {
                    changeQuestStep(env, 97, 98, false); // 98
                    QuestService.addNewSpawn(
                        320070000, player.getInstanceId(), 204263, 257.5f, 245f, 125f, (byte) 0);
                    return closeDialogWindow(env);
                  }
                }
            }
            break;
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204061) { // Aud
        return sendQuestEndDialog(env);
      }
    }
    return false;
  }