@Override
  public boolean onLvlUpEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    boolean lvlCheck =
        QuestService.checkLevelRequirement(questId, player.getCommonData().getLevel());
    if (qs != null || !lvlCheck) return false;

    env.setQuestId(questId);
    QuestService.startQuest(env, QuestStatus.START);
    return true;
  }
예제 #2
0
 private void spawnHesibanata(Player player) {
   Npc spawn =
       (Npc)
           QuestService.spawnQuestNpc(
               300330000, player.getInstanceId(), 218890, 250.970f, 221.711f, 124.942f, (byte) 0);
   spawn.getAggroList().addHate(player, 1);
 }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;

    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    if (targetId != 204301) return false;
    if (qs.getStatus() == QuestStatus.START) {
      if (env.getDialogId() == 25) {
        qs.setQuestVar(1);
        qs.setStatus(QuestStatus.REWARD);
        updateQuestStatus(player, qs);
        return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
      } else return defaultQuestStartDialog(env);
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (env.getDialogId() == 17) {
        int[] ids = {2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042};
        for (int id : ids) {
          QuestService.startQuest(
              new QuestEnv(env.getVisibleObject(), env.getPlayer(), id, env.getDialogId()),
              QuestStatus.LOCKED);
        }
      }
      return defaultQuestEndDialog(env);
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    DialogAction dialog = env.getDialog();
    int targetId = env.getTargetId();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 0) {
        if (dialog == DialogAction.QUEST_ACCEPT_1) {
          QuestService.startQuest(env);
          return closeDialogWindow(env);
        }
      } else if (targetId == 700009) {
        return giveQuestItem(env, 182200559, 1);
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      if (targetId == 203098) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 2375);
        } else if (dialog == DialogAction.SELECT_QUEST_REWARD) {
          removeQuestItem(env, 182213168, 1);
          return defaultCloseDialog(env, 0, 1, true, true);
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203098) {
        return sendQuestEndDialog(env);
      }
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    if (targetId == 0) {
      if (env.getDialogId() == 1002) {
        QuestService.startQuest(env, QuestStatus.START);
        PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
        return true;
      }
    } else if (targetId == 203075) {
      if (qs != null) {
        if (env.getDialogId() == 25 && qs.getStatus() == QuestStatus.START) {
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
        } else if (env.getDialogId() == 1009) {
          player.getInventory().removeFromBagByItemId(182200501, 1);
          qs.setQuestVar(1);
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(player, qs);
          return defaultQuestEndDialog(env);
        } else return defaultQuestEndDialog(env);
      }
    }
    return false;
  }
예제 #6
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    DialogAction dialog = env.getDialog();
    int targetId = env.getTargetId();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 0) {
        if (dialog == DialogAction.QUEST_ACCEPT_1) {
          removeQuestItem(env, 182206844, 1);
          QuestService.startQuest(env);
          return closeDialogWindow(env);
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 799049) {
        if (dialog == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 10002);
        } else if (dialog == DialogAction.SELECT_ACTION_2034) {
          return sendQuestDialog(env, 2034);
        } else if (dialog == DialogAction.SELECT_QUEST_REWARD) {
          if (player.getInventory().getKinah() >= 20000000) {
            player.getInventory().decreaseKinah(20000000);
            return sendQuestDialog(env, 5);
          } else return sendQuestDialog(env, 3739);
        } else return sendQuestEndDialog(env);
      }
    }
    return false;
  }
