Ejemplo n.º 1
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 == 204754) {
     if (qs == null || qs.getStatus() == QuestStatus.NONE) {
       if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1011);
       else return sendQuestStartDialog(env);
     } else if (qs != null && qs.getStatus() == QuestStatus.START) {
       if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 2375);
       else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()) {
         qs.setStatus(QuestStatus.REWARD);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return sendQuestEndDialog(env);
     } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
       return sendQuestEndDialog(env);
     }
   } else if (targetId == 204701) {
     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) {
         qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return sendQuestStartDialog(env);
     }
   } else if (targetId == 204768) {
     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(3);
         qs.setStatus(QuestStatus.REWARD);
         updateQuestStatus(env);
         return sendQuestEndDialog(env);
       } else return sendQuestEndDialog(env);
     }
   }
   return false;
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
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();
    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;
  }
  @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();
   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;
  }
Ejemplo n.º 8
0
 private boolean setPlayerClass(QuestEnv env, QuestState qs, PlayerClass playerClass) {
   Player player = env.getPlayer();
   player.getCommonData().setPlayerClass(playerClass);
   player.getCommonData().upgradePlayer();
   qs.setStatus(QuestStatus.REWARD);
   updateQuestStatus(player, qs);
   sendQuestDialog(player, env.getVisibleObject().getObjectId(), 5);
   return true;
 }
  @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;
  }
Ejemplo n.º 11
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;
 }
Ejemplo n.º 12
0
  /** Disponible des le level 10 * */
  public boolean onLvlUpEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null
        || player.getCommonData().getLevel() < 10
        || qs.getStatus() != QuestStatus.LOCKED) 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);
   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;
 }
Ejemplo n.º 14
0
  @Override
  public boolean onMovieEndEvent(QuestEnv env, int movieId) {
    if (movieId != 361) return false;
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null || qs.getStatus() != QuestStatus.START) return false;

    qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
    qs.setStatus(QuestStatus.REWARD);
    updateQuestStatus(env);
    return sendQuestDialog(env, 1353);
  }
Ejemplo n.º 15
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;
  }
  @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) {
      return false;
    }

    if (targetId == 0) {
      if (env.getDialogId() == DialogAction.QUEST_ACCEPT_1.id()) {
        qs.setStatus(QuestStatus.START);
        PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
        return true;
      }
    } else if (targetId == 204373) {
      if (qs != null && qs.getStatus() == QuestStatus.START) {
        if (env.getDialog() == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 2375);
        } else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()
            && qs.getStatus() != QuestStatus.COMPLETE
            && qs.getStatus() != QuestStatus.NONE) {
          removeQuestItem(env, 182204123, 1);
          qs.setQuestVar(1);
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(env);
          return sendQuestEndDialog(env);
        } else {
          return sendQuestEndDialog(env);
        }
      }
    }
    return false;
  }
Ejemplo n.º 17
0
 @Override
 public boolean onEnterZoneEvent(QuestEnv env, ZoneName zoneName) {
   if (zoneName != ZoneName.Q1123) return false;
   final Player player = env.getPlayer();
   final QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getQuestVars().getQuestVars() != 0) return false;
   env.setQuestId(questId);
   PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 11));
   qs.setStatus(QuestStatus.REWARD);
   qs.getQuestVars().setQuestVarById(0, 1);
   updateQuestStatus(player, qs);
   return true;
 }
  @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 onMovieEndEvent(QuestEnv env, int movieId) {
   if (movieId != 16) return false;
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getStatus() != QuestStatus.REWARD) return false;
   int rewardExp = player.getRates().getQuestXpRate() * 8410;
   player.getCommonData().addExp(rewardExp);
   qs.setStatus(QuestStatus.COMPLETE);
   qs.setCompliteCount(1);
   updateQuestStatus(player, qs);
   PacketSendUtility.sendPacket(player, new SM_QUEST_ACCEPTED(questId, QuestStatus.COMPLETE, 2));
   return true;
 }
  @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();
    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;
  }
Ejemplo n.º 23
0
  public boolean onDialogEvent(QuestEnv env) {
    /** Initialisation de l'event * */
    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();

    /** Si on start la quete * */
    if (qs.getStatus() == QuestStatus.START) {
      if (targetId == 203559) {

        switch (env.getDialogId()) {
          case 25:
            if (var == 0) // Initialisation du dialogue
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
            else if (var <= 5) // Rendu de la quete
            {
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
            } else if (var >= 5) {
              qs.setStatus(QuestStatus.REWARD);
              updateQuestStatus(player, qs);
            }
          case 10000:
          case 10001:
            if (var == 0 || var == 5) {
              qs.setQuestVarById(0, var + 1);
              updateQuestStatus(player, qs);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
            }
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203559) {
        return defaultQuestEndDialog(env);
      }
    }
    return false;
  }
Ejemplo n.º 24
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);
 }
