@Override public boolean onDialogEvent(QuestCookie 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 (qs == null || qs.getStatus() == QuestStatus.NONE) { if (targetId == 203590) { if (env.getDialogId() == 25) return sendQuestDialog(env, 1011); else if (env.getDialogId() == 1002) { if (ItemService.addItems(player, Collections.singletonList(new QuestItems(182203257, 1)))) return defaultQuestStartDialog(env); return true; } else return defaultQuestStartDialog(env); } } if (qs == null) return false; int var = qs.getQuestVarById(0); if (qs.getStatus() == QuestStatus.START || qs.getStatus() == QuestStatus.REWARD) { if (targetId == 203591) { if (var == 0) { if (env.getDialogId() == 25) return sendQuestDialog(env, 1352); else if (env.getDialogId() == 10000) { qs.setQuestVar(1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0)); return true; } } if (var == 2 || var == 3) { if (env.getDialogId() == 25) return sendQuestDialog(env, 2375); else if (env.getDialogId() == 1009) { qs.setQuestVar(3); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return defaultQuestEndDialog(env); } else return defaultQuestEndDialog(env); } } else if (targetId == 203557) { if (var == 1) { if (env.getDialogId() == 25) return sendQuestDialog(env, 1693); else if (env.getDialogId() == 10001) { qs.setQuestVar(2); updateQuestStatus(env); player.getInventory().removeFromBagByItemId(182203257, 1); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0)); return true; } } } } return false; }
@Override public boolean onDialogEvent(QuestEnv env) { final Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); int targetId = 0; if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId(); if (targetId == 0) { if (env.getDialogId() == 1002) { QuestService.startQuest(env); PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0)); return true; } } else if (targetId == 278055) { if (qs != null) { if (env.getDialog() == QuestDialog.START_DIALOG && qs.getStatus() == QuestStatus.START) { return sendQuestDialog(env, 2375); } else if (env.getDialogId() == 1009 && qs.getStatus() != QuestStatus.COMPLETE && qs.getStatus() != QuestStatus.NONE) { removeQuestItem(env, 182207044, 1); qs.setQuestVar(1); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return sendQuestEndDialog(env); } else return sendQuestEndDialog(env); } } return false; }
@Override public boolean onDialogEvent(QuestCookie env) { if (env.getPlayer().getTribe().equals("PC")) { final Player player = env.getPlayer(); int targetId = 0; if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId(); QuestTemplate template = DataManager.QUEST_DATA.getQuestById(questId); QuestState qs = player.getQuestStateList().getQuestState(questId); if (targetId == 730329) { PlayerClass playerClass = player.getCommonData().getPlayerClass(); if (playerClass == PlayerClass.MAGE || playerClass == PlayerClass.PRIEST || playerClass == PlayerClass.GLADIATOR || playerClass == PlayerClass.WARRIOR || playerClass == PlayerClass.SCOUT) { if (qs == null || qs.getStatus() == QuestStatus.NONE || (qs.getStatus() == QuestStatus.COMPLETE && (qs.getCompliteCount() <= template.getMaxRepeatCount()))) { if (env.getDialogId() == -1) return sendQuestDialog(env, 1011); else return defaultQuestStartDialog(env); } else if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) { if (env.getDialogId() == -1) return sendQuestDialog(env, 2375); else if (env.getDialogId() == 33) { if (player.getInventory().getItemCountByItemId(185000102) >= 1) { player.getInventory().removeFromBagByItemId(185000102, 1); qs.setStatus(QuestStatus.REWARD); qs.setQuestVar(1); qs.setCompliteCount(0); updateQuestStatus(env); return sendQuestDialog(env, 5); } else return sendQuestDialog(env, 2716); } } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) { int var = qs.getQuestVarById(0); switch (env.getDialogId()) { case -1: if (var == 1) return sendQuestDialog(env, 5); case 17: QuestService.questFinish(env, qs.getQuestVars().getQuestVars() - 1); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } } } return false; } return false; } else { 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) { if (player.getWorldId() == 310050000 && qs.getQuestVarById(0) == 4) { qs.setQuestVar(5); updateQuestStatus(env); } } return false; }
@Override public boolean onDialogEvent(QuestCookie 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 == 204193) { if (qs == null || qs.getStatus() == QuestStatus.NONE) { if (env.getDialogId() == 26) return sendQuestDialog(env, 1011); else if (env.getDialogId() == 1002) { if (ItemService.addItems(player, Collections.singletonList(new QuestItems(182207006, 1)))) return defaultQuestStartDialog(env); return true; } else return defaultQuestStartDialog(env); } } else if (targetId == 204170) { if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) { if (env.getDialogId() == 26) return sendQuestDialog(env, 1352); else if (env.getDialogId() == 10000) { qs.setQuestVarById(0, qs.getQuestVarById(0) + 1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0)); return true; } } } else if (targetId == 798065) { if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) { if (env.getDialogId() == 26) return sendQuestDialog(env, 1693); else if (env.getDialogId() == 10001) { qs.setQuestVarById(0, qs.getQuestVarById(0) + 1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0)); return true; } } } else if (targetId == 204173) { if (qs != null) { if (env.getDialogId() == 26 && qs.getStatus() == QuestStatus.START) return sendQuestDialog(env, 2375); else if (env.getDialogId() == 1009) { qs.setQuestVar(3); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); 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 == 798126) { if (qs == null || qs.getStatus() == QuestStatus.NONE) { if (env.getDialog() == QuestDialog.START_DIALOG) return sendQuestDialog(env, 1011); else return sendQuestStartDialog(env); } } else if (targetId == 203940) { if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) { if (env.getDialog() == QuestDialog.START_DIALOG) return sendQuestDialog(env, 1352); else if (env.getDialog() == QuestDialog.STEP_TO_1) { 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 == 203944) { if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) { if (env.getDialog() == QuestDialog.START_DIALOG) return sendQuestDialog(env, 1352); else if (env.getDialog() == QuestDialog.STEP_TO_1) { qs.setQuestVarById(0, qs.getQuestVarById(0) + 1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 1693)); return true; } else return sendQuestStartDialog(env); } } else if (targetId == 798127) { if (qs != null) { if (env.getDialog() == QuestDialog.START_DIALOG && qs.getStatus() == QuestStatus.START) return sendQuestDialog(env, 2375); else if (env.getDialogId() == 1009 && 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; }
@Override public void QuestUseNpcInsideFunction(QuestCookie env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); int var = qs.getQuestVarById(0); switch (var) { case 5: qs.setQuestVar(6); break; case 6: qs.setQuestVar(7); break; case 7: qs.setQuestVar(8); break; case 8: defaultQuestMovie(env, 21); qs.setQuestVar(9); qs.setStatus(QuestStatus.REWARD); break; } updateQuestStatus(env); }
@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 == 730019) // Lodas { if (qs == null || qs.getStatus() == QuestStatus.NONE) { if (env.getDialog() == QuestDialog.START_DIALOG) return sendQuestDialog(env, 1011); else return sendQuestStartDialog(env); } else if (qs != null && qs.getStatus() == QuestStatus.START) { if (env.getDialog() == QuestDialog.START_DIALOG) return sendQuestDialog(env, 2375); else if (env.getDialogId() == 1009) { qs.setQuestVar(2); updateQuestStatus(env); return sendQuestEndDialog(env); } else return sendQuestEndDialog(env); } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) { if (env.getDialog() == QuestDialog.USE_OBJECT) return sendQuestDialog(env, 2375); return sendQuestEndDialog(env); } } else if (targetId == 730008) // Daminu { if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) { if (env.getDialog() == QuestDialog.START_DIALOG) return sendQuestDialog(env, 1352); else if (env.getDialog() == QuestDialog.STEP_TO_1 || env.getDialog() == QuestDialog.STEP_TO_2) { qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } else return sendQuestStartDialog(env); } } return false; }
@Override public boolean onDialogEvent(QuestCookie 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 == 203121) { if (qs == null) { if (env.getDialogId() == 26) return sendQuestDialog(env, 1011); else return defaultQuestStartDialog(env); } } else if (targetId == 798004) { if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) { if (env.getDialogId() == 26) return sendQuestDialog(env, 1352); else if (env.getDialogId() == 10000) { qs.setQuestVarById(0, qs.getQuestVarById(0) + 1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } else return defaultQuestStartDialog(env); } } else if (targetId == 203172) { if (qs != null) { if (env.getDialogId() == 26 && qs.getStatus() == QuestStatus.START) return sendQuestDialog(env, 2375); else if (env.getDialogId() == 1009) { qs.setQuestVar(2); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return defaultQuestEndDialog(env); } else return defaultQuestEndDialog(env); } } return false; }
@Override public boolean onDialogEvent(final QuestCookie env) { // Instanceof 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); // ------------------------------------------------------------ // NPC Quest : // 0 - Vergelmir start if (qs == null || qs.getStatus() == QuestStatus.NONE) { if (targetId == 203711) // Miriya { // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml if (env.getDialogId() == 25) // Send HTML_PAGE_SELECT_NONE to eddit-HtmlPages.xml return sendQuestDialog(env, 4762); else return defaultQuestStartDialog(env); } } if (qs == null) return false; int var = qs.getQuestVarById(0); if (qs.getStatus() == QuestStatus.START) { switch (targetId) { // Xenophon case 203833: if (var == 0) { switch (env.getDialogId()) { // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml case 25: // Send select1 to eddit-HtmlPages.xml return sendQuestDialog(env, 1011); // Get HACTION_SETPRO1 in the eddit-HyperLinks.xml case 10000: qs.setQuestVar(1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } } // 2 / 4- Talk with Koruchinerk case 798321: if (var == 1) { switch (env.getDialogId()) { // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml case 25: // Send select1 to eddit-HtmlPages.xml return sendQuestDialog(env, 1352); // Get HACTION_SETPRO1 in the eddit-HyperLinks.xml case 10001: qs.setQuestVar(2); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } } else if (var == 2) { switch (env.getDialogId()) { // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml case 25: // Send select1 to eddit-HtmlPages.xml return sendQuestDialog(env, 1693); // Get HACTION_SETPRO1 in the eddit-HyperLinks.xml case 33: if (player.getInventory().getItemCountByItemId(182206075) < 1) { // player doesn't own required item return sendQuestDialog(env, 10001); } player.getInventory().removeFromBagByItemId(182206075, 1); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return sendQuestDialog(env, 10000); } } return false; case 700562: if (var == 2) { ThreadPoolManager.getInstance() .schedule( new Runnable() { @Override public void run() { updateQuestStatus(env); } }, 3000); return true; } break; } } else if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 203711) // Miriya { if (env.getDialogId() == -1) return sendQuestDialog(env, 10002); else if (env.getDialogId() == 1009) return sendQuestDialog(env, 5); else return defaultQuestEndDialog(env); } } return false; }
@Override public boolean onDialogEvent(QuestCookie env) { final 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) { switch (targetId) { case 203516: switch (env.getDialogId()) { case 25: if (var == 0) return sendQuestDialog(env, 1011); case 10000: if (var == 0) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0)); return true; } } break; case 203519: switch (env.getDialogId()) { case 25: if (var == 1) return sendQuestDialog(env, 1352); case 10001: if (var == 1) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0)); return true; } } break; case 203539: switch (env.getDialogId()) { case 25: if (var == 2) return sendQuestDialog(env, 1693); case 1694: PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 55)); break; case 10002: if (var == 2) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0)); return true; } } break; case 203552: switch (env.getDialogId()) { case 25: if (var == 3) return sendQuestDialog(env, 2034); case 10003: if (var == 3) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0)); return true; } } break; case 203554: switch (env.getDialogId()) { case 25: if (var == 4) return sendQuestDialog(env, 2375); else if (var == 8) return sendQuestDialog(env, 2716); case 10004: if (var == 4) { qs.setQuestVar(5); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0)); return true; } break; case 10005: if (var == 8) { qs.setQuestVar(9); updateQuestStatus(env); qs.setQuestVar(8); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0)); return true; } } break; case 700081: if (var == 5) { destroy(6, env); return false; } break; case 700082: if (var == 6) { destroy(7, env); return false; } break; case 700083: if (var == 7) { destroy(-1, env); return false; } break; } } else if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 203516) { if (env.getDialogId() == -1) { PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 58)); return sendQuestDialog(env, 3057); } else return defaultQuestEndDialog(env); } } return false; }
@Override public boolean onDialogEvent(QuestCookie 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 == 798945) { if (qs == null) { if (env.getDialogId() == 25) return sendQuestDialog(env, 1011); else if (env.getDialogId() == 1002) { if (ItemService.addItems(player, Collections.singletonList(new QuestItems(182206700, 1)))) return defaultQuestStartDialog(env); else return true; } else return defaultQuestStartDialog(env); } } if (qs == null) return false; if (qs.getStatus() == QuestStatus.START) { switch (targetId) { case 798918: { switch (env.getDialogId()) { case 25: { return sendQuestDialog(env, 1352); } case 10000: { qs.setQuestVarById(0, qs.getQuestVarById(0) + 1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } } } case 798946: { switch (env.getDialogId()) { case 25: { return sendQuestDialog(env, 1693); } case 10001: { qs.setQuestVarById(0, qs.getQuestVarById(0) + 1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } } } case 798943: { switch (env.getDialogId()) { case 25: { return sendQuestDialog(env, 2034); } case 10002: { qs.setQuestVarById(0, qs.getQuestVarById(0) + 1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } } } case 798945: { switch (env.getDialogId()) { case 25: { return sendQuestDialog(env, 2375); } case 1009: { qs.setQuestVar(4); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return defaultQuestEndDialog(env); } default: return defaultQuestEndDialog(env); } } } } else if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 798945) { switch (env.getDialogId()) { case 1009: { return sendQuestDialog(env, 5); } default: return defaultQuestEndDialog(env); } } } return false; }