예제 #7
0
 @Override
 public boolean onDialogEvent(QuestEnv env) {
   QuestState qs = env.getPlayer().getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getStatus() == QuestStatus.NONE) {
     if (env.getTargetId() == 203621) {
       switch (env.getDialog()) {
         case QUEST_SELECT:
           return sendQuestDialog(env, 1011);
         case ASK_QUEST_ACCEPT:
           return sendQuestDialog(env, 4);
         case QUEST_ACCEPT_1:
           return sendQuestDialog(env, 1003);
         case QUEST_REFUSE_1:
           return sendQuestDialog(env, 1004);
         case SETPRO1:
           if (QuestService.startQuest(env)) {
             QuestService.questTimerStart(env, 1800);
             return true;
           } else return false;
       }
     }
   }
   if (qs == null) return false;
   int var = qs.getQuestVarById(0);
   if (qs.getStatus() == QuestStatus.START) {
     if (env.getTargetId() == 203621) {
       switch (env.getDialog()) {
         case QUEST_SELECT:
           if (var == 0) return sendQuestDialog(env, 2375);
         case CHECK_USER_HAS_QUEST_ITEM:
           if (var == 0) {
             if (QuestService.collectItemCheck(env, true)) {
               qs.setStatus(QuestStatus.REWARD);
               updateQuestStatus(env);
               QuestService.questTimerEnd(env);
               return sendQuestDialog(env, 5);
             } else return sendQuestDialog(env, 2716);
           }
       }
     }
   }
   return sendQuestRewardDialog(env, 203621, 0);
 }
 @Override
 public boolean onEnterZoneEvent(QuestEnv env, ZoneName zoneName) {
   if (zoneName != ZoneName.MORHEIM_ICE_FORTRESS_220020000) return false;
   final Player player = env.getPlayer();
   final QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null) return false;
   env.setQuestId(questId);
   QuestService.startQuest(env, QuestStatus.START);
   return true;
 }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;

    int var = qs.getQuestVarById(0);
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();

    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204501) return defaultQuestEndDialog(env);
    } else if (qs.getStatus() != QuestStatus.START) {
      return false;
    }
    if (targetId == 204020) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 0) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
        case 10000:
          if (var == 0) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(player, qs);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    } else if (targetId == 204501) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 1) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
          else if (var == 2)
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1693);
        case 33:
          if (QuestService.collectItemCheck(env, true)) {
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(player, qs);
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 5);
          } else return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 10001);
        case 1353:
          PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 191));
          break;
        case 10001:
          if (var == 1) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(player, qs);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    }
    return false;
  }
예제 #10
0
 @Override
 public boolean onMovieEndEvent(QuestEnv env, int movieId) {
   if (movieId != 2) return false;
   Player player = env.getPlayer();
   if (player.getCommonData().getRace() != Race.ASMODIANS) return false;
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getStatus() != QuestStatus.START) return false;
   qs.setStatus(QuestStatus.REWARD);
   QuestService.finishQuest(env);
   return true;
 }
 @Override
 public boolean onLvlUpEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   boolean lvlCheck =
       QuestService.checkLevelRequirement(questId, player.getCommonData().getLevel());
   if (qs == null || !lvlCheck || qs.getStatus() != QuestStatus.LOCKED) return false;
   qs.setStatus(QuestStatus.START);
   updateQuestStatus(player, qs);
   return true;
 }
예제 #12
0
 @Override
 public boolean onQuestTimerEndEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null && qs.getStatus() == QuestStatus.START) {
     removeQuestItem(env, 182204426, 1);
     QuestService.abandonQuest(player, questId);
     player.getController().updateNearbyQuests();
     return true;
   }
   return false;
 }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    DialogAction dialog = env.getDialog();
    int targetId = env.getTargetId();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 799546) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 1011);
        } else {
          return sendQuestStartDialog(env);
        }
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      int var = qs.getQuestVarById(0);
      switch (targetId) {
        case 204108:
          {
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 0) {
                    return sendQuestDialog(env, 1352);
                  } else if (var == 1) {
                    return sendQuestDialog(env, 2375);
                  }
                }
              case SETPRO1:
                {
                  return defaultCloseDialog(env, 0, 1);
                }
              case CHECK_USER_HAS_QUEST_ITEM_SIMPLE:
                {
                  if (QuestService.collectItemCheck(env, true)) {
                    changeQuestStep(env, 1, 1, true);
                    return sendQuestDialog(env, 5);
                  } else {
                    return closeDialogWindow(env);
                  }
                }
            }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204108) {
        return sendQuestEndDialog(env);
      }
    }
    return false;
  }
