Bypass commands from npc to my class

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
User avatar
HappyLDE
Posts: 123
Joined: Tue Sep 10, 2013 6:22 pm
Location: Belgium
Contact:

Bypass commands from npc to my class

Post by HappyLDE »

Hello,

Revisions:
DP: 10449
Server: 6652

I am trying to pass my commands from a npc to enter my instanced zone:

Code: Select all

<a action="bypass -h Quest PvpInstanceManager pvpzone_enter">PVP Instance</a><br>
But nothing happends, nor in console.

My class has the following:

Code: Select all

 public final class PvpInstanceManager extends AbstractNpcAI implements IBypassHandler, IVoicedCommandHandler{        private static final String[] VCOMMANDS = { "pvp_enter", "pvp_leave" };    private static final String[] BCOMMANDS = { "pvpzone_enter", "pvpzone_leave" }; PvpInstanceManager()    {        super(PvpInstanceManager.class.getSimpleName(), PvpInstanceManager.class.getSimpleName());         VoicedCommandHandler.getInstance().registerHandler(this);        BypassHandler.getInstance().registerHandler(this);    } @Override    public boolean useVoicedCommand(final String command, final L2PcInstance activeChar, final String target)    {        // enter (teleport to instance)        if (command.equalsIgnoreCase(PvpInstanceManager.VCOMMANDS[0])) {            teleportPlayerToInstance(activeChar);        }        // leave pvp instance zone        else if (command.equalsIgnoreCase(PvpInstanceManager.VCOMMANDS[1])) {            teleportPlayerOutOfInstance(activeChar);        }                return true;    }     @Override    public boolean useBypass(final String command, final L2PcInstance activeChar, final L2Character target)    {        // enter (teleport to instance)        if (command.equalsIgnoreCase(PvpInstanceManager.BCOMMANDS[0])) {            teleportPlayerToInstance(activeChar);        }        // leave pvp instance zone        else if (command.equalsIgnoreCase(PvpInstanceManager.BCOMMANDS[1])) {            teleportPlayerOutOfInstance(activeChar);        }         return true;    }        @Override    public String[] getVoicedCommandList() {        PvpInstanceManager._log.info(" > Registering voiced commands handlers.");        return PvpInstanceManager.VCOMMANDS;    }     @Override    public String[] getBypassList() {        PvpInstanceManager._log.info(" > Registering bypass handlers.");        return PvpInstanceManager.BCOMMANDS;    }}
The voiced commands work but not the bypass from npc. Any tips?
Thank you for making L2JServer happen! :D
"If you believe you will fail or succeed, in both ways you are right." - Henry Ford
User avatar
Zealar
L2j Veteran
L2j Veteran
Posts: 1236
Joined: Sun Jul 15, 2007 10:29 am

Re: Bypass commands from npc to my class

Post by Zealar »

Code: Select all

<a action="bypass -h npc_%objectId%_PvpInstanceManager pvpzone_enter">PVP Instance</a><br>
Also guess you need to substring the command. Put one System print to see what is comming.
Sdw
L2j Veteran
L2j Veteran
Posts: 855
Joined: Mon May 03, 2010 8:38 am
Location: France

Re: Bypass commands from npc to my class

Post by Sdw »

Better leave the link as they are and use onAdvEvent
User avatar
HappyLDE
Posts: 123
Joined: Tue Sep 10, 2013 6:22 pm
Location: Belgium
Contact:

Re: Bypass commands from npc to my class

Post by HappyLDE »

Zealar wrote:

Code: Select all

<a action="bypass -h npc_%objectId%_PvpInstanceManager pvpzone_enter">PVP Instance</a><br>
Also guess you need to substring the command. Put one System print to see what is comming.
Yeah the substring will be a happy step but not yet there :lol:

With your link i get this in console:

Code: Select all

[05/10 11:16:30] L2NpcInstance: Unknown NPC bypass: "PvpInstanceManager pvpzone_enter" NpcId: 10000
I will take a look at onAdvEvent.

Edit: I also added this log output to see if the function gets passed and it is not.

Code: Select all

@Override    public boolean useBypass(final String command, final L2PcInstance activeChar, final L2Character target)    {        PvpInstanceManager._log.info("pvpzone bypass command called");        ...         return true;    }
Thank you for making L2JServer happen! :D
"If you believe you will fail or succeed, in both ways you are right." - Henry Ford
User avatar
UnAfraid
L2j Veteran
L2j Veteran
Posts: 4199
Joined: Mon Jul 23, 2007 4:25 pm
Location: Bulgaria
Contact:

Re: Bypass commands from npc to my class

Post by UnAfraid »

its 'bypass -h npc_%objectId%_Quest scriptName event'
Image
User avatar
HappyLDE
Posts: 123
Joined: Tue Sep 10, 2013 6:22 pm
Location: Belgium
Contact:

Re: Bypass commands from npc to my class

Post by HappyLDE »

UnAfraid wrote:its 'bypass -h npc_%objectId%_Quest scriptName event'
Thanks, i have both and none of them are doing anything:
<a action="bypass -h Quest PvpInstanceManager pvpzone_leave">Teleport Outside</a>
<a action="bypass -h Quest PvpInstanceManager pvpzone_enter">Teleport Inside</a>
<a action="bypass -h npc_%objectId%_Quest PvpInstanceManager pvpzone_leave">PVP leave</a><br>
<a action="bypass -h npc_%objectId%_Quest PvpInstanceManager pvpzone_enter">PVP enter</a>

Edit: Also onAdvEvent is never called either:

Code: Select all

@Override    public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)    {        PvpInstanceManager._log.info("onAdvEvent command called");        ...                return super.onAdvEvent(event, npc, player);    }
Thank you for making L2JServer happen! :D
"If you believe you will fail or succeed, in both ways you are right." - Henry Ford
Post Reply