@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();
    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) {
    final Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    int targetId = env.getTargetId();
    DialogAction dialog = env.getDialog();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 801022) {
        switch (dialog) {
          case QUEST_SELECT:
            {
              return sendQuestDialog(env, 1011);
            }
          case QUEST_ACCEPT_SIMPLE:
            {
              return sendQuestStartDialog(env, 182213313, 1);
            }
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 801022) {
        if (dialog == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 2375);
        } else {
          return sendQuestEndDialog(env);
        }
      }
    }
    return false;
  }
Esempio n. 4
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 == 799336) { // Tataka
        if (player.getInventory().getItemCountByItemId(102000690)
            >= 1) { // Noble Siel's Supreme Mace
          if (dialog == DialogAction.QUEST_SELECT) {
            return sendQuestDialog(env, 4762);
          } else {
            return sendQuestStartDialog(env);
          }
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 799336) { // Tataka
        if (dialog == DialogAction.USE_OBJECT) {
          if (player.getInventory().getItemCountByItemId(182213290) > 0) {
            return sendQuestDialog(env, 10002);
          }
        } else {
          removeQuestItem(env, 182213290, 1);
          return sendQuestEndDialog(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) {
          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;
  }
Esempio n. 6
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();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (targetId == 203607) {
     if (qs == null) {
       if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1011);
       else return sendQuestStartDialog(env);
     }
   } else if (targetId == 203609) {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
       if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1352);
       else if (env.getDialog() == DialogAction.SETPRO1) {
         return defaultCloseDialog(env, 0, 1); // 1
       } else return sendQuestStartDialog(env);
     }
   } else if (targetId == 203631) {
     if (qs != null) {
       if (env.getDialog() == DialogAction.QUEST_SELECT && qs.getStatus() == QuestStatus.START)
         return sendQuestDialog(env, 2375);
       else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()
           && qs.getStatus() != QuestStatus.COMPLETE
           && qs.getStatus() != QuestStatus.NONE) {
         qs.setQuestVar(2);
         qs.setStatus(QuestStatus.REWARD);
         updateQuestStatus(env);
         return sendQuestEndDialog(env);
       } else return sendQuestEndDialog(env);
     }
   }
   return false;
 }
Esempio n. 7
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.getQuestVarById(0);
    int targetId = env.getTargetId();
    DialogAction dialog = env.getDialog();

    if (qs.getStatus() == QuestStatus.START) {
      if (targetId == 203518) { // Boromer
        switch (dialog) {
          case QUEST_SELECT:
            {
              if (var == 0) {
                return sendQuestDialog(env, 1011);
              } else if (var == 1) {
                return sendQuestDialog(env, 1352);
              } else if (var == 2) {
                return sendQuestDialog(env, 1694);
              }
            }
          case SELECT_ACTION_1012:
            {
              playQuestMovie(env, 51);
              return sendQuestDialog(env, 1012);
            }
          case SETPRO1:
            {
              return defaultCloseDialog(env, 0, 1); // 1
            }
          case SETPRO3:
            {
              return defaultCloseDialog(env, 2, 3); // 3
            }
          case CHECK_USER_HAS_QUEST_ITEM:
            {
              return checkQuestItems(env, 1, 2, false, 1694, 1693);
            }
          case FINISH_DIALOG:
            {
              return sendQuestSelectionDialog(env);
            }
        }
      } else if (targetId == 700093) {
        return true; // just give quest drop on use
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203518) { // Boromer
        if (dialog == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 2034);
        } else {
          return sendQuestEndDialog(env);
        }
      }
    }
    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) {
     if (targetId == 205130) {
       if (env.getDialogId() == 25)
         return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
       else return defaultQuestStartDialog(env);
     }
   } else if (qs.getStatus() == QuestStatus.START) {
     switch (targetId) {
       case 730107:
         {
           if (qs.getQuestVarById(0) == 0 && env.getDialogId() == -1) {
             final int targetObjectId = env.getVisibleObject().getObjectId();
             PacketSendUtility.sendPacket(
                 player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 1));
             PacketSendUtility.broadcastPacket(
                 player, new SM_EMOTION(player, 37, 0, targetObjectId), true);
             ThreadPoolManager.getInstance()
                 .schedule(
                     new Runnable() {
                       @Override
                       public void run() {
                         if (!player.isTargeting(targetObjectId)) return;
                         PacketSendUtility.sendPacket(
                             player,
                             new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 0));
                         PacketSendUtility.broadcastPacket(
                             player, new SM_EMOTION(player, 38, 0, targetObjectId), true);
                         qs.setQuestVarById(0, 1);
                         updateQuestStatus(player, qs);
                       }
                     },
                     3000);
           }
         }
       case 205130:
         {
           if (qs.getQuestVarById(0) == 1) {
             if (env.getDialogId() == 25)
               return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
             else if (env.getDialogId() == 1009) {
               qs.setStatus(QuestStatus.REWARD);
               updateQuestStatus(player, qs);
               return defaultQuestEndDialog(env);
             } else return defaultQuestEndDialog(env);
           }
         }
     }
   } else if (qs.getStatus() == QuestStatus.REWARD) {
     if (targetId == 205130) return defaultQuestEndDialog(env);
   }
   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();
    }
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (targetId == 204777) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialog() == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 1011);
        } else {
          return sendQuestStartDialog(env);
        }
      }
    }
    if (qs == null) {
      return false;
    }

    int var = qs.getQuestVarById(0);
    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204777) {
        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 == 204790) {
      switch (env.getDialog()) {
        case QUEST_SELECT:
          if (var == 0) {
            return sendQuestDialog(env, 1352);
          }
        case SETPRO1:
          if (var == 0) {
            qs.setQuestVarById(0, var + 1);
            qs.setStatus(QuestStatus.REWARD);
            if (!giveQuestItem(env, 182204489, 1)) {
              updateQuestStatus(env);
            }
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
          return false;
      }
    }
    return false;
  }