예제 #14
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    if (targetId == 0) {
      if (env.getDialogId() == 1002) {
        QuestService.startQuest(env, QuestStatus.START);
        PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
        return true;
      }
    } else if (targetId == 278039) {
      if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
        if (env.getDialogId() == 25)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
        else if (env.getDialogId() == 10000) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          updateQuestStatus(player, qs);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
        } else return defaultQuestStartDialog(env);
      }
    } else if (targetId == 279027) {
      if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) {
        if (env.getDialogId() == 25)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1693);
        else if (env.getDialogId() == 10001) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          updateQuestStatus(player, qs);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
        } else return defaultQuestStartDialog(env);
      }
    } else if (targetId == 798317) {
      if (qs != null) {
        if (env.getDialogId() == 25 && qs.getStatus() == QuestStatus.START) {
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
        } else if (env.getDialogId() == 1009) {
          ItemService.removeItemFromInventoryByItemId(player, 182207048);
          qs.setQuestVar(1);
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(player, qs);
          return defaultQuestEndDialog(env);
        } else return defaultQuestEndDialog(env);
      }
    }
    return false;
  }
예제 #15
0
  @Override
  public HandlerResult onItemUseEvent(final QuestEnv env, Item item) {

    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs != null && qs.getStatus() == QuestStatus.START) {
      if (player.isInsideZone(ZoneName.get("BERITRAS_WEAPON_220040000"))) {
        QuestService.questTimerStart(env, 300);
        return HandlerResult.fromBoolean(useQuestItem(env, item, 0, 1, false, 182204426, 1, 0));
      }
    }
    return HandlerResult.SUCCESS; // ??
  }
 @Override
 public boolean onEnterZoneEvent(QuestEnv env, ZoneName zoneName) {
   if (zoneName == ZoneName.get("SLEEPING_ELDERS_PLATEAU_600060000")) {
     Player player = env.getPlayer();
     if (player == null) return false;
     QuestState qs = player.getQuestStateList().getQuestState(questId);
     if (qs == null || qs.getStatus() == QuestStatus.NONE || qs.canRepeat()) {
       QuestService.startQuest(env);
       PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
       return true;
     }
   }
   return false;
 }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();

    QuestState qs = player.getQuestStateList().getQuestState(questId);

    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) {
      targetId = ((Npc) env.getVisibleObject()).getNpcId();
    }

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 798452) { // Darfen
        if (env.getDialog() == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 1011);
        } else {
          return sendQuestStartDialog(env);
        }
      }
    }

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 798452:
          { // Darfen
            switch (env.getDialog()) {
              case QUEST_SELECT:
                {
                  return sendQuestDialog(env, 2375);
                }
              case CHECK_USER_HAS_QUEST_ITEM:
                {
                  if (QuestService.collectItemCheck(env, true)) {
                    changeQuestStep(env, 0, 0, true);
                    return sendQuestDialog(env, 5);
                  } else {
                    return sendQuestDialog(env, 2716);
                  }
                }
            }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798452) { // Darfen
        return sendQuestEndDialog(env);
      }
    }
    return false;
  }
예제 #18
0
 @Override
 public boolean onEnterWorldEvent(QuestEnv env) {
   Player player = env.getPlayer();
   if (player.getCommonData().getRace() != Race.ASMODIANS) return false;
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null) {
     env.setQuestId(questId);
     QuestService.startQuest(env);
   }
   qs = player.getQuestStateList().getQuestState(questId);
   if (qs.getStatus() == QuestStatus.START) {
     PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(1, 2));
     return true;
   }
   return false;
 }
