private void destroy(final int var, QuestEnv env) { final int targetObjectId = env.getVisibleObject().getObjectId(); final Player player = env.getPlayer(); 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.getTarget().getObjectId() != 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); PacketSendUtility.broadcastPacket( player.getTarget(), new SM_EMOTION((Creature) player.getTarget(), EmotionType.EMOTE, 128, 0)); QuestState qs = player.getQuestStateList().getQuestState(questId); if (var == -1) PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 56)); qs.setQuestVarById(0, qs.getQuestVarById(0) + 1); updateQuestStatus(player, qs); } }, 3000); }
private void destroy(final int var, final QuestEnv env) { final int targetObjectId = env.getVisibleObject().getObjectId(); final Player player = env.getPlayer(); 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.getTarget() == null || player.getTarget().getObjectId() != 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); sendEmotion(env, player, EmotionId.STAND, true); QuestState qs = player.getQuestStateList().getQuestState(questId); if (var != -1) qs.setQuestVarById(0, var); else { playQuestMovie(env, 21); qs.setStatus(QuestStatus.REWARD); } updateQuestStatus(env); } }, 3000); }
@Override public void executeCommand(Player admin, String[] params) { if (admin.getAccessLevel() < AdminConfig.COMMAND_PRISON) { PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command!"); return; } if (params.length == 0 || params.length > 2) { PacketSendUtility.sendMessage(admin, "syntax //rprison <player>"); return; } try { Player playerFromPrison = World.getInstance().findPlayer(Util.convertName(params[0])); if (playerFromPrison != null) { PunishmentService.setIsInPrison(playerFromPrison, false, 0); PacketSendUtility.sendMessage( admin, "Player " + playerFromPrison.getName() + " removed from prison."); } } catch (NoSuchElementException nsee) { PacketSendUtility.sendMessage(admin, "Usage: //rprison <player>"); } catch (Exception e) { PacketSendUtility.sendMessage(admin, "Usage: //rprison <player>"); } }
@Override public void act(Player player, Item parentItem, HouseObject<?> targetHouseObject) { if (!player.getInventory().decreaseByObjectId(parentItem.getObjectId(), 1)) { return; } if (color.equals("no")) { targetHouseObject.setColor(null); } else { targetHouseObject.setColor(Integer.parseInt(color, 16)); } float x = targetHouseObject.getX(); float y = targetHouseObject.getY(); float z = targetHouseObject.getZ(); int rotation = targetHouseObject.getRotation(); PacketSendUtility.sendPacket(player, new SM_HOUSE_EDIT(7, 0, targetHouseObject.getObjectId())); PacketSendUtility.sendPacket( player, new SM_HOUSE_EDIT(5, targetHouseObject.getObjectId(), x, y, z, rotation)); targetHouseObject.spawn(); int objectName = targetHouseObject.getObjectTemplate().getNameId(); if (color.equals("no")) { PacketSendUtility.sendPacket( player, SM_SYSTEM_MESSAGE.STR_MSG_ITEM_PAINT_REMOVE_SUCCEED(objectName)); } else { int paintName = parentItem.getItemTemplate().getNameId(); PacketSendUtility.sendPacket( player, SM_SYSTEM_MESSAGE.STR_MSG_ITEM_PAINT_SUCCEED(objectName, paintName)); } }
@Override public boolean onDialogEvent(QuestEnv 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() == 25) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 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, 37, 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, 38, 0, targetObjectId), true); qs.setQuestVarById(0, 1); updateQuestStatus(player, qs); } }, 3000); } } case 205130: { if (qs.getQuestVarById(0) == 1) { if (env.getDialogId() == 25) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375); else if (env.getDialogId() == 1009) { qs.setStatus(QuestStatus.REWARD); updateQuestStatus(player, qs); return defaultQuestEndDialog(env); } else return defaultQuestEndDialog(env); } } } } else if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 205130) return defaultQuestEndDialog(env); } return false; }
@Override protected void handleDialogStart(Player player) { if (player.getInventory().getItemCountByItemId(186000236) > 0) { super.handleDialogStart(player); } else { PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(getObjectId(), 27)); PacketSendUtility.sendMessage( player, "You need item [item: 186000236] to ask reinforcements"); } }
@Override public boolean onDialogEvent(QuestEnv env) { final Player player = env.getPlayer(); final 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.REWARD) { if (targetId == 204501) return defaultQuestEndDialog(env); } else if (qs.getStatus() != QuestStatus.START) { return false; } if (targetId == 204020) { switch (env.getDialogId()) { case 25: if (var == 0) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011); case 10000: if (var == 0) { qs.setQuestVarById(0, var + 1); updateQuestStatus(player, qs); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } } } else if (targetId == 204501) { switch (env.getDialogId()) { case 25: if (var == 1) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352); else if (var == 2) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1693); case 33: if (QuestService.collectItemCheck(env, true)) { qs.setStatus(QuestStatus.REWARD); updateQuestStatus(player, qs); return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 5); } else return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 10001); case 1353: PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 191)); break; case 10001: if (var == 1) { qs.setQuestVarById(0, var + 1); updateQuestStatus(player, qs); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); 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 == 278039) { if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) { if (env.getDialogId() == 25) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352); else if (env.getDialogId() == 10000) { qs.setQuestVarById(0, qs.getQuestVarById(0) + 1); updateQuestStatus(player, qs); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } else return defaultQuestStartDialog(env); } } else if (targetId == 279027) { if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) { if (env.getDialogId() == 25) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1693); else if (env.getDialogId() == 10001) { qs.setQuestVarById(0, qs.getQuestVarById(0) + 1); updateQuestStatus(player, qs); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } else return defaultQuestStartDialog(env); } } else if (targetId == 798317) { if (qs != null) { if (env.getDialogId() == 25 && qs.getStatus() == QuestStatus.START) { return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375); } else if (env.getDialogId() == 1009) { ItemService.removeItemFromInventoryByItemId(player, 182207048); 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) { 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 == 798103) { if (qs == null || qs.getStatus() == QuestStatus.NONE) { if (env.getDialogId() == 25) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011); else return defaultQuestStartDialog(env); } else if (qs.getStatus() == QuestStatus.START) { if (env.getDialogId() == 25) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375); else if (env.getDialogId() == 1009) { qs.setQuestVar(3); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(player, qs); return defaultQuestEndDialog(env); } else return defaultQuestEndDialog(env); } else if (qs.getStatus() == QuestStatus.REWARD) { return defaultQuestEndDialog(env); } } else if (targetId == 798026) { if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) { if (env.getDialogId() == 25) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352); else if (env.getDialogId() == 10000) { qs.setQuestVarById(0, qs.getQuestVarById(0) + 1); updateQuestStatus(player, qs); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } else return defaultQuestStartDialog(env); } } else if (targetId == 798357) { if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) { if (env.getDialogId() == 25) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352); else if (env.getDialogId() == 10000) { qs.setQuestVarById(0, qs.getQuestVarById(0) + 1); updateQuestStatus(player, qs); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } else return defaultQuestStartDialog(env); } } return false; }
@Override public boolean onDie(Player player, Creature lastAttacker) { PacketSendUtility.broadcastPacket( player, new SM_EMOTION( player, EmotionType.DIE, 0, player.equals(lastAttacker) ? 0 : lastAttacker.getObjectId()), true); PacketSendUtility.sendPacket(player, new SM_DIE(false, false, 0, 8)); return true; }
public void startIronWallRegistration() { registerAvailable = true; startUregisterIronWallTask(); Iterator<Player> iter = World.getInstance().getPlayersIterator(); while (iter.hasNext()) { Player player = iter.next(); if (player.getLevel() > minlevel && player.getLevel() < maxlevel) { PacketSendUtility.sendPacket( player, new SM_AUTO_GROUP(maskId, SM_AUTO_GROUP.wnd_EntryIcon)); // You may participate in the Iron Wall Warfront. PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_MSG_INSTANCE_OPEN_BASTION_WAR); } } }
public void onEnterWorld(Player player) { switch (player.getRace()) { case ELYOS: if (player.getWorldId() == 700010000) { PacketSendUtility.sendPacket(player, new SM_TOWNS_LIST(elyosTowns)); } break; case ASMODIANS: if (player.getWorldId() == 710010000) { PacketSendUtility.sendPacket(player, new SM_TOWNS_LIST(asmosTowns)); } break; } }
@Override public boolean onDie(final Player player, Creature lastAttacker) { PacketSendUtility.broadcastPacket( player, new SM_EMOTION( player, EmotionType.DIE, 0, player.equals(lastAttacker) ? 0 : lastAttacker.getObjectId()), true); PacketSendUtility.sendPacket( player, new SM_DIE(player.haveSelfRezEffect(), player.haveSelfRezItem(), 0, 8)); return true; }
@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 == 204754) { if (qs == null || qs.getStatus() == QuestStatus.NONE) { if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1011); else return sendQuestStartDialog(env); } else if (qs != null && qs.getStatus() == QuestStatus.START) { if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 2375); else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()) { qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } else return sendQuestEndDialog(env); } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) { return sendQuestEndDialog(env); } } else if (targetId == 204701) { if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) { if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1352); else if (env.getDialog() == DialogAction.SETPRO1) { 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 == 204768) { if (qs != null) { if (env.getDialog() == DialogAction.QUEST_SELECT && qs.getStatus() == QuestStatus.START) return sendQuestDialog(env, 2375); else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id() && 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; }
/** * Check if the skill can be used * * @return True if the skill can be used */ public boolean canUseSkill() { Properties properties = skillTemplate.getProperties(); if (properties != null && !properties.validate(this)) { log.debug("properties failed"); return false; } if (!preCastCheck()) return false; // check for counter skill if (effector instanceof Player) { Player player = (Player) effector; if (this.skillTemplate.getCounterSkill() != null) { long time = player.getLastCounterSkill(skillTemplate.getCounterSkill()); if ((time + 5000) < System.currentTimeMillis()) { log.debug("chain skill failed, too late"); return false; } } if (skillMethod == SkillMethod.ITEM && duration > 0 && player.getMoveController().isInMove()) { PacketSendUtility.sendPacket( player, SM_SYSTEM_MESSAGE.STR_ITEM_CANCELED(new DescriptionId(getItemTemplate().getNameId()))); return false; } } if (!validateEffectedList()) return false; return true; }
@Override public boolean canAct(Player player, Item parentItem, HouseObject<?> targetHouseObject) { if (targetHouseObject == null) { PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_ITEM_COLOR_ERROR); return false; } if (color.equals("no") && targetHouseObject.getColor() == null) { PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_MSG_ITEM_PAINT_ERROR_CANNOTREMOVE); return false; } boolean canPaint = targetHouseObject.getObjectTemplate().getCanDye(); if (!canPaint) { PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_MSG_ITEM_PAINT_ERROR_CANNOTPAINT); } return canPaint; }
@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 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 void act(Player player, Item parentItem, Item targetItem) { if (!player.getInventory().decreaseByObjectId(parentItem.getObjectId(), 1)) { return; } if (targetItem.getItemSkinTemplate().isItemDyePermitted()) { if (getColorBGRA() == 0) { targetItem.setItemColor(0); targetItem.setColorExpireTime(0); } else { targetItem.setItemColor(parentItem.getItemTemplate().getTemplateId()); if (minutes != null) { targetItem.setColorExpireTime((int) (System.currentTimeMillis() / 1000 + minutes * 60)); } } // item is equipped, so need broadcast packet if (player.getEquipment().getEquippedItemByObjId(targetItem.getObjectId()) != null) { PacketSendUtility.broadcastPacket( player, new SM_UPDATE_PLAYER_APPEARANCE( player.getObjectId(), player.getEquipment().getEquippedForApparence()), true); player.getEquipment().setPersistentState(PersistentState.UPDATE_REQUIRED); } // item is not equipped else { player.getInventory().setPersistentState(PersistentState.UPDATE_REQUIRED); } ItemPacketService.updateItemAfterInfoChange(player, targetItem); } }
@Override public boolean onItemUseEvent(QuestEnv env, Item item) { final Player player = env.getPlayer(); final int id = item.getItemTemplate().getTemplateId(); final int itemObjId = item.getObjectId(); if (id != 182200007) return false; if (!zoneService.isInsideZone(player, ZoneName.ITEMUSE_Q1006)) return false; final QuestState qs = player.getQuestStateList().getQuestState(questId); 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); itemService.addItems( player, Collections.singletonList(new QuestItems(182200008, 1))); qs.setQuestVarById(0, 2); updateQuestStatus(player, qs); } }, 3000); return true; }
@Override public HandlerResult onItemUseEvent(final QuestEnv env, Item item) { final Player player = env.getPlayer(); final int id = item.getItemTemplate().getTemplateId(); final int itemObjId = item.getObjectId(); if (id != 182204123) { return HandlerResult.UNKNOWN; } 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 protected void startUsage(Creature creature) { Player player = (Player) creature; // TODO extract method Creature target = creature.getTarget(); if (target == null) { return; } final int unk = 0; PacketSendUtility.broadcastPacket( player, new SM_CASTSPELL( player.getObjectId(), getSkillId(), getSkillTemplate().getLevel(), unk, target.getObjectId(), getSkillTemplate().getDuration()), true); // TODO magic skill >1 lvl can be instant - check from template "type" schedulePerformAction(player, getSkillTemplate().getDuration()); }
@Override public HandlerResult onItemUseEvent(final QuestEnv 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 != 182206726) { return HandlerResult.UNKNOWN; } 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); removeQuestItem(env, 182206726, 1); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); } }, 1000); return HandlerResult.SUCCESS; }
@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; }
@Override protected void handleAttack(Creature creature) { if (getLifeStats().isFullyRestoredHp()) { for (Player member : getOwner().getCurrentMemberList()) { PacketSendUtility.sendPacket(member, SM_SYSTEM_MESSAGE.STR_BINDSTONE_IS_ATTACKED); } } }
@Override public boolean onDialogSelect(Player player, int dialogId, int questId, int extendedRewardIndex) { DialogPage page = DialogPage.getPageByAction(dialogId); if (page == DialogPage.NULL) return false; PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(getOwner().getObjectId(), page.id())); return true; }
@Override public boolean canAct(Player player, Item parentItem, Item targetItem) { if (targetItem == null) { // no item selected. PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_ITEM_ERROR); return false; } return true; }
@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 == 204777) { if (qs == null || qs.getStatus() == QuestStatus.NONE) { if (env.getDialog() == DialogAction.QUEST_SELECT) { 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 == 204777) { if (env.getDialog() == DialogAction.USE_OBJECT) { return sendQuestDialog(env, 2375); } else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()) { return sendQuestDialog(env, 5); } else { return sendQuestEndDialog(env); } } } else if (qs.getStatus() != QuestStatus.START) { return false; } if (targetId == 204790) { switch (env.getDialog()) { case QUEST_SELECT: if (var == 0) { return sendQuestDialog(env, 1352); } case SETPRO1: if (var == 0) { qs.setQuestVarById(0, var + 1); qs.setStatus(QuestStatus.REWARD); if (!giveQuestItem(env, 182204489, 1)) { updateQuestStatus(env); } PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } return false; } } return false; }
/** {@inheritDoc} */ @Override protected void runImpl() { Player player = getConnection().getActivePlayer(); ItemService.moveItem(player, targetObjectId, source, destination, slot); PacketSendUtility.broadcastPacket(player, new SM_EMOTION(player, 36, 0, 0)); // sendPacket(new SM_LOOT_STATUS(targetObjectId,3)); }
@Override public boolean onReviveEvent(Player player) { PlayerReviveService.revive(player, 25, 25, false, 0); player.getGameStats().updateStatsAndSpeedVisually(); PacketSendUtility.sendPacket(player, STR_REBIRTH_MASSAGE_ME); TeleportService2.teleportTo( player, mapId, instanceId, 749.6575f, 558.4166f, 572.97394f, (byte) 90); return true; }