Esempio n. 10
0
 @Override
 public boolean onDialogEvent(final QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null) return false;
   int var = qs.getQuestVarById(0);
   int targetId = env.getTargetId();
   DialogAction dialog = env.getDialog();
   if (qs.getStatus() == QuestStatus.START) {
     switch (targetId) {
       case 204342:
         { // Mirka
           switch (dialog) {
             case QUEST_SELECT:
               {
                 if (var == 0) {
                   return sendQuestDialog(env, 1011);
                 }
                 if (var == 4) return sendQuestDialog(env, 2375);
               }
             case SELECT_ACTION_1012:
               {
                 if (var == 0) {
                   playQuestMovie(env, 82);
                   return sendQuestDialog(env, 1012);
                 }
               }
             case SETPRO1:
               {
                 return defaultCloseDialog(env, 0, 1); // 1
               }
             case SET_SUCCEED:
               {
                 return defaultCloseDialog(env, 4, 4, true, false, 0, 0, 182204016, 1); // reward
               }
           }
           break;
         }
       case 700233:
         { // Pagimkin's Corpse
           if (dialog == DialogAction.USE_OBJECT && var == 1) {
             return useQuestObject(env, 1, 2, false, 0); // 2
           }
         }
     }
   } else if (qs.getStatus() == QuestStatus.REWARD) {
     if (targetId == 204053) { // Kvasir
       if (env.getDialog() == DialogAction.USE_OBJECT) {
         return sendQuestDialog(env, 10002);
       } else {
         return sendQuestEndDialog(env);
       }
     }
   }
   return false;
 }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    int targetId = 0;

    QuestState qs2 = player.getQuestStateList().getQuestState(3968);
    if (qs2 == null || qs2.getStatus() != QuestStatus.COMPLETE) return false;

    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    if (targetId == 798390) // Palentine
    {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialogId() == -1)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
        else if (env.getDialogId() == 1002) {
          if (ItemService.addItems(
              player, Collections.singletonList(new QuestItems(182206126, 1)))) {
            return defaultQuestStartDialog(env);
          }
          return true;
        } else return defaultQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

    int var = qs.getQuestVarById(0);

    if (targetId == 798391) // Andu
    {
      if (qs.getStatus() == QuestStatus.START && var == 0) {
        if (env.getDialogId() == -1)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
        else if (env.getDialogId() == 10000) {
          if (ItemService.removeItemFromInventoryByItemId(player, 182206126)) {
            qs.setQuestVar(1);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(player, qs);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          }
          return true;
        } else return defaultQuestStartDialog(env);
      }
    } else if (targetId == 798390) // Palentine
    {
      if (qs.getStatus() == QuestStatus.REWARD) {
        if (env.getDialogId() == -1)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
        return defaultQuestEndDialog(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 == 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;
  }
  @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;
  }
  @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;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (targetId == 798103) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialogId() == 25)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
        else return defaultQuestStartDialog(env);
      } else if (qs.getStatus() == QuestStatus.START) {
        if (env.getDialogId() == 25)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
        else if (env.getDialogId() == 1009) {
          qs.setQuestVar(3);
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(player, qs);
          return defaultQuestEndDialog(env);
        } else return defaultQuestEndDialog(env);
      } else if (qs.getStatus() == QuestStatus.REWARD) {
        return defaultQuestEndDialog(env);
      }
    } else if (targetId == 798026) {
      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 == 798357) {
      if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) {
        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);
      }
    }

    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 == 204141) { // Deyla
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 4762);
        } else {
          return sendQuestStartDialog(env);
        }
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      if (targetId == 204141) { // Deyla
        switch (dialog) {
          case QUEST_SELECT:
            {
              return sendQuestDialog(env, 1011);
            }
          case SETPRO1:
            {
              return sendQuestDialog(env, 1352);
            }
          case SETPRO2:
            {
              return sendQuestDialog(env, 1693);
            }
          case SETPRO11:
            {
              changeQuestStep(env, 0, 0, true); // reward
              choice = 0;
              return sendQuestDialog(env, 5);
            }
          case SETPRO12:
            {
              changeQuestStep(env, 0, 0, true); // reward
              choice = 1;
              return sendQuestDialog(env, 6);
            }
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204141) { // Deyla
        return sendQuestEndDialog(env, choice);
      }
    }
    return false;
  }
  @Override
  public boolean onLvlUpEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null
        || qs.getStatus() != QuestStatus.LOCKED
        || player.getCommonData().getLevel() < 38) return false;

    QuestState qs2 = player.getQuestStateList().getQuestState(1500);
    if (qs2 == null || qs2.getStatus() != QuestStatus.COMPLETE) return false;
    qs.setStatus(QuestStatus.START);
    updateQuestStatus(player, qs);
    return true;
  }
 @Override
 public boolean onLvlUpEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getStatus() != QuestStatus.LOCKED) return false;
   int[] quests = {2001, 2002, 2003, 2004, 2005, 2006};
   for (int id : quests) {
     QuestState qs2 = player.getQuestStateList().getQuestState(id);
     if (qs2 == null || qs2.getStatus() != QuestStatus.COMPLETE) return false;
   }
   qs.setStatus(QuestStatus.START);
   updateQuestStatus(player, qs);
   return true;
 }
  @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;
  }
 @Override
 public boolean onEnterWorldEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null && qs.getStatus() == QuestStatus.START) {
     int var = qs.getQuestVars().getQuestVars();
     if (var == 12) {
       if (player.getWorldId() == 300160000) {
         qs.setQuestVar(13);
         updateQuestStatus(env);
         return true;
       } else {
         if (player.getInventory().getItemCountByItemId(182206613) == 0) {
           return giveQuestItem(env, 182206613, 1);
         }
       }
     } else if (var >= 13 && var < 16) {
       if (player.getWorldId() != 300160000) {
         changeQuestStep(env, var, 12, false);
         if (player.getInventory().getItemCountByItemId(182206613) == 0) {
           giveQuestItem(env, 182206613, 1);
         }
         return true;
       }
     }
   }
   return false;
 }
  @Override
  public HandlerResult onItemUseEvent(final QuestEnv env, Item item) {
    final Player player = env.getPlayer();
    final int itemObjId = item.getObjectId();
    final int id = item.getItemTemplate().getTemplateId();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    if (id != 182201765) {
      return HandlerResult.UNKNOWN;
    }

    if (qs != null) {
      if (qs.getStatus() == QuestStatus.COMPLETE) {
        removeQuestItem(env, 182201765, 1);
        return HandlerResult.FAILED;
      }
    }

    PacketSendUtility.broadcastPacket(
        player, new SM_ITEM_USAGE_ANIMATION(player.getObjectId(), itemObjId, id, 3000, 0, 0), true);
    ThreadPoolManager.getInstance()
        .schedule(
            new Runnable() {
              @Override
              public void run() {
                PacketSendUtility.broadcastPacket(
                    player,
                    new SM_ITEM_USAGE_ANIMATION(player.getObjectId(), itemObjId, id, 0, 1, 0),
                    true);
                sendQuestDialog(env, 4);
              }
            },
            3000);
    return HandlerResult.SUCCESS;
  }