예제 #19
0
 private void spawn(Player player) {
   int mobToSpawn = mobs.get(Rnd.get(0, 3));
   float x = 0;
   float y = 0;
   final float z = 124.942f;
   switch (mobToSpawn) {
     case 218760:
       {
         x = 250.081f;
         y = 268.308f;
         break;
       }
     case 218762:
       {
         x = 273.354f;
         y = 244.489f;
         break;
       }
     case 218761:
       {
         x = 272.994f;
         y = 244.674f;
         break;
       }
     case 218763:
       {
         x = 250.800f;
         y = 222.782f;
         break;
       }
   }
   Npc spawn =
       (Npc)
           QuestService.spawnQuestNpc(
               300330000, player.getInstanceId(), mobToSpawn, x, y, z, (byte) 0);
   Collection<Npc> allNpcs = World.getInstance().getNpcs();
   Npc target = null;
   for (Npc npc : allNpcs) {
     if (npc.getNpcId() == 730493) {
       target = npc;
     }
   }
   if (target != null) {
     spawn.getAggroList().addHate(target, 1);
   }
 }
 @Override
 public boolean onEnterWorldEvent(QuestEnv env) {
   Player player = env.getPlayer();
   if (player.getWorldId() == 400010000) {
     PlayerClass playerClass = player.getCommonData().getPlayerClass();
     if (playerClass == PlayerClass.RIDER) {
       return false;
     }
     QuestState qs = player.getQuestStateList().getQuestState(questId);
     if (qs == null) {
       env.setQuestId(questId);
       if (QuestService.startQuest(env)) {
         return true;
       }
     }
   }
   return false;
 }
 @Override
 public boolean onDialogEvent(QuestEnv env) {
   final Player player = env.getPlayer();
   int targetId = 0;
   if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
   final QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getStatus() == QuestStatus.NONE) {
     if (targetId == 730000) {
       env.setQuestId(questId);
       QuestService.startQuest(env, QuestStatus.START);
       sendQuestDialog(player, 0, 1011);
       return false;
     }
   } else if (qs.getStatus() == QuestStatus.START) {
     if (targetId == 700033 && env.getDialogId() == -1) {
       final int targetObjectId = env.getVisibleObject().getObjectId();
       PacketSendUtility.broadcastPacket(
           player, new SM_EMOTION(player, EmotionType.SIT, 0, targetObjectId), true);
       ThreadPoolManager.getInstance()
           .schedule(
               new Runnable() {
                 @Override
                 public void run() {
                   if (!player.isTargeting(targetObjectId)) return;
                   if (ItemService.addItems(
                       player, Collections.singletonList(new QuestItems(182200504, 1)))) {
                     ((Npc) player.getTarget()).getController().onDespawn(true);
                     qs.setStatus(QuestStatus.REWARD);
                     updateQuestStatus(player, qs);
                   }
                 }
               },
               3000);
     }
   } else if (qs.getStatus() == QuestStatus.REWARD) {
     if (targetId == 730000) {
       if (ItemService.removeItemFromInventoryByItemId(player, 182200504)) {
         PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 16));
         return true;
       }
     }
   }
   return false;
 }
예제 #22
0
 @Override
 public boolean onKillEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   int targetId = env.getTargetId();
   if (qs != null && qs.getStatus() == QuestStatus.START) {
     switch (targetId) {
       case 286904:
       case 281419:
       case 215795:
         {
           if (QuestService.collectItemCheck(env, true)) {
             return giveQuestItem(env, 182213290, 1);
           }
         }
     }
   }
   return false;
 }
  @Override
  public boolean onKillEvent(final QuestEnv env) {
    final Player player = env.getPlayer();
    final int instanceId = player.getInstanceId();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null || qs.getStatus() != QuestStatus.START) return false;

    final Npc npc = (Npc) env.getVisibleObject();

    switch (env.getTargetId()) {
      case 216531:
        if (qs.getQuestVarById(0) == 14 || qs.getQuestVarById(0) == 15) {
          QuestService.addNewSpawn(
              300160000, instanceId, 730229, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading());
          qs.setQuestVarById(0, 15);
          updateQuestStatus(env);
          return true;
        }
    }
    return false;
  }
