Page 1 of 1

Party invitation button

Posted: Wed Jul 03, 2013 12:19 pm
by Nerimah
Hello,

I'm trying to improve players profile inside the community board -> region when we click on player's name.
I would like to create a button in each player profile to invite him in party/clan or friend but cannot find the right functions to do that.

So far I have this inside RegionBBSManager.java:

Code: Select all

StringUtil.append(htmlCode, "<td align=center width=30%><button value=\"Invite\" width=40 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\" action=\"bypass _bbslocparty;", name, "\"></td>");

Code: Select all

else if (command.startsWith("_bbslocparty;"))        {            StringTokenizer st = new StringTokenizer(command, ";");            st.nextToken();            String name = st.nextToken();                        activeChar.sendMessage("You invited " + name + " to party");            new RequestJoinParty();        }
When I click on the button, I receive the system message "You invited XXXX to party" but nothing more happens and the invitation is not sent. I guess new RequestJoinParty(); is not the right way to send the invitation...

I wish you can help me with this

Re: Party invitation button

Posted: Wed Jul 03, 2013 12:24 pm
by xban1x
Maybe send that packet to the actual player?

Re: Party invitation button

Posted: Wed Jul 03, 2013 12:28 pm
by Nerimah
xban1x wrote:Maybe send that packet to the actual player?
How would you do that?

Re: Party invitation button

Posted: Wed Jul 03, 2013 12:47 pm
by UnAfraid

Code: Select all

activeChar.sendPacket(new RequestJoinParty());

Re: Party invitation button

Posted: Wed Jul 03, 2013 12:53 pm
by Nerimah
UnAfraid wrote:activeChar.sendPacket(new RequestJoinParty());
RequestJoinParty() is not a L2GameServerPacket but a L2GameClientPacket and i get this error message on SendPacket:

Code: Select all

 The method sendPacket(L2GameServerPacket) in the type L2PcInstance is not applicable for the arguments (RequestJoinParty)

Re: Party invitation button

Posted: Wed Jul 03, 2013 12:58 pm
by UnAfraid
Nerimah wrote:
UnAfraid wrote:activeChar.sendPacket(new RequestJoinParty());
RequestJoinParty() is not a L2GameServerPacket but a L2GameClientPacket and i get this error message on SendPacket:

Code: Select all

 The method sendPacket(L2GameServerPacket) in the type L2PcInstance is not applicable for the arguments (RequestJoinParty)
Oh because that's client packet not server packet.
Check it's logic com.l2jserver.gameserver.network.clientpackets.RequestJoinParty
You must do bunch of checks otherwise you'll open huge vulnerability.

Re: Party invitation button

Posted: Wed Jul 03, 2013 1:01 pm
by Nerimah
I will try to create a function copying all the checks inside RequestJoinParty and which will send the invitation.
Copy/paste is my best weapon ;>

I'll update this post later, thanks for help

Re: Party invitation button

Posted: Wed Jul 03, 2013 3:22 pm
by Nerimah
Nerimah wrote:I will try to create a function copying all the checks inside RequestJoinParty and which will send the invitation.
This worked like a charm, problem solved