@Override public boolean onDialogEvent(QuestCookie env) { if (!super.defaultQuestOnDialogInitStart(env)) return false; QuestState qs = env.getPlayer().getQuestStateList().getQuestState(questId); int var = qs.getQuestVarById(0); if (qs.getStatus() == QuestStatus.START) { if (env.getTargetId() == 204052) { switch (env.getDialogId()) { case 26: if (var == 0) return sendQuestDialog(env, 1011); case 10255: return defaultCloseDialog(env, 0, 0, true, false); } } } else if (qs.getStatus() == QuestStatus.REWARD) { if (env.getTargetId() == 798800) { if (env.getDialogId() == -1) return sendQuestDialog(env, 10002); else if (env.getDialogId() == 18) QuestService.startQuest( new QuestCookie(env.getVisibleObject(), env.getPlayer(), 20001, env.getDialogId()), QuestStatus.LOCKED); return defaultQuestEndDialog(env); } } return false; }
@Override public boolean onDialogEvent(QuestCookie 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 == 203178) { switch (env.getDialogId()) { case 26: if (var == 0) return sendQuestDialog(env, 1011); case 10000: case 10001: 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 == 203178) return defaultQuestEndDialog(env); } return false; }
@Override public boolean onDialogEvent(QuestCookie env) { if (!super.defaultQuestOnDialogInitStart(env)) return false; Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); int var = qs.getQuestVarById(0); if (qs.getStatus() == QuestStatus.START) { switch (env.getTargetId()) { case 203540: 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 34: return defaultQuestItemCheck(env, 1, 0, true, 1438, 1353); } break; case 700095: if (env.getDialogId() == -1 && player.getInventory().getItemCountByItemId(182203008) < 7) return defaultQuestUseNpc( env, 1, 2, EmotionType.NEUTRALMODE2, EmotionType.START_LOOT, true); break; } } return defaultQuestRewardDialog(env, 203516, 1693); }
@Override public boolean onDialogEvent(QuestCookie env) { Player player = env.getPlayer(); if (defaultQuestNoneDialog(env, 204050, 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() == 204050) { 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, 204050, 2375); }
@Override public HandlerResult onItemUseEvent(final QuestCookie env, Item item) { final Player player = env.getPlayer(); final QuestState qs = player.getQuestStateList().getQuestState(questId); final int id = item.getItemTemplate().getTemplateId(); final int itemObjId = item.getObjectId(); if (id != 182204304 || qs == null) return HandlerResult.UNKNOWN; if (qs.getQuestVarById(0) != 15 || id != 182204304) return HandlerResult.FAILED; if (!ZoneService.getInstance().isInsideZone(player, ZoneName.BERITRAS_WEAPON_220040000)) 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); player.getInventory().removeFromBagByItemId(182204304, 1); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); } }, 3000); return HandlerResult.SUCCESS; }
@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 == 0) { if (env.getDialogId() == 1002) { QuestService.startQuest(env, QuestStatus.START); PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0)); return true; } } else if (targetId == 799939) // Emma { if (qs != null) { if (env.getDialogId() == 26 && qs.getStatus() == QuestStatus.START) { return sendQuestDialog(env, 2375); } else if (env.getDialogId() == 1009) { qs.setQuestVar(1); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return defaultQuestEndDialog(env); } else return defaultQuestEndDialog(env); } } return false; }
@Override public HandlerResult onItemUseEvent(final QuestCookie env, Item item) { final Player player = env.getPlayer(); final QuestState qs = player.getQuestStateList().getQuestState(questId); final int id = item.getItemTemplate().getTemplateId(); final int itemObjId = item.getObjectId(); if (id != 182201783 || qs == null) return HandlerResult.UNKNOWN; int var = qs.getQuestVars().getQuestVars(); if (var != 0 || qs.getStatus() != QuestStatus.START) return HandlerResult.FAILED; if (MathUtil.getDistance( 1677, 2520, 100, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ()) > 5) return HandlerResult.FAILED; int itemId1 = 110100150; int itemId2 = 113100144; boolean CheckitemId1 = false; boolean CheckitemId2 = false; List<Item> items1 = player.getEquipment().getEquippedItemsByItemId(itemId1); for (@SuppressWarnings("unused") Item ListeCheckitemId1 : items1) { CheckitemId1 = true; } List<Item> items2 = player.getEquipment().getEquippedItemsByItemId(itemId2); for (@SuppressWarnings("unused") Item ListeCheckitemId2 : items2) { CheckitemId2 = true; } if (!CheckitemId1 && CheckitemId2 || CheckitemId1 && !CheckitemId2 || !CheckitemId1 && !CheckitemId2) 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); player.getInventory().removeFromBagByObjectId(itemObjId, 1); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); } }, 3000); return HandlerResult.SUCCESS; }
@Override public HandlerResult onBonusApplyEvent(QuestCookie env, int index, AbstractInventoryBonus bonus) { if (!(bonus instanceof CoinBonus)) return HandlerResult.UNKNOWN; Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs != null && qs.getStatus() == QuestStatus.REWARD) { if (index == 0 && qs.getQuestVarById(0) == 0 || index == 1 && qs.getQuestVarById(0) == 1) return HandlerResult.SUCCESS; } return HandlerResult.FAILED; }
@Override public boolean onDialogEvent(QuestCookie 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 == 790019) { switch (env.getDialogId()) { case 26: { return sendQuestDialog(env, 4762); } case 1002: { if (player.getInventory().getItemCountByItemId(182201783) == 0) { if (!ItemService.addItems( player, Collections.singletonList(new QuestItems(182201783, 1)))) { return true; } } } default: return defaultQuestStartDialog(env); } } } if (qs == null) return false; if (qs.getStatus() == QuestStatus.REWARD) { switch (targetId) { case 790019: { switch (env.getDialogId()) { case 26: { return sendQuestDialog(env, 10002); } case 1009: { return sendQuestDialog(env, 5); } default: return defaultQuestEndDialog(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(11008); if (qs2 == null || qs2.getStatus() != QuestStatus.COMPLETE) return false; env.setQuestId(questId); QuestService.startQuest(env, QuestStatus.START); return true; }
@Override protected void writeImpl(AionConnection con, ByteBuffer buf) { writeH(buf, 0x01); writeH(buf, (-1 * startedQuestList.size()) & 0xFFFF); for (QuestState qs : startedQuestList) // quest list size ( retail max is 30 ) { writeH(buf, qs.getQuestId()); writeH(buf, 0); writeC(buf, qs.getStatus().value()); writeD(buf, qs.getQuestVars().getQuestVars()); writeC(buf, 0); } }
@Override public boolean onLvlUpEvent(QuestCookie env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs == null || qs.getStatus() == QuestStatus.NONE) { boolean lvlCheck = QuestService.checkLevelRequirement(questId, player.getCommonData().getLevel()); if (!lvlCheck) return false; QuestService.startQuest(env, QuestStatus.REWARD); return true; } 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 (targetId == mainNpcId) { if (qs == null || qs.getStatus() == QuestStatus.NONE) { if (env.getDialogId() == 26) return sendQuestDialog(env, 4762); else return defaultQuestStartDialog(env); } else if (qs.getStatus() == QuestStatus.REWARD) { return defaultQuestEndDialog(env); } } return false; }
/** * Check if a player is doing a quest for the given drop. * * @param player * @param drop * @return */ private static boolean hasQuestForDrop(Player player, QuestDrop drop) { int questId = drop.getQuestId(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs == null || qs.getStatus() != QuestStatus.START) return false; QuestTemplate template = questsData.getQuestById(questId); CollectItems collectItems = template.getCollectItems(); if (collectItems == null) return true; for (CollectItem collectItem : collectItems.getCollectItem()) { int collectItemId = collectItem.getItemId(); int dropItemId = drop.getItemId(); if (collectItemId != dropItemId) continue; long count = player.getInventory().getItemCountByItemId(collectItemId); if (collectItem.getCount() > count) return true; } 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; int var1 = qs.getQuestVarById(1); int var2 = qs.getQuestVarById(2); int var3 = qs.getQuestVarById(3); int targetId = env.getTargetId(); if ((targetId == 256617 || targetId == 253720 || targetId == 254513) && qs.getQuestVarById(0) == 2) { switch (targetId) { case 256617: if (var1 >= 0 && var1 < 60) { ++var1; qs.setQuestVarById(1, var1 + 1); updateQuestStatus(env); } break; case 253720: if (var2 >= 0 && var2 < 120) { ++var2; qs.setQuestVarById(2, var2 + 3); updateQuestStatus(env); } break; case 254513: if (var3 >= 0 && var3 < 240) { ++var3; qs.setQuestVarById(3, var3 + 7); updateQuestStatus(env); } break; } } if (qs.getQuestVarById(0) == 2 && var1 == 60 && var2 == 120 && var3 == 240) { qs.setQuestVarById(1, 60); updateQuestStatus(env); return true; } 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; int targetId = 0; if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId(); switch (targetId) { case 216886: if (qs.getQuestVarById(0) == 2) { qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return true; } } 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 == 798928) { 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.REWARD) { if (env.getDialogId() == -1) return sendQuestDialog(env, 10002); else if (env.getDialogId() == 1009) return sendQuestDialog(env, 5); else return defaultQuestEndDialog(env); } } else if (targetId == 799069) { if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) { if (env.getDialogId() == 26) return sendQuestDialog(env, 1011); 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 == 700948) { if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) { if (env.getDialogId() == -1) { if (!ItemService.addItems( player, Collections.singletonList(new QuestItems(182202193, 1)))) return true; final int targetObjectId = env.getVisibleObject().getObjectId(); PacketSendUtility.sendPacket( player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 0)); PacketSendUtility.broadcastPacket( player, new SM_EMOTION(player, EmotionType.START_LOOT, 0, targetObjectId), true); qs.setQuestVar(2); updateQuestStatus(env); } } } return false; }
@Override public boolean onDialogEvent(QuestCookie env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (defaultQuestNoneDialog(env, 203893, 182206112, 1)) return true; if (qs == null) return false; int var = qs.getQuestVarById(0); if (qs.getStatus() == QuestStatus.START) { switch (env.getTargetId()) { case 798072: switch (env.getDialogId()) { case 26: if (var == 0) return sendQuestDialog(env, 1352); case 10000: return defaultCloseDialog(env, 0, 1, 182206113, 1, 0, 0); } break; case 279020: switch (env.getDialogId()) { case 26: if (var == 1) return sendQuestDialog(env, 1693); case 10001: return defaultCloseDialog(env, 1, 2, 182206114, 1, 0, 0); } break; case 798053: switch (env.getDialogId()) { case 26: if (var == 2) return sendQuestDialog(env, 2034); case 10002: return defaultCloseDialog(env, 2, 3, true, false, 182206115, 1, 0, 0); } break; } } return defaultQuestRewardDialog(env, 798386, 2375); }
@Override public boolean onDialogEvent(final QuestCookie 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() == 26) return sendQuestDialog(env, 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, EmotionType.NEUTRALMODE2, 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, EmotionType.START_LOOT, 0, targetObjectId), true); qs.setQuestVarById(0, 1); updateQuestStatus(env); } }, 3000); } } case 205130: { if (qs.getQuestVarById(0) == 1) { if (env.getDialogId() == 26) return sendQuestDialog(env, 2375); else if (env.getDialogId() == 1009) { qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return defaultQuestEndDialog(env); } else return defaultQuestEndDialog(env); } } } } else if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 205130) return defaultQuestEndDialog(env); } return false; }
@Override public boolean onSkillUseEvent(QuestCookie env, int skillUsedId) { final Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs == null) return false; int var = qs.getQuestVarById(0); if (qs.getStatus() != QuestStatus.START) return false; if (skillUsedId == skillId) { if (var >= 0 && var < 9) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); return true; } else if (var == 9) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return true; } } 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 == 799336) // Tataka { if (env.getDialogId() == 26) { return sendQuestDialog(env, 1011); } else return defaultQuestStartDialog(env); } } if (qs == null) return false; if (qs == null || qs.getStatus() == QuestStatus.COMPLETE) { if (targetId == 799336) // Tataka { if (env.getDialogId() == 26) { return sendQuestDialog(env, 1011); } else return defaultQuestStartDialog(env); } } if (qs.getStatus() == QuestStatus.START) { switch (targetId) { case 799336: // Tataka switch (env.getDialogId()) { case 26: return sendQuestDialog(env, 2375); case 2034: return sendQuestDialog(env, 2034); case 34: // Siel's Supreme Mace (1) // Noxallon Ingot (1) if (QuestService.collectItemCheck(env, true)) { player.getInventory().removeFromBagByItemId(100100679, 1); // Siel's Supreme Mace player.getInventory().removeFromBagByItemId(186000095, 1); // Noxallon Ingot qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return sendQuestDialog(env, 5); } else { // Send check_user_item_fail to eddit-HtmlPages.xml return sendQuestDialog(env, 2716); } } break; // No match default: return defaultQuestStartDialog(env); } } else if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 799336) // Tataka return defaultQuestEndDialog(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 (qs == null || qs.getStatus() == QuestStatus.NONE) { if (targetId == 799017) // Sulinia { if (env.getDialogId() == 26) { return sendQuestDialog(env, 1011); } else return defaultQuestStartDialog(env); } } if (qs == null) return false; if (qs == null || qs.getStatus() == QuestStatus.COMPLETE) { if (targetId == 799017) // Sulinia { if (env.getDialogId() == 26) { return sendQuestDialog(env, 1011); } else return defaultQuestStartDialog(env); } } if (qs.getStatus() == QuestStatus.START) { switch (targetId) { case 799017: // Sulinia switch (env.getDialogId()) { case 26: return sendQuestDialog(env, 2375); case 2034: return sendQuestDialog(env, 2034); case 34: // Collect Balic Outer Scale (30) // Collect Kinah (150000) if (QuestService.collectItemCheck(env, true)) { player.getInventory().removeFromBagByItemId(182206839, 30); player.getInventory().removeFromBagByItemId(182400001, 150000); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return sendQuestDialog(env, 5); } else { // return sendQuestDialog(env, 2716); } } break; // default: return defaultQuestStartDialog(env); } } else if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 799017) // Sulinia return defaultQuestEndDialog(env); } return false; }
public static boolean startQuest(QuestCookie env, QuestStatus questStatus) { Player player = env.getPlayer(); int id = env.getQuestId(); QuestTemplate template = questsData.getQuestById(env.getQuestId()); if (id < 80000 && questStatus != QuestStatus.LOCKED) { if (!canStart(env)) return false; } PacketSendUtility.sendPacket(player, new SM_QUEST_ACCEPTED(1, id, questStatus, 0)); QuestState qs = player.getQuestStateList().getQuestState(id); if (qs == null) { qs = new QuestState(template.getId(), questStatus, 0, 0); player.getQuestStateList().addQuest(id, qs); } else { if (template.getMaxRepeatCount() >= qs.getCompleteCount()) { qs.setStatus(questStatus); qs.setQuestVar(0); } } player.getController().updateNearbyQuests(); return true; }
@Override public boolean onDialogEvent(QuestCookie env) { Player player = env.getPlayer(); if (defaultQuestNoneDialog(env, 203645)) 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() == 798039) { switch (env.getDialogId()) { case 26: if (var == 0) return sendQuestDialog(env, 1352); case 10000: return defaultCloseDialog(env, 0, 1, true, false, 182203231, 1, 0, 0); } } } return defaultQuestRewardDialog(env, 203645, 2375); }
@Override public boolean onDialogEvent(QuestCookie env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if ((qs == null || qs.getStatus() == QuestStatus.NONE) && !onLvlUpEvent(env)) return false; if (qs == null || qs.getStatus() == QuestStatus.NONE || qs.getStatus() == QuestStatus.COMPLETE && qs.getCompleteCount() < 10) { if (env.getTargetId() == 799778) { switch (env.getDialogId()) { case -1: return sendQuestDialog(env, 1011); case 1002: { PacketSendUtility.sendPacket( player, new SM_QUEST_ACCEPTED(1, questId, QuestStatus.START, 0)); if (qs == null) player.getQuestStateList().addQuest(questId, qs); else { qs.setStatus(QuestStatus.START); qs.setQuestVar(0); } player.getController().updateNearbyQuests(); return sendQuestDialog(env, 1003); } default: return defaultQuestStartDialog(env); } } return false; } int var = qs.getQuestVarById(0); if (qs.getStatus() == QuestStatus.START) { if (env.getTargetId() == 799778) { switch (env.getDialogId()) { case -1: case 26: if (var == 0) return sendQuestDialog(env, 2375); case 34: return defaultQuestItemCheck(env, 0, 1, true, 5, 2716); } } } return defaultQuestRewardDialog(env, 799778, 0); }
@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 == 799234) // Nep { if (qs == null || qs.getStatus() == QuestStatus.NONE) { if (env.getDialogId() == 26) return sendQuestDialog(env, 1011); else return defaultQuestStartDialog(env); } else if (qs != null && qs.getStatus() == QuestStatus.START) { if (env.getDialogId() == 26) return sendQuestDialog(env, 2375); else if (env.getDialogId() == 1009) { qs.setQuestVar(3); updateQuestStatus(env); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return defaultQuestEndDialog(env); } else return defaultQuestEndDialog(env); } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) { return defaultQuestEndDialog(env); } } else if (targetId == 204433) // Kistig { 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); } } return false; }
@Override public boolean onLvlUpEvent(QuestCookie env) { Calendar now = Calendar.getInstance(); Calendar cal1 = new GregorianCalendar(now.get(Calendar.YEAR), 11, 15); Calendar cal2 = new GregorianCalendar(now.get(Calendar.YEAR) + 1, 0, 5); Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (cal1.before(now) && cal2.after(now)) { if (!QuestService.checkLevelRequirement(questId, player.getCommonData().getLevel())) return false; // Start once if (qs == null || qs.getStatus() == QuestStatus.NONE) return QuestService.startQuest(env, QuestStatus.START); } else if (qs != null) { // Set as expired QuestEngine.getInstance().deleteQuest(player, questId); PacketSendUtility.sendPacket(player, new SM_QUEST_ACCEPTED(questId)); player.getController().updateNearbyQuests(); } return false; }
public static boolean canStart(QuestCookie env) { if (!checkNearBy(env, 0)) return false; Player player = env.getPlayer(); QuestTemplate template = questsData.getQuestById(env.getQuestId()); if (!checkStartConditions(player, template)) return false; if (template.getCombineSkill() != null) { SkillListEntry skill = player.getSkillList().getSkillEntry(template.getCombineSkill()); if (skill == null) return false; if (skill.getSkillLevel() < template.getCombineSkillPoint()) return false; if (template.getCombineSkillPoint() == 449 || template.getCombineSkillPoint() == 499) return true; if (skill.getSkillLevel() - 40 > template.getCombineSkillPoint()) return false; return true; } QuestState qs = player.getQuestStateList().getQuestState(template.getId()); if (qs != null && qs.getStatus().value() > 0) { return qs.canRepeat(template.getMaxRepeatCount()); } 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 (qs == null || qs.getStatus() == QuestStatus.NONE) { if (targetId == 216527) // Lupukin { if (env.getDialogId() == 26) { return sendQuestDialog(env, 1011); } else return defaultQuestStartDialog(env); } } if (qs == null) return false; if (qs == null || qs.getStatus() == QuestStatus.COMPLETE) { if (targetId == 216527) // Lupukin { if (env.getDialogId() == 26) { return sendQuestDialog(env, 1011); } else return defaultQuestStartDialog(env); } } if (qs.getStatus() == QuestStatus.START) { switch (targetId) { case 216527: // Lupukin switch (env.getDialogId()) { case 26: return sendQuestDialog(env, 2375); case 2034: return sendQuestDialog(env, 2034); case 34: // Collect Balaur Relics (6) if (QuestService.collectItemCheck(env, true)) { player.getInventory().removeFromBagByItemId(182209621, 6); // Balaur Relics qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return sendQuestDialog(env, 5); } else { return sendQuestDialog(env, 2716); } } break; // No match default: return defaultQuestStartDialog(env); } } else if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 216527) // Lupukin return defaultQuestEndDialog(env); } return false; }
public boolean questComplite(QuestCookie env) { Player player = env.getPlayer(); int id = env.getQuestId(); QuestState qs = player.getQuestStateList().getQuestState(id); if (qs == null || qs.getStatus() != QuestStatus.START) return false; qs.setQuestVarById(0, qs.getQuestVarById(0) + 1); qs.setStatus(QuestStatus.REWARD); PacketSendUtility.sendPacket( player, new SM_QUEST_ACCEPTED(2, id, qs.getStatus(), qs.getQuestVars().getQuestVars())); player.getController().updateNearbyQuests(); return true; }