Ejemplo n.º 25
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) {
   final Player player = env.getPlayer();
   final QuestState qs = player.getQuestStateList().getQuestState(questId);
   int targetId = 0;
   if (env.getVisibleObject() instanceof Npc) {
     targetId = ((Npc) env.getVisibleObject()).getNpcId();
   }
   if (targetId == 798926) {
     if (qs == null || qs.getStatus() == QuestStatus.NONE) {
       if (env.getDialog() == DialogAction.QUEST_SELECT) {
         return sendQuestDialog(env, 1011);
       } else {
         return sendQuestStartDialog(env);
       }
     } else if (qs.getStatus() == QuestStatus.START) {
       long itemCount;
       if (env.getDialog() == DialogAction.QUEST_SELECT && qs.getQuestVarById(0) == 0) {
         return sendQuestDialog(env, 2375);
       } else if (env.getDialogId() == DialogAction.CHECK_USER_HAS_QUEST_ITEM.id()
           && qs.getQuestVarById(0) == 0) {
         itemCount = player.getInventory().getItemCountByItemId(182209601);
         if (itemCount > 0) {
           removeQuestItem(env, 182209601, 1);
           qs.setStatus(QuestStatus.REWARD);
           updateQuestStatus(env);
           return sendQuestDialog(env, 5);
         } else {
           return sendQuestDialog(env, 2716);
         }
       } else {
         return sendQuestEndDialog(env);
       }
     } else {
       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 != 278501) {
      return false;
    }
    if (qs.getStatus() == QuestStatus.START) {
      if (env.getDialog() == DialogAction.QUEST_SELECT) {
        return sendQuestDialog(env, 10002);
      } else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()) {
        qs.setStatus(QuestStatus.REWARD);
        qs.setQuestVarById(0, 1);
        updateQuestStatus(env);
        return sendQuestDialog(env, 5);
      }
      return false;
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (env.getDialogId() == DialogAction.SELECTED_QUEST_NOREWARD.id()) {
        int[] ids = {1071, 1072, 1073, 1074, 1075, 1076, 1077};
        for (int id : ids) {
          QuestEngine.getInstance()
              .onEnterZoneMissionEnd(
                  new QuestEnv(env.getVisibleObject(), env.getPlayer(), id, env.getDialogId()));
        }
      }
      return sendQuestEndDialog(env);
    }
    return false;
  }
