public boolean useAdminCommand(String command, L2PcInstance activeChar) { if (command.startsWith("admin_ride")) { if (activeChar.isMounted() || activeChar.getPet() != null) { activeChar.sendMessage("You already have a pet."); return false; } if (command.startsWith("admin_ride_wyvern")) { _petRideId = 12621; } else if (command.startsWith("admin_ride_strider")) { _petRideId = 12526; } else if (command.startsWith("admin_ride_wolf")) { _petRideId = 16041; } else if (command.startsWith("admin_ride_horse")) // handled using transformation { if (activeChar.isTransformed() || activeChar.isInStance()) // FIXME: Wrong Message activeChar.sendMessage("You cannot mount a steed while transformed."); else TransformationManager.getInstance() .transformPlayer(PURPLE_MANED_HORSE_TRANSFORMATION_ID, activeChar); return true; } else if (command.startsWith("admin_ride_bike")) // handled using transformation { if (activeChar.isTransformed() || activeChar.isInStance()) // FIXME: Wrong Message activeChar.sendMessage("You cannot mount a steed while transformed."); else TransformationManager.getInstance() .transformPlayer(JET_BIKE_TRANSFORMATION_ID, activeChar); return true; } else { activeChar.sendMessage("Command '" + command + "' not recognized"); return false; } activeChar.mount(_petRideId, 0, false); return false; } else if (command.startsWith("admin_unride")) { if (activeChar.getTransformationId() == PURPLE_MANED_HORSE_TRANSFORMATION_ID) activeChar.untransform(); if (activeChar.getTransformationId() == JET_BIKE_TRANSFORMATION_ID) activeChar.untransform(); else activeChar.dismount(); } return true; }
@Override public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item) { final L2PcInstance player = effector.getActingPlayer(); if (player == null) { return false; } boolean canSummon = true; if (Config.RESTORE_PET_ON_RECONNECT && CharSummonTable.getInstance().getPets().containsKey(player.getObjectId())) { player.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_MULTIPLE_PETS_AT_THE_SAME_TIME); canSummon = false; } else if (player.hasPet()) { player.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_MULTIPLE_PETS_AT_THE_SAME_TIME); canSummon = false; } else if (player.isFlyingMounted() || player.isMounted() || player.inObserverMode() || player.isTeleporting()) { canSummon = false; } return (_val == canSummon); }
/** * Perform a couple social action. * * @param id the couple social action Id */ private void useCoupleSocial(final int id) { final L2PcInstance requester = getActiveChar(); if (requester == null) { return; } final L2Object target = requester.getTarget(); if ((target == null) || !target.isPlayer()) { sendPacket(SystemMessageId.INVALID_TARGET); return; } final int distance = (int) requester.calculateDistance(target, false, false); if ((distance > 125) || (distance < 15) || (requester.getObjectId() == target.getObjectId())) { sendPacket( SystemMessageId .THE_REQUEST_CANNOT_BE_COMPLETED_BECAUSE_THE_TARGET_DOES_NOT_MEET_LOCATION_REQUIREMENTS); return; } SystemMessage sm; if (requester.isInStoreMode() || requester.isInCraftMode()) { sm = SystemMessage.getSystemMessage( SystemMessageId .C1_IS_IN_PRIVATE_STORE_MODE_OR_IN_A_BATTLE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(requester); sendPacket(sm); return; } if (requester.isInCombat() || requester.isInDuel() || AttackStanceTaskManager.getInstance().hasAttackStanceTask(requester)) { sm = SystemMessage.getSystemMessage( SystemMessageId.C1_IS_IN_A_BATTLE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(requester); sendPacket(sm); return; } if (requester.isFishing()) { sendPacket(SystemMessageId.YOU_CANNOT_DO_THAT_WHILE_FISHING); return; } if (requester.getReputation() < 0) { sm = SystemMessage.getSystemMessage( SystemMessageId.C1_IS_IN_A_CHAOTIC_STATE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(requester); sendPacket(sm); return; } if (requester.isInOlympiadMode()) { sm = SystemMessage.getSystemMessage( SystemMessageId .C1_IS_PARTICIPATING_IN_THE_OLYMPIAD_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(requester); sendPacket(sm); return; } if (requester.isInSiege()) { sm = SystemMessage.getSystemMessage( SystemMessageId.C1_IS_IN_A_CASTLE_SIEGE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(requester); sendPacket(sm); return; } if (requester.isInHideoutSiege()) { sm = SystemMessage.getSystemMessage( SystemMessageId .C1_IS_PARTICIPATING_IN_A_CLAN_HALL_SIEGE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(requester); sendPacket(sm); } if (requester.isMounted() || requester.isFlyingMounted() || requester.isInBoat() || requester.isInAirShip()) { sm = SystemMessage.getSystemMessage( SystemMessageId .C1_IS_RIDING_A_SHIP_STEED_OR_STRIDER_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(requester); sendPacket(sm); return; } if (requester.isTransformed()) { sm = SystemMessage.getSystemMessage( SystemMessageId .C1_IS_CURRENTLY_TRANSFORMING_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(requester); sendPacket(sm); return; } if (requester.isAlikeDead()) { sm = SystemMessage.getSystemMessage( SystemMessageId.C1_IS_CURRENTLY_DEAD_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(requester); sendPacket(sm); return; } // Checks for partner. final L2PcInstance partner = target.getActingPlayer(); if (partner.isInStoreMode() || partner.isInCraftMode()) { sm = SystemMessage.getSystemMessage( SystemMessageId .C1_IS_IN_PRIVATE_STORE_MODE_OR_IN_A_BATTLE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(partner); sendPacket(sm); return; } if (partner.isInCombat() || partner.isInDuel() || AttackStanceTaskManager.getInstance().hasAttackStanceTask(partner)) { sm = SystemMessage.getSystemMessage( SystemMessageId.C1_IS_IN_A_BATTLE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(partner); sendPacket(sm); return; } if (partner.getMultiSociaAction() > 0) { sm = SystemMessage.getSystemMessage( SystemMessageId .C1_IS_ALREADY_PARTICIPATING_IN_A_COUPLE_ACTION_AND_CANNOT_BE_REQUESTED_FOR_ANOTHER_COUPLE_ACTION); sm.addPcName(partner); sendPacket(sm); return; } if (partner.isFishing()) { sm = SystemMessage.getSystemMessage( SystemMessageId.C1_IS_FISHING_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(partner); sendPacket(sm); return; } if (partner.getReputation() < 0) { sm = SystemMessage.getSystemMessage( SystemMessageId.C1_IS_IN_A_CHAOTIC_STATE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(partner); sendPacket(sm); return; } if (partner.isInOlympiadMode()) { sm = SystemMessage.getSystemMessage( SystemMessageId .C1_IS_PARTICIPATING_IN_THE_OLYMPIAD_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(partner); sendPacket(sm); return; } if (partner.isInHideoutSiege()) { sm = SystemMessage.getSystemMessage( SystemMessageId .C1_IS_PARTICIPATING_IN_A_CLAN_HALL_SIEGE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(partner); sendPacket(sm); return; } if (partner.isInSiege()) { sm = SystemMessage.getSystemMessage( SystemMessageId.C1_IS_IN_A_CASTLE_SIEGE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(partner); sendPacket(sm); return; } if (partner.isMounted() || partner.isFlyingMounted() || partner.isInBoat() || partner.isInAirShip()) { sm = SystemMessage.getSystemMessage( SystemMessageId .C1_IS_RIDING_A_SHIP_STEED_OR_STRIDER_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(partner); sendPacket(sm); return; } if (partner.isTeleporting()) { sm = SystemMessage.getSystemMessage( SystemMessageId .C1_IS_CURRENTLY_TELEPORTING_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(partner); sendPacket(sm); return; } if (partner.isTransformed()) { sm = SystemMessage.getSystemMessage( SystemMessageId .C1_IS_CURRENTLY_TRANSFORMING_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(partner); sendPacket(sm); return; } if (partner.isAlikeDead()) { sm = SystemMessage.getSystemMessage( SystemMessageId.C1_IS_CURRENTLY_DEAD_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION); sm.addPcName(partner); sendPacket(sm); return; } if (requester.isAllSkillsDisabled() || partner.isAllSkillsDisabled()) { sendPacket(SystemMessageId.THE_COUPLE_ACTION_WAS_CANCELLED); return; } requester.setMultiSocialAction(id, partner.getObjectId()); sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_REQUESTED_A_COUPLE_ACTION_WITH_C1); sm.addPcName(partner); sendPacket(sm); if ((requester.getAI().getIntention() != CtrlIntention.AI_INTENTION_IDLE) || (partner.getAI().getIntention() != CtrlIntention.AI_INTENTION_IDLE)) { final NextAction nextAction = new NextAction( CtrlEvent.EVT_ARRIVED, CtrlIntention.AI_INTENTION_MOVE_TO, () -> partner.sendPacket(new ExAskCoupleAction(requester.getObjectId(), id))); requester.getAI().setNextAction(nextAction); return; } if (requester.isCastingNow() || requester.isCastingSimultaneouslyNow()) { final NextAction nextAction = new NextAction( CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () -> partner.sendPacket(new ExAskCoupleAction(requester.getObjectId(), id))); requester.getAI().setNextAction(nextAction); return; } partner.sendPacket(new ExAskCoupleAction(requester.getObjectId(), id)); }