• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

C++ Accept/Decline box

Status
Not open for further replies.

Mathex

Respected Member
Hello I'm in the progress of creating a script which requires a Accept/Decline box. I know how to create one when people press a gossip menu, but this must trigger from a command. So when you type the command the box pops up. Anyone knows what the command for that is? Thank you in advance. (Have checked GossipDef.cpp and GossipDef.h and I found nothing).
 

Jameyboor

Retired Staff
It's funny that you're asking, I tried it out yesterday to see if I could use another player as the object, and it turns out you can.

anyways, the pop up box is a part of the whole gossip message, meaning you will have to send the MSG_GOSSIP_MESSAGE to activate the popup box, good part is that Trinity activated that you instantly see the gossip message if there is only 1 in the queue so the popup box should just appear, here is my test code for the packet :
Code:
WorldPacket data(SMSG_GOSSIP_MESSAGE, 100);         // guess size
data << uint64(player->GetGUID());
data << uint32(1);            // new 2.4.0
data << uint32(907);
data << uint32(1);
data << uint32(1);
data << uint8(1);
data << uint8(1);                    // makes pop up box password
data << uint32(1);                  // money required to open menu, 2.0.3
data << "soup";                           // text for gossip item
data << ".....";	
target->GetSession()->SendPacket(&data);
 
Last edited:

Mathex

Respected Member
It's funny that you're asking, I tried it out yesterday to see if I could use another player as the object, and it turns out you can.

anyways, the pop up box is a part of the whole gossip message, meaning you will have to send the MSG_GOSSIP_MESSAGE to activate the popup box, good part is that Trinity activated that you instantly see the gossip message if there is only 1 in the queue so the popup box should just appear, here is my test code for the packet :
Code:
WorldPacket data(SMSG_GOSSIP_MESSAGE, 100);         // guess size
data << uint64(player->GetGUID());
data << uint32(1);            // new 2.4.0
data << uint32(907);
data << uint32(1);
data << uint32(1);
data << uint8(1);
data << uint8(1);                    // makes pop up box password
data << uint32(1);                  // money required to open menu, 2.0.3
data << "soup";                           // text for gossip item
data << ".....";	
target->GetSession()->SendPacket(&data);

And would that send a code box or an accept/decline box? :) Thanks for answering BTW.
 

Jameyboor

Retired Staff
That would send the gossip item ( the little option you can click ) would be the same as ADD_GOSSIP_ITEM, thing is, because there is just one item, it will get activated instantly without clicking, so to make a long story short : yes, the popup box immediately shows after sending that packet.
 

Mathex

Respected Member
That would send the gossip item ( the little option you can click ) would be the same as ADD_GOSSIP_ITEM, thing is, because there is just one item, it will get activated instantly without clicking, so to make a long story short : yes, the popup box immediately shows after sending that packet.

So in theory whatever I do, if only having one gossip menu it'd go straight to that option? :) That's great!
 

Rochet2

Moderator / Eluna Dev
Note, it wont always go to the first option if there is only one.
There is a way to stop it.
When using player gossip, it wont directly open the first, possibly with others.
Creature gossip also has this option if you add some flags or something to the NPC.
If I remember correctly, my teleport NPC should have the correct flags or w/e and should be able to show one option.
There is also a thread about this on TC
It should be a client feature, not TC. Otherwise you could achieve it with packets while you cant. (likely)

The thing Jamey suggests is just a normal gossip option.
You can just use the normal gossip functions and macros to send the option etc.
This means that the normal OnGossipSelect(Code) functions work.

Note that they wont obviously work by default for player guid as sender for example.
The packet handler will receive the packet, but since the guid doesnt belong to a creature, it is rejected. You should code player gossip if you are going to use that.
Check this out: https://docs.google.com/file/d/0Bx5knS2IsjatS1dkRjhtbTF4S2c/edit
Note that you should check the code for extra security and create more checks if you find need for them.
Also note that I accidently put the hooks to Player even for the item gossip xD Works anyways, but they should really be in itemscript.
Read the description! (details on right side before downloading)
 
Last edited:
Status
Not open for further replies.
Top