@Override public boolean 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 != 182203019) return false; if (!ZoneService.getInstance().isInsideZone(player, ZoneName.Q2016)) return false; if (qs == null) return false; 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 true; }
@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 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 == 186000107) { if (!ZoneService.getInstance().isInsideZone(player, ZoneName.DEBILKARIM_FORGE_300160000)) return false; if (qs == null) return true; if (qs.getQuestVarById(0) != 0) return false; if (player.getInventory().getItemCountByItemId(101700759) == 0 || player.getInventory().getItemCountByItemId(186000099) == 0 || player.getInventory().getItemCountByItemId(186000106) < 20 || player.getInventory().getItemCountByItemId(186000107) == 0) return false; 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() { ItemService.addItems( player, Collections.singletonList(new QuestItems(182209739, 1))); PacketSendUtility.broadcastPacket( player, new SM_ITEM_USAGE_ANIMATION(player.getObjectId(), itemObjId, id, 0, 1, 0), true); player.getInventory().removeFromBagByItemId(186000099, 1); player.getInventory().removeFromBagByItemId(186000106, 20); player.getInventory().removeFromBagByItemId(186000107, 1); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); } }, 3000); return true; } return true; }