@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 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; }
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 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 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) { 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; }
@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; }
@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; }
@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 == 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); 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 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(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 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; }
@Override public boolean onGetItemEvent(QuestEnv env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs != null && qs.getStatus() == QuestStatus.START) { changeQuestStep(env, 0, 0, true); // reward return true; } return false; }
@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; }
/** 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; }
@Override public boolean onKillEvent(QuestEnv env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs != null && qs.getStatus() == QuestStatus.START) { int var = qs.getQuestVarById(0); if (var == 0) return defaultOnKillEvent(env, 296493, 0, 1); else if (var == 1) return defaultOnKillEvent(env, 296494, 1, 2); else if (var == 2) return defaultOnKillEvent(env, 296495, 2, true); } return false; }
@Override public boolean onLogOutEvent(QuestEnv env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs != null && qs.getStatus() == QuestStatus.START) { int var = qs.getQuestVarById(0); if (var == 2) { changeQuestStep(env, 2, 1, false); } } return false; }
@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); }
@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; }
@Override public boolean onKillEvent(QuestEnv env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs == null) return false; int var = qs.getQuestVarById(0); if (var >= 3 && var < 8) { return defaultOnKillEvent(env, mobs, 3, 8); // 3 - 8 } else if (var == 8) { return defaultOnKillEvent(env, mobs, 8, true); // reward } return false; }
@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 onKillEvent(QuestEnv env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs != null && qs.getStatus() == QuestStatus.START) { int var = qs.getQuestVarById(0); if (var == 2 && env.getTargetId() == 212879) { changeQuestStep(env, 2, 4, false); // 4 return true; } } return false; }
@Override public boolean onQuestTimerEndEvent(QuestEnv env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs != null && qs.getStatus() == QuestStatus.START) { int var = qs.getQuestVarById(0); if (var == 3) { changeQuestStep(env, 3, 4, false); // 4 return playQuestMovie(env, 707); } } return false; }
@Override public boolean onInvisibleTimerEndEvent(QuestEnv env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs != null && qs.getStatus() == QuestStatus.START) { int var = qs.getQuestVarById(0); if (var == 3) { spawnHesibanata(player); return true; } } return false; }
@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; }