예제 #24
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    DialogAction dialog = env.getDialog();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 204801) {
        if (dialog == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 4762);
        else if (dialog == DialogAction.QUEST_ACCEPT_1) {
          if (!giveQuestItem(env, 182204425, 1)) return true;
          return sendQuestStartDialog(env);
        } else return sendQuestStartDialog(env);
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      int var = qs.getQuestVarById(0);
      if (targetId == 204801) {
        switch (dialog) {
          case QUEST_SELECT:
            if (var == 1) {
              qs.setStatus(QuestStatus.REWARD);
              updateQuestStatus(env);
              return sendQuestDialog(env, 1352);
            }
          case SELECT_QUEST_REWARD:
            {
              QuestService.questTimerEnd(env);
              return sendQuestDialog(env, 5);
            }
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204801) {
        return sendQuestEndDialog(env);
      }
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    if (sendQuestNoneDialog(env, 798959, 4762)) {
      return true;
    }

    final Player player = env.getPlayer();

    QuestState qs = env.getPlayer().getQuestStateList().getQuestState(questId);
    if (qs == null) {
      return false;
    }
    int var = qs.getQuestVarById(0);
    if (qs.getStatus() == QuestStatus.REWARD) {
      if (env.getTargetId() == 798959) {
        if (env.getDialog() == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 10002);
        } else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()) {
          return sendQuestDialog(env, 5);
        } else {
          return sendQuestEndDialog(env);
        }
      }
      return false;
    }
    if (qs.getStatus() == QuestStatus.START) {
      switch (env.getTargetId()) {
        case 798959:
          switch (env.getDialog()) {
            case QUEST_SELECT:
              if (var == 0) {
                return sendQuestDialog(env, 1011);
              } else if (var == 1) {
                return sendQuestDialog(env, 1352);
              }
            case CHECK_USER_HAS_QUEST_ITEM:
              if (var == 0) {
                if (QuestService.collectItemCheck(env, true)) {
                  qs.setQuestVarById(0, var + 1);
                  updateQuestStatus(env);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                  return true;
                } else {
                  return sendQuestDialog(env, 10001);
                }
              }
            case SETPRO2:
              if (var == 1) {
                if (!giveQuestItem(env, 182206726, 1)) {
                  return true;
                }
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(env);
              }
              return true;
          }
      }
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    int targetId = 0;
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (env.getVisibleObject() instanceof Npc) {
      targetId = ((Npc) env.getVisibleObject()).getNpcId();
    }
    if (targetId == 0) {
      if (env.getDialogId() == DialogAction.QUEST_ACCEPT_1.id()) {
        QuestService.startQuest(env);
        PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
        return true;
      }
    } else if (targetId == 700513) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        switch (env.getDialog()) {
          case USE_OBJECT:
            {
              if (player.getInventory().getItemCountByItemId(182201823) == 0) {
                return giveQuestItem(env, 182201823, 1);
              }
            }
        }
      }
    }
    if (qs == null) {
      return false;
    }

    int var = qs.getQuestVarById(0);
    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798072) {
        if (env.getDialog() == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 2375);
        } else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()) {
          return sendQuestDialog(env, 5);
        } else {
          return sendQuestEndDialog(env);
        }
      }
    } else if (qs.getStatus() != QuestStatus.START) {
      return false;
    }
    if (targetId == 798072) {
      switch (env.getDialog()) {
        case QUEST_SELECT:
          if (var == 0) {
            return sendQuestDialog(env, 1352);
          }
        case SETPRO1:
          if (var == 0) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
          return false;
      }
    } else if (targetId == 204571) {
      switch (env.getDialog()) {
        case QUEST_SELECT:
          if (var == 1) {
            return sendQuestDialog(env, 1693);
          }
        case SETPRO2:
          if (var == 1) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
          return false;
      }
    } else if (targetId == 798013) {
      switch (env.getDialog()) {
        case QUEST_SELECT:
          if (var == 2) {
            return sendQuestDialog(env, 2034);
          }
        case SETPRO3:
          if (var == 2) {
            {
              qs.setQuestVarById(0, var + 1);
              qs.setStatus(QuestStatus.REWARD);
              updateQuestStatus(env);
              if (giveQuestItem(env, 182201824, 1)) ;
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
            }
          }
          return false;
      }
    }
    return false;
  }
