@Override protected void runImpl() { // Get the current L2PcInstance of the player final L2PcInstance activeChar = getClient().getActiveChar(); if (activeChar == null) { return; } // Get the level of the used skill int level = activeChar.getSkillLevel(_skillId); if (level <= 0) { activeChar.sendPacket(ActionFailed.STATIC_PACKET); return; } // Get the L2Skill template corresponding to the skillID received from the client Skill skill = SkillData.getInstance().getSkill(_skillId, level); // Check the validity of the skill if (skill != null) { activeChar.setCurrentSkillWorldPosition(new Location(_x, _y, _z)); // normally magicskilluse packet turns char client side but for these skills, it doesn't (even // with correct target) activeChar.setHeading( Util.calculateHeadingFrom(activeChar.getX(), activeChar.getY(), _x, _y)); Broadcast.toKnownPlayers(activeChar, new ValidateLocation(activeChar)); activeChar.useMagic(skill, _ctrlPressed, _shiftPressed); } else { activeChar.sendPacket(ActionFailed.STATIC_PACKET); _log.warning("No skill found with id " + _skillId + " and level " + level + " !!"); } }
public PlayerCondition(L2PcInstance player, boolean partyDuel) { if (player == null) { return; } _player = player; _hp = _player.getCurrentHp(); _mp = _player.getCurrentMp(); _cp = _player.getCurrentCp(); _paDuel = partyDuel; if (_paDuel) { _x = _player.getX(); _y = _player.getY(); _z = _player.getZ(); } }
public void teleportGroup(L2PcInstance player) { removeDead(); for (L2ControllableMobInstance mobInst : getMobs()) { if (mobInst == null) { continue; } if (!mobInst.isDead()) { int x = player.getX() + Rnd.nextInt(50); int y = player.getY() + Rnd.nextInt(50); mobInst.teleToLocation(x, y, player.getZ(), true); L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); ai.follow(player); } } }
public void spawnGroup(L2PcInstance activeChar) { spawnGroup(activeChar.getX(), activeChar.getY(), activeChar.getZ()); }
public synchronized void start(L2PcInstance player, byte type, L2Npc npc) { boolean canPass = true; if (!player.isInParty()) { showHtmlFile(player, "data/html/seven_signs/rift/NoParty.htm", npc); return; } if (player.getParty().getPartyLeaderOID() != player.getObjectId()) { showHtmlFile(player, "data/html/seven_signs/rift/NotPartyLeader.htm", npc); return; } if (player.getParty().isInDimensionalRift()) { handleCheat(player, npc); return; } if (player.getParty().getMemberCount() < Config.RIFT_MIN_PARTY_SIZE) { NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); html.setFile(player.getHtmlPrefix(), "data/html/seven_signs/rift/SmallParty.htm"); html.replace("%npc_name%", npc.getName()); html.replace("%count%", Integer.toString(Config.RIFT_MIN_PARTY_SIZE)); player.sendPacket(html); return; } // max parties inside is rooms count - 1 if (!isAllowedEnter(type)) { player.sendMessage("Rift is full. Try later."); return; } for (L2PcInstance p : player.getParty().getPartyMembers()) if (!checkIfInPeaceZone(p.getX(), p.getY(), p.getZ())) { canPass = false; break; } if (!canPass) { showHtmlFile(player, "data/html/seven_signs/rift/NotInWaitingRoom.htm", npc); return; } L2ItemInstance i; int count = getNeededItems(type); for (L2PcInstance p : player.getParty().getPartyMembers()) { i = p.getInventory().getItemByItemId(DIMENSIONAL_FRAGMENT_ITEM_ID); if (i == null) { canPass = false; break; } if (i.getCount() > 0) { if (i.getCount() < getNeededItems(type)) { canPass = false; break; } } else { canPass = false; break; } } if (!canPass) { NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); html.setFile(player.getHtmlPrefix(), "data/html/seven_signs/rift/NoFragments.htm"); html.replace("%npc_name%", npc.getName()); html.replace("%count%", Integer.toString(count)); player.sendPacket(html); return; } for (L2PcInstance p : player.getParty().getPartyMembers()) { i = p.getInventory().getItemByItemId(DIMENSIONAL_FRAGMENT_ITEM_ID); if (!p.destroyItem("RiftEntrance", i, count, null, false)) { NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); html.setFile(player.getHtmlPrefix(), "data/html/seven_signs/rift/NoFragments.htm"); html.replace("%npc_name%", npc.getName()); html.replace("%count%", Integer.toString(count)); player.sendPacket(html); return; } } byte room; FastList<Byte> emptyRooms; do { emptyRooms = getFreeRooms(type); room = emptyRooms.get(Rnd.get(1, emptyRooms.size()) - 1); } // find empty room while (_rooms.get(type).get(room).ispartyInside()); new DimensionalRift(player.getParty(), type, room); }