@Override public boolean onQuestFinishEvent(QuestEnv env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs != null && qs.getStatus() == QuestStatus.REWARD) { teleportService.teleportTo(player, 210010000, 1, 242, 1638, 100, (byte) 20, 0); return true; } return false; }
@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.START) { switch (targetId) { case 204191: { switch (env.getDialogId()) { case 25: if (var == 0) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352); break; case 10000: if (var == 0) { qs.setQuestVarById(0, var + 1); updateQuestStatus(player, qs); TeleportService.teleportTo( player, 220030000, player.getInstanceId(), 1748f, 1807f, 255f, 1000); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0)); return true; } } } case 203559: switch (env.getDialogId()) { case 25: if (var == 1) { qs.setStatus(QuestStatus.REWARD); updateQuestStatus(player, qs); return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375); } } } } else if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 203559) { return defaultQuestEndDialog(env); } } return false; }
/** {@inheritDoc} */ @Override protected void runImpl() { Player activePlayer = getConnection().getActivePlayer(); activePlayer.setLifeStats( new PlayerLifeStats( activePlayer, activePlayer.getPlayerStatsTemplate().getMaxHp(), activePlayer.getPlayerStatsTemplate().getMaxMp())); activePlayer.unsetState(CreatureState.DEAD); activePlayer.getController().startProtectionActiveTask(); sendPacket(SM_SYSTEM_MESSAGE.REVIVE); // TODO: It is not always necessary. // sendPacket(new SM_QUEST_LIST(activePlayer)); sendPacket(new SM_STATS_INFO(activePlayer)); sendPacket(new SM_PLAYER_INFO(activePlayer, false)); teleportService.moveToBindLocation(activePlayer, true); }
@Override public boolean onDialogEvent(QuestEnv env) { final Player player = env.getPlayer(); final int instanceId = player.getInstanceId(); final QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs == null) return false; int var = qs.getQuestVars().getQuestVars(); int targetId = 0; if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId(); if (qs.getStatus() == QuestStatus.START) { if (targetId == 790001) { switch (env.getDialogId()) { case 25: if (var == 0) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011); else if (var == 3) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1693); else if (var == 5) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2034); case 10000: if (var == 0) { if (player.getInventory().getItemCountByItemId(182200007) == 0) if (!itemService.addItems( player, Collections.singletonList(new QuestItems(182200007, 1)))) return true; qs.setQuestVarById(0, var + 1); updateQuestStatus(player, qs); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } case 10002: if (var == 3) { player.getInventory().removeFromBagByItemId(182200009, 1); qs.setQuestVar(99); updateQuestStatus(player, qs); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0)); WorldMapInstance newInstance = instanceService.getNextAvailableInstance(310010000); instanceService.registerPlayerWithInstance(newInstance, player); teleportService.teleportTo( player, 310010000, newInstance.getInstanceId(), 52, 174, 229, 0); return true; } case 10003: if (var == 5) { PlayerClass playerClass = player.getCommonData().getPlayerClass(); if (playerClass == PlayerClass.WARRIOR) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375); else if (playerClass == PlayerClass.SCOUT) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2716); else if (playerClass == PlayerClass.MAGE) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 3057); else if (playerClass == PlayerClass.PRIEST) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 3398); } case 10004: if (var == 5) return setPlayerClass(env, qs, PlayerClass.GLADIATOR); case 10005: if (var == 5) return setPlayerClass(env, qs, PlayerClass.TEMPLAR); case 10006: if (var == 5) return setPlayerClass(env, qs, PlayerClass.ASSASSIN); case 10007: if (var == 5) return setPlayerClass(env, qs, PlayerClass.RANGER); case 10008: if (var == 5) return setPlayerClass(env, qs, PlayerClass.SORCERER); case 10009: if (var == 5) return setPlayerClass(env, qs, PlayerClass.SPIRIT_MASTER); case 10010: if (var == 5) return setPlayerClass(env, qs, PlayerClass.CLERIC); case 10011: if (var == 5) return setPlayerClass(env, qs, PlayerClass.CHANTER); } } else if (targetId == 730008) { switch (env.getDialogId()) { case 25: if (var == 2) { if (player.getInventory().getItemCountByItemId(182200008) != 0) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352); else return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1354); } case 1353: if (var == 2) { PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 14)); player.getInventory().removeFromBagByItemId(182200008, 1); itemService.addItems(player, Collections.singletonList(new QuestItems(182200009, 1))); } return false; case 10001: if (var == 2) { qs.setQuestVarById(0, var + 1); updateQuestStatus(player, qs); PacketSendUtility.sendPacket( player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } } } else if (targetId == 205000) { switch (env.getDialogId()) { case 25: if (var == 99) { PacketSendUtility.sendPacket(player, new SM_EMOTION(player, 6, 1001, 0)); qs.setQuestVar(50); updateQuestStatus(player, qs); ThreadPoolManager.getInstance() .schedule( new Runnable() { @Override public void run() { qs.setQuestVar(51); updateQuestStatus(player, qs); List<Npc> mobs = new ArrayList<Npc>(); mobs.add( (Npc) questService.addNewSpawn( 310010000, instanceId, 211042, (float) 224.073, (float) 239.1, (float) 206.7, (byte) 0, true)); mobs.add( (Npc) questService.addNewSpawn( 310010000, instanceId, 211042, (float) 233.5, (float) 241.04, (float) 206.365, (byte) 0, true)); mobs.add( (Npc) questService.addNewSpawn( 310010000, instanceId, 211042, (float) 229.6, (float) 265.7, (float) 205.7, (byte) 0, true)); mobs.add( (Npc) questService.addNewSpawn( 310010000, instanceId, 211042, (float) 222.8, (float) 262.5, (float) 205.7, (byte) 0, true)); for (Npc mob : mobs) { // TODO: Tempt decrease P attack. mob.getGameStats() .setStat( StatEnum.MAIN_HAND_POWER, mob.getGameStats().getCurrentStat(StatEnum.MAIN_HAND_POWER) / 3); mob.getGameStats().setStat(StatEnum.PHYSICAL_DEFENSE, 0); mob.getAggroList().addDamage(player, 1000); } } }, 43000); return true; } return false; default: return false; } } } else if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 790001) { return defaultQuestEndDialog(env); } } return false; }
/** {@inheritDoc} */ @Override protected void runImpl() { AionConnection client = getConnection(); Account account = client.getAccount(); PlayerAccountData playerAccData = client.getAccount().getPlayerAccountData(objectId); if (playerAccData == null) { // Somebody wanted to login on character that is not at his account return; } Player player = PlayerService.getPlayer(objectId, account); if (player != null && client.setActivePlayer(player)) { player.setClientConnection(client); /* * Store player into World. */ World.getInstance().storeObject(player); sendPacket(new SM_SKILL_LIST(player)); StigmaService.onPlayerLogin(player); if (player.getSkillCoolDowns() != null) sendPacket(new SM_SKILL_COOLDOWN(player.getSkillCoolDowns())); if (player.getItemCoolDowns() != null) sendPacket(new SM_ITEM_COOLDOWN(player.getItemCoolDowns())); sendPacket(new SM_QUEST_LIST(player)); sendPacket(new SM_RECIPE_LIST(player.getRecipeList().getRecipeList())); /* * Needed */ sendPacket(new SM_ENTER_WORLD_CHECK()); byte[] uiSettings = player.getPlayerSettings().getUiSettings(); byte[] shortcuts = player.getPlayerSettings().getShortcuts(); if (uiSettings != null) sendPacket(new SM_UI_SETTINGS(uiSettings, 0)); if (shortcuts != null) sendPacket(new SM_UI_SETTINGS(shortcuts, 1)); // Cubesize limit set in inventory. int cubeSize = player.getCubeSize(); player.getInventory().setLimit(27 + cubeSize * 9); // items Storage inventory = player.getInventory(); List<Item> equipedItems = player.getEquipment().getEquippedItems(); if (equipedItems.size() != 0) { sendPacket(new SM_INVENTORY_INFO(player.getEquipment().getEquippedItems(), cubeSize)); } List<Item> unequipedItems = inventory.getAllItems(); int itemsSize = unequipedItems.size(); if (itemsSize != 0) { int index = 0; while (index + 10 < itemsSize) { sendPacket(new SM_INVENTORY_INFO(unequipedItems.subList(index, index + 10), cubeSize)); index += 10; } sendPacket(new SM_INVENTORY_INFO(unequipedItems.subList(index, itemsSize), cubeSize)); } sendPacket(new SM_INVENTORY_INFO()); PlayerService.playerLoggedIn(player); sendPacket(new SM_STATS_INFO(player)); sendPacket(new SM_CUBE_UPDATE(player, 6)); KiskService.onLogin(player); TeleportService.sendSetBindPoint(player); sendPacket(new SM_MACRO_LIST(player)); sendPacket(new SM_GAME_TIME()); player.getController().updateNearbyQuests(); sendPacket(new SM_TITLE_LIST(player)); sendPacket(new SM_CHANNEL_INFO(player.getPosition())); sendPacket(new SM_PLAYER_SPAWN(player)); sendPacket(new SM_EMOTION_LIST()); sendPacket(new SM_INFLUENCE_RATIO()); sendPacket(new SM_PRICES(player.getPrices())); sendPacket(new SM_PLAYER_ID(player)); sendPacket(new SM_ABYSS_RANK(player.getAbyssRank())); sendPacket( new SM_MESSAGE( 0, null, "Welcome to " + GSConfig.SERVER_NAME + " server\nPowered by aion-unique software\ndeveloped by www.aion-unique.org team.\nCopyright 2010", ChatType.ANNOUNCEMENTS)); if (player.isInPrison()) PunishmentService.updatePrisonStatus(player); if (player.isLegionMember()) LegionService.getInstance().onLogin(player); if (player.isInGroup()) GroupService.getInstance().onLogin(player); player.setRates(Rates.getRatesFor(client.getAccount().getMembership())); ClassChangeService.showClassChangeDialog(player); /** Notify mail service to load all mails */ MailService.getInstance().onPlayerLogin(player); /** Schedule periodic saving of this player */ PeriodicSaveService.getInstance().onPlayerLogin(player); /** Notify player if have broker settled items */ BrokerService.getInstance().onPlayerLogin(player); /** Start initializing chat connection(/1, /2, /3, /4 channels) */ if (!GSConfig.DISABLE_CHAT_SERVER) ChatService.onPlayerLogin(player); } else { // TODO this is an client error - inform client. } }
public void executeCommand(Player admin, String[] params) { if (params == null || params.length < 1) { PacketSendUtility.sendMessage(admin, "syntax //bind < all | elyos | asmos >"); return; } if (params[0].equals("all")) { if (admin.getAccessLevel() < AdminConfig.COMMAND_MOVETOMEALLALL) { PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command"); return; } World world = admin.getActiveRegion().getWorld(); Iterator<Player> players = world.getPlayersIterator(); while (players.hasNext()) { Player p = players.next(); if (!p.equals(admin)) { teleportService.teleportTo( p, admin.getWorldId(), admin.getInstanceId(), admin.getX(), admin.getY(), admin.getZ(), admin.getHeading(), 5); PacketSendUtility.sendPacket(p, new SM_PLAYER_SPAWN(p)); PacketSendUtility.sendMessage(admin, "Player " + p.getName() + " teleported."); PacketSendUtility.sendMessage(p, "Vous avez ete teleporte par " + admin.getName() + "."); } } } if (params[0].equals("elyos")) { if (admin.getAccessLevel() < AdminConfig.COMMAND_MOVETOMEALLELYOS) { PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command"); return; } World world = admin.getActiveRegion().getWorld(); Iterator<Player> players = world.getPlayersIterator(); while (players.hasNext()) { Player p = players.next(); if (!p.equals(admin)) { if (p.getCommonData().getRace() == Race.ELYOS) { teleportService.teleportTo( p, admin.getWorldId(), admin.getInstanceId(), admin.getX(), admin.getY(), admin.getZ(), admin.getHeading(), 5); PacketSendUtility.sendPacket(p, new SM_PLAYER_SPAWN(p)); PacketSendUtility.sendMessage(admin, "Player " + p.getName() + " teleported."); PacketSendUtility.sendMessage( p, "Vous avez ete teleporte par " + admin.getName() + "."); } } } } if (params[0].equals("asmos")) { if (admin.getAccessLevel() < AdminConfig.COMMAND_MOVETOMEALLASMOS) { PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command"); return; } World world = admin.getActiveRegion().getWorld(); Iterator<Player> players = world.getPlayersIterator(); while (players.hasNext()) { Player p = players.next(); if (!p.equals(admin)) { if (p.getCommonData().getRace() == Race.ASMODIANS) { teleportService.teleportTo( p, admin.getWorldId(), admin.getInstanceId(), admin.getX(), admin.getY(), admin.getZ(), admin.getHeading(), 5); PacketSendUtility.sendPacket(p, new SM_PLAYER_SPAWN(p)); PacketSendUtility.sendMessage(admin, "Player " + p.getName() + " teleported."); PacketSendUtility.sendMessage( p, "Vous avez ete teleporte par " + admin.getName() + "."); } } } } }