Ejemplo n.º 28
0
  @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 (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialogId() == 1002) {
          questService.startQuest(env, QuestStatus.START);
          if (!itemService.addItems(
              player, Collections.singletonList(new QuestItems(182200226, 1)))) ;
          player.getInventory().removeFromBagByItemId(182200214, 1);
          PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
          return true;
        } else PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
      }
    }

    if (qs == null) return false;

    int var = qs.getQuestVarById(0);

    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203075 && var == 4) {
        if (env.getDialogId() == -1)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
        else if (env.getDialogId() == 1009)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 6);
        else return defaultQuestEndDialog(env);
      } else if (targetId == 203058 && var == 3) return defaultQuestEndDialog(env);
    } else if (qs.getStatus() != QuestStatus.START) return false;

    if (targetId == 203075) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 0) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
          else if (var == 2)
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1693);
          else if (var == 3)
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);

        case 1009:
          if (var == 2) {
            qs.setQuestVarById(0, var + 2);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(player, qs);
            player.getInventory().removeFromBagByItemId(182200217, 1);
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 6);
          }
          if (var == 3) {
            qs.setQuestVarById(0, var + 1);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(player, qs);
            player.getInventory().removeFromBagByItemId(182200217, 1);
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 6);
          }
        case 10000:
          if (var == 0) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(player, qs);
            player.getInventory().removeFromBagByItemId(182200226, 1);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        case 10001:
          if (var == 2) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(player, qs);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    } else if (targetId == 700008) {
      switch (env.getDialogId()) {
        case -1:
          if (var == 1) {
            // final Npc npc = (Npc)env.getVisibleObject();
            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() {
                        PacketSendUtility.sendPacket(
                            player,
                            new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 0));
                        PacketSendUtility.broadcastPacket(
                            player, new SM_EMOTION(player, 38, 0, targetObjectId), true);
                        for (VisibleObject obj : player.getKnownList()) {
                          if (!(obj instanceof Npc)) continue;
                          if (((Npc) obj).getNpcId() != 203175) continue;
                          if (((Npc) obj).getNpcId() != 203175) return;
                          ((Npc) obj).getAggroList().addDamage(player, 50);
                        }
                        if (!itemService.addItems(
                            player, Collections.singletonList(new QuestItems(182200217, 1)))) ;
                        qs.setQuestVarById(0, 2);
                        updateQuestStatus(player, qs);
                      }
                    },
                    3000);
          }
          return true;
      }
    }
    if (targetId == 203058) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 3) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2034);
        case 10002:
          if (var == 3) {
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(player, qs);
            player.getInventory().removeFromBagByItemId(182200217, 1);
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 5);
          }
        case 10001:
          if (var == 3) {
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    final 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 == 204547) {
        if (env.getDialogId() == 25) {
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 4762);
        } else return defaultQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 204547:
          {
            switch (env.getDialogId()) {
              case 25:
                {
                  long itemCount1 = player.getInventory().getItemCountByItemId(182201760);
                  if (qs.getQuestVarById(0) == 0 && itemCount1 >= 3) {
                    return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
                  }
                }
              case 4763:
                {
                  qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
                  updateQuestStatus(player, qs);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
                  return true;
                }
            }
          }
        case 204540:
          {
            switch (env.getDialogId()) {
              case 25:
                {
                  return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1693);
                }
              case 1694:
                {
                  qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
                  player.getInventory().removeFromBagByItemId(182201760, 1);
                  updateQuestStatus(player, qs);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
                  return true;
                }
            }
          }
        case 790018:
          {
            switch (env.getDialogId()) {
              case 25:
                {
                  return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2034);
                }
              case 2035:
                {
                  qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
                  player.getInventory().removeFromBagByItemId(182201760, 1);
                  qs.setStatus(QuestStatus.REWARD);
                  updateQuestStatus(player, qs);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
                  return true;
                }
            }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204541) {
        switch (env.getDialogId()) {
          case 25:
            {
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
            }
          case 1009:
            {
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 5);
            }
          case 17:
            {
              player.getInventory().removeFromBagByItemId(182201760, 1);
            }
          default:
            return defaultQuestEndDialog(env);
        }
      }
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    // Instanceof
    final Player player = env.getPlayer();
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    // ------------------------------------------------------------
    // NPC Quest :
    // Start to Tragi
    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 204050) {
        // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
        if (env.getDialogId() == 25)
          // Send select_none to eddit-HtmlPages.xml
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 4762);
        else return defaultQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

    if (qs.getStatus() == QuestStatus.START) {

      switch (targetId) {
          // 1 - Collect the Deathmark in Brusthonin for Tragi
        case 204050:
          switch (env.getDialogId()) {
              // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
            case 25:
              // Send select1 to eddit-HtmlPages.xml
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
              // Get HACTION_SETPRO1 in the eddit-HyperLinks.xml
            case 10000:
              // Send select2 to eddit-HtmlPages.xml
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
              // Get HACTION_CHECK_USER_HAS_QUEST_ITEM in the eddit-HyperLinks.xml
            case 33:
              // Collect Crown Ksellid's Sting (10)
              // Collect Rocky Back Ksellid's Shell (10)
              // Collect Refugee's Old Clothes (10)
              // Collect Lobnite's Stalk (10)
              if (player.getInventory().getItemCountByItemId(182207117) >= 10
                  && player.getInventory().getItemCountByItemId(182207118) >= 10
                  && player.getInventory().getItemCountByItemId(182207119) >= 10
                  && player.getInventory().getItemCountByItemId(182207120) >= 10) {
                player.getInventory().removeFromBagByItemId(182207117, 10);
                player.getInventory().removeFromBagByItemId(182207118, 10);
                player.getInventory().removeFromBagByItemId(182207119, 10);
                player.getInventory().removeFromBagByItemId(182207120, 10);
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(player, qs);
                // Send select_quest_reward1 to eddit-HtmlPages.xml
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 5);
              } else {
                // Send check_user_item_fail to eddit-HtmlPages.xml
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 10001);
              }
          }
          break;
          // No match
        default:
          return defaultQuestStartDialog(env);
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203710) return defaultQuestEndDialog(env);
    }
    return false;
  }