@Override public void runImpl() throws Exception { NpcInstance npc1 = GameObjectsStorage.getAsNpc(_storedId); Functions.npcShout(npc1, NpcString.FURNFACE4); for (NpcInstance npc : GameObjectsStorage.getAllNpcs()) { if (npc != null && npc.getNpcId() == 18913 && getDistance(npc) <= 1200) { ((FurnfaceInstance) npc).setSCE_GAME_PLAYER_START(); } } i_ai0 = 1; }
@Override public void runImpl() throws Exception { NpcInstance npc = GameObjectsStorage.getAsNpc(_storedId); Functions.npcShout(npc, NpcString.FURNFACE3); GAME_TIME_EXPIRED = ThreadPoolManager.getInstance().schedule(new GAME_TIME_EXPIRED(), 10 * 1000); }
public void killNpcByObjectId(int _objId) { NpcInstance npc = GameObjectsStorage.getNpc(_objId); if (npc != null) { npc.doDie(null); } else { _log.warn("Attemp to kill object that is not npc in quest " + getQuest().getQuestIntId()); } }
@Override public void runImpl() throws Exception { for (NpcInstance npc : GameObjectsStorage.getAllNpcs()) { if (npc != null && npc.getNpcId() == 18913 && getDistance(npc) <= 1200) { ((FurnfaceInstance) npc).setActive2114001(i_ai9); } } PC_TURN = ThreadPoolManager.getInstance().schedule(new PC_TURN(), interval_time * 1000); }
public static boolean deleteOrder(int storedId) { if (!_orderMap.containsKey(storedId)) return false; Functions.addItem( World.getPlayer(storedId), _orderMap.get(storedId).getItemId(), _orderMap.get(storedId).getItemCount() * _orderMap.get(storedId).getKillsCount()); _orderMap.remove(storedId); _inList.remove((Object) storedId); deleteFromDatabase(storedId); GameObjectsStorage.getPlayer(storedId).setIsOrdered(false); return true; }
@Override public void runImpl() throws Exception { NpcInstance npc = GameObjectsStorage.getAsNpc(_storedId); Functions.npcShout(npc, NpcString.FURNFACE2); switch (getAISpawnParam()) { case 1: HURRY_UP2_1 = ThreadPoolManager.getInstance().schedule(new HURRY_UP2(), 60 * 1000); break; case 2: HURRY_UP2_2 = ThreadPoolManager.getInstance().schedule(new HURRY_UP2(), 60 * 1000); break; } }
public void setSCE_POT_ON(int i) { if (i == i_ai1 && i_ai0 == 1) { if (i_quest9 == 1) {} i_ai0 = 2; } else if (i == i_ai2 && i_ai0 == 2) { if (i_quest9 == 1) {} i_ai0 = 3; } else if (i == i_ai3 && i_ai0 == 3) { if (i_quest9 == 1) {} i_ai0 = 4; } else if (i == i_ai4 && i_ai0 == 4) { if (i_quest9 == 1) {} i_ai0 = 5; } else if (i == i_ai5 && i_ai0 == 5) { if (i_quest9 == 1) {} i_ai0 = 6; } else if (i == i_ai6 && i_ai0 == 6) { if (i_quest9 == 1) {} i_ai0 = 7; } else if (i == i_ai7 && i_ai0 == 7) { if (i_quest9 == 1) {} i_ai0 = 8; } else if (i == i_ai8 && i_ai0 == 8) { if (i_quest9 == 1) {} i_ai0 = 9; } else if (i == i_ai9 && i_ai0 == 9) { if (i_quest9 == 1) {} for (NpcInstance npc : GameObjectsStorage.getAllNpcs()) { if (npc != null && npc.getNpcId() == 18913 && getDistance(npc) <= 1200) { ((FurnfaceInstance) npc).setSCE_GAME_END(); } } SimpleSpawner sp = new SimpleSpawner(NpcHolder.getInstance().getTemplate(18934)); switch (getAISpawnParam()) { case 1: sp.setLoc(new Location(110772, -82063, -1584)); break; case 2: sp.setLoc(new Location(114915, -70998, -544)); break; } sp.doSpawn(true); Functions.npcShout(this, NpcString.FURNFACE6); switch (getAISpawnParam()) { case 1: if (HURRY_UP_1 != null) { HURRY_UP_1.cancel(false); HURRY_UP_1 = null; } if (HURRY_UP2_1 != null) { HURRY_UP2_1.cancel(false); HURRY_UP2_1 = null; } break; case 2: if (HURRY_UP_2 != null) { HURRY_UP_2.cancel(false); HURRY_UP_2 = null; } if (HURRY_UP2_2 != null) { HURRY_UP2_2.cancel(false); HURRY_UP2_2 = null; } break; } c_ai0 = null; i_quest0 = 0; i_quest1 = 0; } else { for (NpcInstance npc : GameObjectsStorage.getAllNpcs()) { if (npc != null && npc.getNpcId() == 18913 && getDistance(npc) <= 1200) { ((FurnfaceInstance) npc).setSCE_GAME_FAILURE(); } } if (i_quest9 == 1) { } else if (i_quest0 < 2) { i_quest0 = i_quest0 + 1; Functions.npcShout(this, NpcString.FURNFACE7); i_quest1 = 0; } else { switch (getAISpawnParam()) { case 1: if (HURRY_UP_1 != null) { HURRY_UP_1.cancel(false); HURRY_UP_1 = null; } if (HURRY_UP2_1 != null) { HURRY_UP2_1.cancel(false); HURRY_UP2_1 = null; } break; case 2: if (HURRY_UP_2 != null) { HURRY_UP_2.cancel(false); HURRY_UP_2 = null; } if (HURRY_UP2_2 != null) { HURRY_UP2_2.cancel(false); HURRY_UP2_2 = null; } break; } Functions.npcShout(this, NpcString.FURNFACE8); c_ai0 = null; i_quest0 = 0; i_quest1 = 0; } } }
@SuppressWarnings("rawtypes") @Override public boolean useAdminCommand( Enum comm, String[] wordList, String fullString, Player activeChar) { Commands command = (Commands) comm; if (!activeChar.getPlayerAccess().CanTeleport) return false; switch (command) { case admin_show_moves: activeChar.sendPacket(new NpcHtmlMessage(5).setFile("admin/teleports.htm")); break; case admin_show_moves_other: activeChar.sendPacket(new NpcHtmlMessage(5).setFile("admin/tele/other.htm")); break; case admin_show_teleport: showTeleportCharWindow(activeChar); break; case admin_teleport_to_character: teleportToCharacter(activeChar, activeChar.getTarget()); break; case admin_teleport_to: case admin_teleportto: if (wordList.length < 2) { activeChar.sendMessage("USAGE: //teleportto charName"); return false; } String chaName = Util.joinStrings(" ", wordList, 1); Player cha = GameObjectsStorage.getPlayer(chaName); if (cha == null) { activeChar.sendMessage("Player '" + chaName + "' not found in world"); return false; } teleportToCharacter(activeChar, cha); break; case admin_move_to: case admin_moveto: case admin_teleport: if (wordList.length < 2) { activeChar.sendMessage("USAGE: //teleport x y z [ref]"); return false; } teleportTo( activeChar, activeChar, Util.joinStrings(" ", wordList, 1, 3), ArrayUtils.valid(wordList, 4) != null && !ArrayUtils.valid(wordList, 4).isEmpty() ? Integer.parseInt(wordList[4]) : 0); break; case admin_walk: if (wordList.length < 2) { activeChar.sendMessage("USAGE: //walk x y z"); return false; } try { activeChar.moveToLocation(Location.parseLoc(Util.joinStrings(" ", wordList, 1)), 0, true); } catch (IllegalArgumentException e) { activeChar.sendMessage("USAGE: //walk x y z"); return false; } break; case admin_gonorth: case admin_gosouth: case admin_goeast: case admin_gowest: case admin_goup: case admin_godown: int val = wordList.length < 2 ? 150 : Integer.parseInt(wordList[1]); int x = activeChar.getX(); int y = activeChar.getY(); int z = activeChar.getZ(); if (command == Commands.admin_goup) z += val; else if (command == Commands.admin_godown) z -= val; else if (command == Commands.admin_goeast) x += val; else if (command == Commands.admin_gowest) x -= val; else if (command == Commands.admin_gosouth) y += val; else if (command == Commands.admin_gonorth) y -= val; activeChar.teleToLocation(x, y, z); showTeleportWindow(activeChar); break; case admin_tele: showTeleportWindow(activeChar); break; case admin_teleto: case admin_tele_to: case admin_instant_move: if (wordList.length > 1 && wordList[1].equalsIgnoreCase("r")) activeChar.setTeleMode(2); else if (wordList.length > 1 && wordList[1].equalsIgnoreCase("end")) activeChar.setTeleMode(0); else activeChar.setTeleMode(1); break; case admin_tonpc: case admin_to_npc: if (wordList.length < 2) { activeChar.sendMessage("USAGE: //tonpc npcId|npcName"); return false; } String npcName = Util.joinStrings(" ", wordList, 1); NpcInstance npc; try { if ((npc = GameObjectsStorage.getByNpcId(Integer.parseInt(npcName))) != null) { teleportToCharacter(activeChar, npc); return true; } } catch (Exception e) { } if ((npc = GameObjectsStorage.getNpc(npcName)) != null) { teleportToCharacter(activeChar, npc); return true; } activeChar.sendMessage("Npc " + npcName + " not found"); break; case admin_toobject: if (wordList.length < 2) { activeChar.sendMessage("USAGE: //toobject objectId"); return false; } Integer target = Integer.parseInt(wordList[1]); GameObject obj; if ((obj = GameObjectsStorage.findObject(target)) != null) { teleportToCharacter(activeChar, obj); return true; } activeChar.sendMessage("Object " + target + " not found"); break; default: break; } if (!activeChar.getPlayerAccess().CanEditChar) return false; switch (command) { case admin_teleport_character: if (wordList.length < 2) { activeChar.sendMessage("USAGE: //teleport_character x y z"); return false; } teleportCharacter(activeChar, Util.joinStrings(" ", wordList, 1)); showTeleportCharWindow(activeChar); break; case admin_recall: if (wordList.length < 2) { activeChar.sendMessage("USAGE: //recall charName"); return false; } String targetName = Util.joinStrings(" ", wordList, 1); Player recall_player = GameObjectsStorage.getPlayer(targetName); if (recall_player != null) { teleportTo(activeChar, recall_player, activeChar.getLoc(), activeChar.getReflectionId()); return true; } int obj_id = CharacterDAO.getInstance().getObjectIdByName(targetName); if (obj_id > 0) { teleportCharacter_offline(obj_id, activeChar.getLoc()); activeChar.sendMessage(targetName + " is offline. Offline teleport used..."); } else activeChar.sendMessage("->" + targetName + "<- is incorrect."); break; case admin_setref: { if (wordList.length < 2) { activeChar.sendMessage("Usage: //setref <reflection>"); return false; } int ref_id = Integer.parseInt(wordList[1]); if (ref_id != 0 && ReflectionManager.getInstance().get(ref_id) == null) { activeChar.sendMessage("Reflection <" + ref_id + "> not found."); return false; } GameObject target = activeChar; GameObject obj = activeChar.getTarget(); if (obj != null) target = obj; target.setReflection(ref_id); target.decayMe(); target.spawnMe(); break; } case admin_getref: if (wordList.length < 2) { activeChar.sendMessage("Usage: //getref <char_name>"); return false; } Player cha = GameObjectsStorage.getPlayer(wordList[1]); if (cha == null) { activeChar.sendMessage("Player '" + wordList[1] + "' not found in world"); return false; } activeChar.sendMessage( "Player '" + wordList[1] + "' in reflection: " + activeChar.getReflectionId() + ", name: " + activeChar.getReflection().getName()); break; default: break; } if (!activeChar.getPlayerAccess().CanEditNPC) return false; switch (command) { case admin_recall_npc: recallNPC(activeChar); break; default: break; } return true; }
@Override public String onKill(NpcInstance npc, QuestState st) { int npcId = npc.getNpcId(); int cond = st.getCond(); for (int i = 0; i < DROPLIST_COND.length; i++) { if (cond == DROPLIST_COND[i][0] && npcId == DROPLIST_COND[i][2]) { if (DROPLIST_COND[i][3] == 0 || st.getQuestItemsCount(DROPLIST_COND[i][3]) > 0) { if (DROPLIST_COND[i][5] == 0) { st.rollAndGive(DROPLIST_COND[i][4], DROPLIST_COND[i][7], DROPLIST_COND[i][6]); } else if (st.rollAndGive( DROPLIST_COND[i][4], DROPLIST_COND[i][7], DROPLIST_COND[i][7], DROPLIST_COND[i][5], DROPLIST_COND[i][6])) { if (DROPLIST_COND[i][1] != cond && DROPLIST_COND[i][1] != 0) { st.setCond(Integer.valueOf(DROPLIST_COND[i][1])); st.setState(STARTED); } } } } } if (cond == 18 && st.getQuestItemsCount(BoneFragment1) != 0 && st.getQuestItemsCount(BoneFragment2) != 0 && st.getQuestItemsCount(BoneFragment3) != 0 && st.getQuestItemsCount(BoneFragment4) != 0 && st.getQuestItemsCount(BoneFragment5) != 0) { st.setCond(19); st.setState(STARTED); } else if (npcId == NamelessRevenant && (cond == 1 || cond == 2)) { if (st.getQuestItemsCount(RippedDiary) < 6) { st.giveItems(RippedDiary, 1); } else if (GameObjectsStorage.getByNpcId(Aruraune) == null) { st.takeItems(RippedDiary, -1); st.setCond(2); st.setState(STARTED); st.addSpawn(Aruraune); st.startQuestTimer("Wait1", 300000); } else if (!st.isRunningQuestTimer("Wait1")) { st.startQuestTimer("Wait1", 300000); } } else if (npcId == Aruraune) { NpcInstance isQuest = GameObjectsStorage.getByNpcId(Aruraune); if (isQuest != null) { isQuest.deleteMe(); } if (cond == 2) { if (st.getQuestItemsCount(HugeNail) == 0) { st.giveItems(HugeNail, 1); } st.setCond(3); st.setState(STARTED); st.cancelQuestTimer("Wait1"); } } else if (npcId == OlMahumInspector) { NpcInstance isQuest = GameObjectsStorage.getByNpcId(OlMahumInspector); if (isQuest != null) { isQuest.deleteMe(); } st.cancelQuestTimer("Wait2"); if (cond == 6) { st.setCond(7); st.setState(STARTED); } } else if (npcId == OlMahumBetrayer) { NpcInstance isQuest = GameObjectsStorage.getByNpcId(OlMahumBetrayer); if (isQuest != null) { isQuest.deleteMe(); } st.cancelQuestTimer("Wait3"); if (cond == 8) { if (st.getQuestItemsCount(LetterOfBetrayer) == 0) { st.giveItems(LetterOfBetrayer, 1); } st.setCond(9); st.setState(STARTED); } } else if (npcId == CrimsonWerewolf) { NpcInstance isQuest = GameObjectsStorage.getByNpcId(CrimsonWerewolf); if (isQuest != null) { isQuest.deleteMe(); } st.cancelQuestTimer("Wait4"); if (cond == 12) { st.setCond(13); st.setState(STARTED); } } else if (npcId == KrudelLizardman) { NpcInstance isQuest = GameObjectsStorage.getByNpcId(KrudelLizardman); if (isQuest != null) { isQuest.deleteMe(); } st.cancelQuestTimer("Wait5"); if (cond == 15) { st.setCond(16); st.setState(STARTED); } } return null; }
@Override public String onTalk(NpcInstance npc, QuestState st) { int npcId = npc.getNpcId(); String htmltext = "noquest"; int cond = st.getCond(); if (npcId == Pupina) { if (st.getQuestItemsCount(MarkOfReformer) != 0) { htmltext = "completed"; st.exitCurrentQuest(true); } else if (cond == 0) { if (st.getPlayer().getClassId().getId() == 0x0f || st.getPlayer().getClassId().getId() == 0x2a) { if (st.getPlayer().getLevel() >= 39) { htmltext = "30118-03.htm"; } else { htmltext = "30118-01.htm"; st.exitCurrentQuest(true); } } else { htmltext = "30118-02.htm"; st.exitCurrentQuest(true); } } else if (cond == 3) { htmltext = "30118-05.htm"; } else if (cond >= 4) { htmltext = "30118-07.htm"; } } else if (npcId == Sla) { if (cond == 4) { htmltext = "30666-01.htm"; } else if (cond == 5) { htmltext = "30666-05.htm"; } else if (cond == 10) { st.takeItems(OlMahumMoney, -1); st.giveItems(Greetings, 3); htmltext = "30666-06.htm"; st.setCond(11); st.setState(STARTED); } else if (cond == 20) { st.takeItems(KatarisLetter, -1); st.takeItems(KakansLetter, -1); st.takeItems(NyakurisLetter, -1); st.takeItems(RamussLetter, -1); st.giveItems(MarkOfReformer, 1); if (!st.getPlayer().getVarB("prof2.3")) { st.addExpAndSp(1252844, 85972); st.giveItems(ADENA_ID, 226528); st.getPlayer().setVar("prof2.3", "1", -1); } htmltext = "30666-07.htm"; st.playSound(SOUND_FINISH); st.exitCurrentQuest(true); } } else if (npcId == Katari) { if (cond == 5 || cond == 6) { NpcInstance NPC = GameObjectsStorage.getByNpcId(OlMahumPilgrimNPC); NpcInstance Mob = GameObjectsStorage.getByNpcId(OlMahumInspector); if (NPC == null && Mob == null) { st.takeItems(SlasLetter, -1); htmltext = "30668-01.htm"; st.setCond(6); st.setState(STARTED); st.addSpawn(OlMahumPilgrimNPC); st.addSpawn(OlMahumInspector); st.startQuestTimer("Wait2", 300000); } else { if (!st.isRunningQuestTimer("Wait2")) { st.startQuestTimer("Wait2", 300000); } htmltext = "<html><head><body>Please wait 5 minutes</body></html>"; } } else if (cond == 8) { if (GameObjectsStorage.getByNpcId(OlMahumBetrayer) == null) { htmltext = "30668-02.htm"; st.addSpawn(OlMahumBetrayer); st.startQuestTimer("Wait3", 300000); } else { if (!st.isRunningQuestTimer("Wait3")) { st.startQuestTimer("Wait3", 300000); } htmltext = "<html><head><body>Please wait 5 minutes</body></html>"; } } else if (cond == 9) { st.takeItems(LetterOfBetrayer, -1); st.giveItems(KatarisLetter, 1); htmltext = "30668-03.htm"; st.setCond(10); st.setState(STARTED); } } else if (npcId == OlMahumPilgrimNPC) { if (cond == 7) { st.giveItems(OlMahumMoney, 1); htmltext = "30732-01.htm"; st.setCond(8); st.setState(STARTED); NpcInstance isQuest = GameObjectsStorage.getByNpcId(OlMahumInspector); if (isQuest != null) { isQuest.deleteMe(); } isQuest = GameObjectsStorage.getByNpcId(OlMahumPilgrimNPC); if (isQuest != null) { isQuest.deleteMe(); } st.cancelQuestTimer("Wait2"); } } else if (npcId == Kakan) { if (cond == 11 || cond == 12) { htmltext = "30669-01.htm"; } else if (cond == 13) { st.takeItems(Greetings, 1); st.giveItems(KakansLetter, 1); htmltext = "30669-04.htm"; st.setCond(14); st.setState(STARTED); } } else if (npcId == Nyakuri) { if (cond == 14 || cond == 15) { htmltext = "30670-01.htm"; } else if (cond == 16) { st.takeItems(Greetings, 1); st.giveItems(NyakurisLetter, 1); htmltext = "30670-04.htm"; st.setCond(17); st.setState(STARTED); } } else if (npcId == Ramus) { if (cond == 17) { st.takeItems(Greetings, -1); st.giveItems(UndeadList, 1); htmltext = "30667-01.htm"; st.setCond(18); st.setState(STARTED); } else if (cond == 19) { st.takeItems(BoneFragment1, -1); st.takeItems(BoneFragment2, -1); st.takeItems(BoneFragment3, -1); st.takeItems(BoneFragment4, -1); st.takeItems(BoneFragment5, -1); st.takeItems(UndeadList, -1); st.giveItems(RamussLetter, 1); htmltext = "30667-03.htm"; st.setCond(20); st.setState(STARTED); } } return htmltext; }
@Override public String onEvent(String event, QuestState st, NpcInstance npc) { String htmltext = event; if (event.equalsIgnoreCase("30118-04.htm")) { st.giveItems(BookOfReform, 1); if (!st.getPlayer().getVarB("dd3")) { st.giveItems(7562, 60); st.getPlayer().setVar("dd3", "1", -1); } st.setCond(1); st.setState(STARTED); st.playSound(SOUND_ACCEPT); } else if (event.equalsIgnoreCase("30118-06.htm")) { st.takeItems(HugeNail, -1); st.takeItems(BookOfReform, -1); st.giveItems(LetterOfIntroduction, 1); st.setCond(4); st.setState(STARTED); } else if (event.equalsIgnoreCase("30666-04.htm")) { st.takeItems(LetterOfIntroduction, -1); st.giveItems(SlasLetter, 1); st.setCond(5); st.setState(STARTED); } else if (event.equalsIgnoreCase("30669-03.htm")) { if (GameObjectsStorage.getByNpcId(CrimsonWerewolf) == null) { st.setCond(12); st.setState(STARTED); st.addSpawn(CrimsonWerewolf); st.startQuestTimer("Wait4", 300000); } else { if (!st.isRunningQuestTimer("Wait4")) { st.startQuestTimer("Wait4", 300000); } htmltext = "<html><head><body>Please wait 5 minutes</body></html>"; } } else if (event.equalsIgnoreCase("30670-03.htm")) { if (GameObjectsStorage.getByNpcId(KrudelLizardman) == null) { st.setCond(15); st.setState(STARTED); st.addSpawn(KrudelLizardman); st.startQuestTimer("Wait5", 300000); } else { if (!st.isRunningQuestTimer("Wait5")) { st.startQuestTimer("Wait5", 300000); } htmltext = "<html><head><body>Please wait 5 minutes</body></html>"; } } else if (event.equalsIgnoreCase("Wait1")) { NpcInstance isQuest = GameObjectsStorage.getByNpcId(Aruraune); if (isQuest != null) { isQuest.deleteMe(); } if (st.getCond() == 2) { st.setCond(1); } return null; } else if (event.equalsIgnoreCase("Wait2")) { NpcInstance isQuest = GameObjectsStorage.getByNpcId(OlMahumInspector); if (isQuest != null) { isQuest.deleteMe(); } isQuest = GameObjectsStorage.getByNpcId(OlMahumPilgrimNPC); if (isQuest != null) { isQuest.deleteMe(); } if (st.getCond() == 6) { st.setCond(5); } return null; } else if (event.equalsIgnoreCase("Wait3")) { NpcInstance isQuest = GameObjectsStorage.getByNpcId(OlMahumBetrayer); if (isQuest != null) { isQuest.deleteMe(); } return null; } else if (event.equalsIgnoreCase("Wait4")) { NpcInstance isQuest = GameObjectsStorage.getByNpcId(CrimsonWerewolf); if (isQuest != null) { isQuest.deleteMe(); } if (st.getCond() == 12) { st.setCond(11); } return null; } else if (event.equalsIgnoreCase("Wait5")) { NpcInstance isQuest = GameObjectsStorage.getByNpcId(KrudelLizardman); if (isQuest != null) { isQuest.deleteMe(); } if (st.getCond() == 15) { st.setCond(14); } return null; } return htmltext; }