@Override public boolean onDialogEvent(QuestEnv env) { final Player player = env.getPlayer(); int targetId = env.getTargetId(); QuestState qs = player.getQuestStateList().getQuestState(questId); QuestDialog dialog = env.getDialog(); if (targetId == 799234) { if (qs == null || qs.getStatus() == QuestStatus.NONE) { if (dialog == QuestDialog.START_DIALOG) return sendQuestDialog(env, 1011); else return sendQuestStartDialog(env); } else if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) { if (dialog == QuestDialog.START_DIALOG) return sendQuestDialog(env, 2375); else if (dialog == QuestDialog.SELECT_REWARD) return defaultCloseDialog(env, 1, 1, true, true); else return sendQuestEndDialog(env); } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) // Reward return sendQuestEndDialog(env); } else if (targetId == 204433) { if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) { if (dialog == QuestDialog.START_DIALOG) return sendQuestDialog(env, 1352); else if (dialog == QuestDialog.STEP_TO_1) return defaultCloseDialog(env, 0, 1); else return sendQuestStartDialog(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); 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(QuestEnv env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); QuestDialog dialog = env.getDialog(); int targetId = env.getTargetId(); if (qs == null || qs.getStatus() == QuestStatus.NONE) { if (targetId == 799032) { // Gefeios if (player.getInventory().getItemCountByItemId(100900716) >= 1) { // Noble Siel's Supreme Greatsword if (dialog == QuestDialog.START_DIALOG) { return sendQuestDialog(env, 4762); } else { return sendQuestStartDialog(env); } } } } else if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 799032) { // Gefeios if (dialog == QuestDialog.USE_OBJECT) { if (player.getInventory().getItemCountByItemId(182209634) > 0) { return sendQuestDialog(env, 10002); } } else { removeQuestItem(env, 182209634, 1); return sendQuestEndDialog(env); } } } return false; }
public boolean onDialogEvent(QuestCookie env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs == null || qs.getStatus() == QuestStatus.NONE) { if (env.getTargetId() == 204052) { if (env.getDialogId() == 25) { int skillLevel = 0; for (int skillId : skill_ids) { if (player.getSkillList().isSkillPresent(skillId)) skillLevel = Math.max(skillLevel, player.getSkillList().getSkillLevel(skillId)); } if (skillLevel <= 399) return sendQuestDialog(env, 4080); else return sendQuestDialog(env, 4762); } else return defaultQuestStartDialog(env); } } if (qs == null) return false; if (qs.getStatus() == QuestStatus.START) { if (env.getTargetId() == 204072) { if (env.getDialogId() == 25) { defaultCloseDialog(env, 0, 0, true, true); return sendQuestDialog(env, 2375); } } } return defaultQuestRewardDialog(env, 204072, 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 = 0; if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId(); if (qs.getStatus() == QuestStatus.START) { if (targetId == 203129) { switch (env.getDialog()) { case START_DIALOG: if (var == 0) return sendQuestDialog(env, 1011); case STEP_TO_1: case STEP_TO_2: if (var == 0) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } } } } else if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 203129) return sendQuestEndDialog(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 == 203965) { if (qs == null || qs.getStatus() == QuestStatus.NONE) { if (env.getDialogId() == 26) return sendQuestDialog(env, 1011); else return defaultQuestStartDialog(env); } } if (qs == null) return false; if (qs.getStatus() == QuestStatus.START) { if (targetId == 203966) { if (env.getDialogId() == 26) { qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return sendQuestDialog(env, 1352); } } return false; } else if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 203966) { if (env.getDialogId() == 1009) return sendQuestDialog(env, 5); else return defaultQuestEndDialog(env); } return false; } return false; }
@Override public boolean onDialogEvent(QuestCookie 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 (qs == null || qs.getStatus() == QuestStatus.NONE) { if (env.getDialogId() == 1002) { QuestService.startQuest(env, QuestStatus.START); 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 == 798316) { if (env.getDialogId() == -1) return sendQuestDialog(env, 2375); else if (env.getDialogId() == 1009) return sendQuestDialog(env, 5); else return defaultQuestEndDialog(env); } } else if (qs.getStatus() != QuestStatus.START) { return false; } if (targetId == 278591) { switch (env.getDialogId()) { case 25: if (var == 0) return sendQuestDialog(env, 1352); case 10000: if (var == 0) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } return false; } } else if (targetId == 278624) { switch (env.getDialogId()) { case 25: if (var == 1) return sendQuestDialog(env, 1693); case 10001: if (var == 1) { qs.setQuestVarById(0, var + 1); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } return false; } } return false; }
@Override public boolean onDialogEvent(QuestCookie env) { final Player player = env.getPlayer(); final QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs == null) return false; final 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 203665: switch (env.getDialogId()) { case 25: if (var == 0) return sendQuestDialog(env, 1011); break; case 10000: if (var == 0) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } } break; case 203668: switch (env.getDialogId()) { case 25: if (var == 1) return sendQuestDialog(env, 1352); else if (var == 5) return sendQuestDialog(env, 1693); else if (var == 6) return sendQuestDialog(env, 2034); break; case 10001: case 10002: if (var == 1 || var == 5) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } case 33: if (var == 6) { if (QuestService.collectItemCheck(env, true)) { qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return sendQuestDialog(env, 5); } else return sendQuestDialog(env, 2120); } } } } else if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 203668) return defaultQuestEndDialog(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 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(); int targetId = 0; if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (targetId == 799025) { if (qs == null || qs.getStatus() == QuestStatus.NONE) { if (env.getDialog() == QuestDialog.START_DIALOG) 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 == 799025) { return sendQuestEndDialog(env); } } else if (qs.getStatus() != QuestStatus.START) { return false; } if (targetId == 799026) { switch (env.getDialog()) { case START_DIALOG: if (var == 0) return sendQuestDialog(env, 1352); case STEP_TO_1: if (var == 0) { if (giveQuestItem(env, 182206858, 1)) qs.setQuestVarById(0, var + 1); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } return false; } } else if (targetId == 799025) { switch (env.getDialog()) { case START_DIALOG: if (var == 1) return sendQuestDialog(env, 2375); case SELECT_REWARD: if (var == 1) { removeQuestItem(env, 182206858, 1); qs.setQuestVarById(0, var + 1); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return sendQuestDialog(env, 5); } return false; } } 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 onKillEvent(QuestCookie env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs == null || qs.getStatus() != QuestStatus.START) return false; switch (env.getTargetId()) { case 215523: case 215522: case 215520: case 215521: if (qs.getQuestVarById(1) < 34 && qs.getQuestVarById(0) == 3) { qs.setQuestVarById(1, qs.getQuestVarById(1) + 1); updateQuestStatus(env); return true; } break; case 215488: if (qs.getQuestVarById(0) == 7) { @SuppressWarnings("unused") final int instanceId = player.getInstanceId(); QuestService.addNewSpawn( 300190000, player.getInstanceId(), 799503, (float) 566.1413, (float) 813.3888, (float) 1375.138, (byte) 32, true); return true; } else if (qs != null && qs.getStatus() == QuestStatus.COMPLETE) { @SuppressWarnings("unused") final int instanceId = player.getInstanceId(); QuestService.addNewSpawn( 300190000, player.getInstanceId(), 799503, (float) 566.1413, (float) 813.3888, (float) 1375.138, (byte) 32, true); return true; } } return false; }
@Override public boolean onDialogEvent(QuestEnv env) { final Player player = env.getPlayer(); int targetId = 0; if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId(); 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 boolean onDialogEvent(QuestCookie env) { Player player = env.getPlayer(); if (defaultQuestNoneDialog(env, 799300, 4762)) return true; QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs == null) return false; int var = qs.getQuestVarById(0); if (qs.getStatus() == QuestStatus.START) { if (env.getTargetId() == 799300) { switch (env.getDialogId()) { case 26: if (var == 0) return sendQuestDialog(env, 1011); else if (var == 1) return sendQuestDialog(env, 1352); case 10000: return defaultCloseDialog(env, 0, 1); case 10001: return defaultCloseDialog(env, 1, 0); case 34: return defaultQuestItemCheck(env, 1, 0, true, 5, 10001); } } } return defaultQuestRewardDialog(env, 799300, 2375); }
@Override public boolean onDialogEvent(QuestCookie env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (defaultQuestNoneDialog(env, 203613)) return true; if (qs == null) return false; int var = qs.getQuestVarById(0); if (qs.getStatus() == QuestStatus.START) { if (env.getTargetId() == 203630) { switch (env.getDialogId()) { case 26: if (var == 0) return sendQuestDialog(env, 1352); else if (var == 1) return sendQuestDialog(env, 1693); case 10000: return defaultCloseDialog(env, 0, 1); case 10001: return defaultCloseDialog(env, 1, 3, 182203227, 1, 0, 0); case 34: return defaultQuestItemCheck(env, 1, 0, false, 1779, 1694); } } else if (env.getTargetId() == 203613) { switch (env.getDialogId()) { case 26: if (var == 3) return sendQuestDialog(env, 2034); case 10002: if (defaultCloseDialog(env, 3, 0, true, false, 0, 0, 182203227, 1)) return sendQuestDialog(env, 5); } } } return defaultQuestRewardDialog(env, 203613, 0); }
@Override public void onDialogRequest(Player player) { // zer0patches todo check for better solution, portal data looks correct for portal controller // but // problem occurs because it is a quest teleportation via quest dialog on npc so portal check is // bypassed // Prevent Elyos's from using Aerolink in Gelkmaros -> Pandaemonium if (player.getCommonData().getRace() == Race.ELYOS && getOwner().getNpcId() == 730221) { PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_MOVE_PORTAL_ERROR_INVALID_RACE); return; } // Prevent Asmodian's from using Aerolink in Inggison -> Sanctum if (player.getCommonData().getRace() == Race.ASMODIANS && getOwner().getNpcId() == 730220) { PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_MOVE_PORTAL_ERROR_INVALID_RACE); return; } getOwner().getAi().handleEvent(Event.TALK); if (QuestEngine.getInstance().onDialog(new QuestCookie(getOwner(), player, 0, -1))) return; // Zephyr Deliveryman if (getOwner().getObjectId() == player.getZephyrObjectId()) { PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(getOwner().getObjectId(), 18)); return; } int titleId = getOwner().getObjectTemplate().getTitleId(); if (( // title ids of npcs titleId == 315018 || titleId == 350474 || titleId == 350473 || titleId == 350212 || titleId == 350304 || titleId == 350305 || titleId == 370000 || titleId == 370003 // aerolinks || (getOwner().getNpcId() >= 730265 && getOwner().getNpcId() <= 730269))) { NpcQuestData npcQD = QuestEngine.getInstance().getNpcQuestData(getOwner().getNpcId()); QuestStateList list = player.getQuestStateList(); List<Integer> events = npcQD.getOnTalkEvent(); boolean hasQuestFromNpc = false; for (int e : events) { QuestState qs = list.getQuestState(e); if (qs != null && qs.getStatus() != QuestStatus.COMPLETE) { hasQuestFromNpc = true; break; } else { continue; } } if (hasQuestFromNpc) PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(getOwner().getObjectId(), 10)); else PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(getOwner().getObjectId(), 1011)); } else PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(getOwner().getObjectId(), 10)); }
@Override public boolean onItemUseEvent(QuestCookie env, Item item) { final Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); final int id = item.getItemTemplate().getTemplateId(); final int itemObjId = item.getObjectId(); switch (id) { case 182207006: if (qs == null || qs.getStatus() != QuestStatus.START) return false; PacketSendUtility.broadcastPacket( player, new SM_ITEM_USAGE_ANIMATION(player.getObjectId(), itemObjId, id, 1000, 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); } }, 1000); return true; } return false; }
@Override public boolean onEnterWorldEvent(QuestCookie env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs == null) return false; if (qs.getStatus() == QuestStatus.START || qs.getStatus() == QuestStatus.COMPLETE) { if (player.getWorldId() != 300190000) { player.getInventory().removeFromBagByItemId(182206627, 1); player.getInventory().removeFromBagByItemId(182206628, 1); player.getInventory().removeFromBagByItemId(164000137, 1); player.getInventory().removeFromBagByItemId(164000138, 1); player.getInventory().removeFromBagByItemId(164000139, 1); } } 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 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 == 204110) { if (env.getDialog() == QuestDialog.START_DIALOG) return sendQuestDialog(env, 1011); else return sendQuestStartDialog(env); } } if (qs.getStatus() == QuestStatus.START) { switch (targetId) { case 204110: { switch (env.getDialog()) { case START_DIALOG: { long itemCount1 = player.getInventory().getItemCountByItemId(182207966); if (itemCount1 > 0) { removeQuestItem(env, 182207966, 1); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return sendQuestDialog(env, 2375); } else return sendQuestDialog(env, 2716); } } } } } else if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 204110) { if (env.getDialogId() == 34) return sendQuestDialog(env, 5); else 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) { if (player.getWorldId() == 310050000 && qs.getQuestVarById(0) == 4) { qs.setQuestVar(5); updateQuestStatus(env); } } return false; }
@Override public boolean onLvlUpEvent(QuestCookie env) { final Player player = env.getPlayer(); final QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs != null) return false; QuestState qs2 = player.getQuestStateList().getQuestState(11001); if (qs2 == null || qs2.getStatus() != QuestStatus.COMPLETE) return false; env.setQuestId(questId); QuestService.startQuest(env, QuestStatus.START); return true; }
@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 == 799336) { if (qs == null || qs.getStatus() == QuestStatus.NONE) { if (env.getDialogId() == 26) return sendQuestDialog(env, 4762); else return defaultQuestStartDialog(env); } else if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) { if (env.getDialogId() == -1) { if (QuestService.collectItemCheck(env, false)) return sendQuestDialog(env, 2716); } else return defaultQuestStartDialog(env); } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) { 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(); int targetId = 0; QuestState qs = player.getQuestStateList().getQuestState(questId); if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId(); if (qs == null || qs.getStatus() == QuestStatus.NONE) { if (targetId == 278003) { if (env.getDialogId() == 26) return sendQuestDialog(env, 1011); else return defaultQuestStartDialog(env); } } else if (qs.getStatus() == QuestStatus.START) { if (targetId == 278091) { 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 if (targetId == 278086) { if (env.getDialogId() == 26) return sendQuestDialog(env, 2375); else if (env.getDialogId() == 1009) { qs.setQuestVarById(0, qs.getQuestVarById(0) + 1); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return defaultQuestEndDialog(env); } } } else if (qs.getStatus() == QuestStatus.REWARD && targetId == 278086) { 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 == 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 onKillEvent(QuestCookie env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs.getStatus() != QuestStatus.START) return false; final int instanceId = player.getInstanceId(); int var = qs.getQuestVarById(0); int targetId = 0; if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId(); final Npc npc = (Npc) env.getVisibleObject(); switch (targetId) { case 216739: case 216740: if (var == 0) { ThreadPoolManager.getInstance() .schedule( new Runnable() { @Override public void run() { QuestService.addNewSpawn( 300170000, instanceId, 216239, (float) npc.getX(), (float) npc.getY(), (float) npc.getZ(), (byte) 0, true); } }, 2000); return true; } break; case 216239: if (var == 0) { qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return true; } } return false; }
@Override public boolean onKillEvent(QuestEnv env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs == null || qs.getStatus() != QuestStatus.START) return false; int targetId = 0; if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId(); if (targetId == 700219 && qs.getQuestVarById(0) < 8) { qs.setQuestVarById(0, qs.getQuestVarById(0) + 1); updateQuestStatus(env); } else if (targetId == 212211 && qs.getQuestVarById(0) == 8) { qs.setQuestVarById(0, qs.getQuestVarById(0) + 1); updateQuestStatus(env); } return false; }
@Override public boolean onDialogEvent(QuestCookie env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (defaultQuestNoneDialog(env, 260264, 4762)) return true; if (qs == null) return false; if (qs.getStatus() == QuestStatus.START) { switch (env.getTargetId()) { case 700856: return defaultQuestUseNpc( env, 1, 2, EmotionType.NEUTRALMODE2, EmotionType.START_LOOT, false); } } return defaultQuestRewardDialog(env, 278501, 10002); }
@Override public boolean onKillEvent(QuestEnv env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); int targetId = env.getTargetId(); if (qs != null && qs.getStatus() == QuestStatus.START) { switch (targetId) { case 286904: case 281419: case 215795: { if (QuestService.collectItemCheck(env, true)) { return giveQuestItem(env, 182209634, 1); } } } } return false; }