예제 #27
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;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) {
      return false;
    }

    int var = qs.getQuestVarById(0);
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) {
      targetId = ((Npc) env.getVisibleObject()).getNpcId();
    }

    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204715) {
        if (env.getDialog() == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 10002);
        } else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()) {
          return sendQuestDialog(env, 5);
        } else {
          return sendQuestEndDialog(env);
        }
      }
      return false;
    } else if (qs.getStatus() != QuestStatus.START) {
      return false;
    }
    if (targetId == 204715) {
      switch (env.getDialog()) {
        case QUEST_SELECT:
          if (var == 0) {
            return sendQuestDialog(env, 1011);
          }
        case SETPRO1:
          if (var == 0) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        default:
          break;
      }
    } else if (targetId == 204801) {
      switch (env.getDialog()) {
        case QUEST_SELECT:
          if (var == 1) {
            return sendQuestDialog(env, 1352);
          } else if (var == 7) {
            return sendQuestDialog(env, 1693);
          }
        case SETPRO2:
          if (var == 1) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        case SETPRO3:
          if (var == 7) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        default:
          break;
      }
    } else if (targetId == 204805) {
      switch (env.getDialog()) {
        case QUEST_SELECT:
          if (var == 8) {
            return sendQuestDialog(env, 2034);
          }
          if (var == 9) {
            return sendQuestDialog(env, 2375);
          }
        case CHECK_USER_HAS_QUEST_ITEM:
          if (QuestService.collectItemCheck(env, true)) {
            if (!giveQuestItem(env, 182204304, 1)) {
              return true;
            }
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            return sendQuestDialog(env, 10000);
          } else {
            return sendQuestDialog(env, 10001);
          }
        case SETPRO4:
          if (var == 8) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        default:
          break;
      }
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) {
      targetId = ((Npc) env.getVisibleObject()).getNpcId();
    }

    if (targetId == 0) {
      if (env.getDialogId() == DialogAction.QUEST_ACCEPT_1.id()) {
        QuestService.startQuest(env);
        PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
        return true;
      }
    }

    if (qs != null && qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 204545:
          {
            switch (env.getDialog()) {
              case QUEST_SELECT:
                {
                  if (qs.getQuestVarById(0) == 0) {
                    return sendQuestDialog(env, 1352);
                  } else if (qs.getQuestVarById(0) == 2) {
                    return sendQuestDialog(env, 2034);
                  }
                }
              case SETPRO1:
                {
                  return defaultCloseDialog(env, 0, 1);
                }
              case SETPRO3:
                {
                  qs.setQuestVar(3);
                  return defaultCloseDialog(env, 3, 3, true, false);
                }
            }
          }
        case 204537:
          {
            switch (env.getDialog()) {
              case QUEST_SELECT:
                {
                  return sendQuestDialog(env, 1693);
                }
              case SETPRO2:
                {
                  return defaultCloseDialog(env, 1, 2, 0, 0, 182201765, 1);
                }
            }
          }
      }
    } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204546) {
        switch (env.getDialog()) {
          case QUEST_SELECT:
            {
              return sendQuestDialog(env, 2375);
            }
          default:
            {
              return sendQuestEndDialog(env);
            }
        }
      }
    }
    return false;
  }
예제 #30
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) {
      return false;
    }
    DialogAction dialog = env.getDialog();
    int targetId = env.getTargetId();

    if (qs.getStatus() == QuestStatus.START) {
      int var = qs.getQuestVarById(0);
      switch (targetId) {
        case 205987:
          { // Garnon
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 0) {
                    return sendQuestDialog(env, 1011);
                  }
                }
              case SETPRO1:
                {
                  return defaultCloseDialog(env, 0, 1); // 1
                }
            }
            break;
          }
        case 730493:
          { // Protector's Seal
            switch (dialog) {
              case USE_OBJECT:
                {
                  if (var == 2) {
                    changeQuestStep(env, 2, 3, false); // 3
                    QuestService.questTimerStart(env, 180); // 3 minutes
                    QuestService.invisibleTimerStart(
                        env, 170); // 2:50 minutes invisible timer for dragon spawn
                    // doesent work. maybe should be 2:40?
                    spawn(player);
                    return true;
                  }
                }
            }
            break;
          }
        case 205795:
          { // Oriata should be spawned after timer ends?
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 4) {
                    return sendQuestDialog(env, 2375);
                  } else if (var == 5) {
                    playQuestMovie(env, 709);
                    return sendQuestDialog(env, 2716);
                  }
                }
              case CHECK_USER_HAS_QUEST_ITEM:
                {
                  return checkQuestItems(env, 5, 5, true, 10000, 10001); // reward
                }
              case SETPRO5:
                {
                  return defaultCloseDialog(env, 4, 5); // 5
                }
              case FINISH_DIALOG:
                {
                  return closeDialogWindow(env);
                }
            }
            break;
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 205535) { // Killios
        if (dialog == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 10002);
        } else {
          return sendQuestEndDialog(env);
        }
      }
    }
    return false;
  }