Esempio n. 22
0
 @Override
 public boolean onEnterWorldEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null && qs.getStatus() == QuestStatus.START) {
     int var = qs.getQuestVars().getQuestVars();
     if (player.getWorldId() != 320070000) {
       if (var >= 95 && var <= 99) {
         removeStigma(env);
         qs.setQuestVar(4);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player,
             new SM_SYSTEM_MESSAGE(
                 SystemMessageId.QUEST_FAILED_$1,
                 DataManager.QUEST_DATA.getQuestById(questId).getName()));
         return true;
       } else if (var == 9) {
         removeStigma(env);
         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 (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;
  }
Esempio n. 24
0
  public boolean onKillEvent(QuestEnv env) {
    /** Checks * */
    Player player = env.getPlayer();
    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.START) return false;

    switch (targetId) {
      case 210715: // Brute
        if (var > 0 && var < 4) // En tuer 4
        {
          qs.setQuestVarById(0, var + 1);
          updateQuestStatus(player, qs);
          return true;
        } else if (var == 4) // Au 4eme REWARD
        {
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(player, qs);
          return true;
        }
    }
    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.START) {
      switch (targetId) {
        case 204191:
          {
            switch (env.getDialogId()) {
              case 25:
                if (var == 0)
                  return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
                break;
              case 10000:
                if (var == 0) {
                  qs.setQuestVarById(0, var + 1);
                  updateQuestStatus(player, qs);
                  TeleportService.teleportTo(
                      player, 220030000, player.getInstanceId(), 1748f, 1807f, 255f, 1000);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
                  return true;
                }
            }
          }
        case 203559:
          switch (env.getDialogId()) {
            case 25:
              if (var == 1) {
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(player, qs);
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
              }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203559) {
        return defaultQuestEndDialog(env);
      }
    }
    return false;
  }
 @Override
 public HandlerResult onItemUseEvent(QuestEnv env, Item item) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getStatus() == QuestStatus.NONE) {
     return HandlerResult.fromBoolean(sendQuestDialog(env, 4));
   }
   return HandlerResult.FAILED;
 }
 @Override
 public HandlerResult onItemUseEvent(QuestEnv env, Item item) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null && qs.getStatus() == QuestStatus.START) {
     return HandlerResult.fromBoolean(useQuestItem(env, item, 0, 1, true));
   }
   return HandlerResult.FAILED;
 }
 @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;
 }
  @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 == 798928) { // Yulia
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 4762);
        } else {
          return sendQuestStartDialog(env);
        }
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      int var = qs.getQuestVarById(0);
      if (targetId == 799069) { // Yannis
        switch (dialog) {
          case QUEST_SELECT:
            {
              if (var == 0) {
                return sendQuestDialog(env, 1011);
              }
            }
          case SETPRO1:
            {
              return defaultCloseDialog(env, 0, 1); // 1
            }
        }
      } else if (targetId == 700948) {
        return true;
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798928) { // Yulia
        if (dialog == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 10002);
        } else {
          return sendQuestEndDialog(env);
        }
      }
    }
    return false;
  }
Esempio n. 30
0
 @Override
 public boolean onQuestFinishEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
     teleportService.teleportTo(player, 210010000, 1, 242, 1638, 100, (byte) 20, 0);
     return true;
   }
   return false;
 }