Jump to content
  • 0

onActionShift


cyta5

Question

5 answers to this question

Recommended Posts

  • 0
18 minutes ago, SweeTs said:

Find the method and add a check if (target instanceof L2Monster || ...) 

 

where i use that ?


/**
     * Manage and Display the GM console to modify the L2NpcInstance (GM only).<BR>
     * <BR>
     * <B><U> Actions (If the L2PcInstance is a GM only)</U> :</B><BR>
     * <BR>
     * <li>Set the L2NpcInstance as target of the L2PcInstance player (if necessary)</li> <li>Send a Server->Client packet MyTargetSelected to the L2PcInstance player (display the select window)</li> <li>If L2NpcInstance is autoAttackable, send a Server->Client packet StatusUpdate to the
     * L2PcInstance in order to update L2NpcInstance HP bar</li> <li>Send a Server->Client NpcHtmlMessage() containing the GM console about this L2NpcInstance</li><BR>
     * <BR>
     * <FONT COLOR=#FF0000><B> <U>Caution</U> : Each group of Server->Client packet must be terminated by a ActionFailed packet in order to avoid that client wait an other packet</B></FONT><BR>
     * <BR>
     * <B><U> Example of use </U> :</B><BR>
     * <BR>
     * <li>Client packet : Action</li><BR>
     * <BR>
     * @param client The thread that manage the player that pessed Shift and click on the L2NpcInstance
     */
    @Override
    public void onActionShift(final L2GameClient client)
    {        
        // Get the L2PcInstance corresponding to the thread
        L2PcInstance player = client.getActiveChar();
        if (player == null)
            return;
        
        final L2Weapon currentWeapon = player.getActiveWeaponItem();
        
        // Check if the L2PcInstance is a GM
        if (player.getAccessLevel().isGm())
        {
            // Set the target of the L2PcInstance player
            player.setTarget(this);
            
            // Send a Server->Client packet MyTargetSelected to the L2PcInstance player
            // The player.getLevel() - getLevel() permit to display the correct color in the select window
            MyTargetSelected my = new MyTargetSelected(getObjectId(), player.getLevel() - getLevel());
            player.sendPacket(my);
            my = null;
            
            // Check if the player is attackable (without a forced attack)
            if (isAutoAttackable(player))
            {
                // Send a Server->Client packet StatusUpdate of the L2NpcInstance to the L2PcInstance to update its HP bar
                StatusUpdate su = new StatusUpdate(getObjectId());
                su.addAttribute(StatusUpdate.CUR_HP, (int) getCurrentHp());
                su.addAttribute(StatusUpdate.MAX_HP, getMaxHp());
                player.sendPacket(su);
                su = null;
            }
            
            // Send a Server->Client NpcHtmlMessage() containing the GM console about this L2NpcInstance
            NpcHtmlMessage html = new NpcHtmlMessage(0);

Link to comment
Share on other sites

  • 0

Before all this / after gm check, under else if it's for player, but I guess it's not the place you are looking for. Most likely you want to make a shift click to check monster stats, drop. If so, then it's wrong place. 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...