ArcEmu: Packet Research: - ArcEmu

Jump to content

Toggle shoutbox Lastest Announcements

dfighter  : (07 December 2014 - 12:06 PM) Arcemu is in hibernation mode, please read http://arcemu.org/fo...showtopic=26903
dfighter  : (01 January 2013 - 05:56 PM) Arcemu wishes you all a happy new year!
Hasbro  : (12 September 2012 - 10:01 AM) Please excuse our outage from the web! Our web host had a major malfunction!
dfighter  : (01 September 2012 - 04:05 PM) Since the spam bots just don't want to stop, I've enabled admin verification when registering.
dfighter  : (23 January 2012 - 09:56 PM) Please note that from now on you will need to confirm your email on the wiki in order to edit it!
Hasbro  : (31 December 2011 - 12:50 PM) Happy New Years all!
Navid  : (26 December 2011 - 04:09 AM) Merry Christmas !!!!!! Happy holidays all :)
WAmadeus  : (24 December 2011 - 03:54 PM) Merry Christmas to all!
dfighter  : (24 December 2011 - 11:05 AM) The Arcemu team wishes y'all a Merry Christmukkah!
Hasbro  : (05 October 2011 - 12:53 PM) Looking for web designers for upcoming web related project. If you're interested in designing user interfaces contact me
dfighter  : (02 September 2011 - 03:47 PM) So who here wants vehicles in Arcemu? :P http://arcemu.org/fo...showtopic=25440
Hasbro  : (14 August 2011 - 03:25 PM) Join us on irc, grab an irc client and connect to irc.freenode.net join channel #arcemu /server irc.freenode.net:6667 /join #arcemu
jackpoz  : (03 August 2011 - 05:33 AM) to all Lua Engine (old one) users: please check http://arcemu.org/fo...showtopic=25274
Hasbro  : (20 May 2011 - 05:27 PM) Looking for people experienced with CMake configuration and setup! Contact me asap
Hasbro  : (15 May 2011 - 05:03 PM) ArcEmu is recruiting C++ programmers, contact Hasbro if interested.
paroxysm  : (03 May 2011 - 06:26 PM) Updated luabridge gossip example to describe the whole gossip creation process rather than just how to create menu. Gossip tutorial
paroxysm  : (23 April 2011 - 11:35 AM) Lua writers can refer to the Luabridge Tutorials section in the Wiki to learn how to write gossip code correctly.
Hasbro  : (20 April 2011 - 05:22 PM) Thank you for your continuous contribution of bug reports, we are working on them.
Hasbro  : (17 April 2011 - 03:20 AM) Please consider donating to support our bills. Donations can be sent using PayPal to donations@arcemu.org - Thank you for your support.
paroxysm  : (10 April 2011 - 12:43 AM) Refer to the Luabridge Tutorials section in the Wiki to learn the new syntax of luabridge.
Resize Shouts Area

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • This topic is locked

Packet Research: LFG Set Roles

#1 User is offline   alleycat 

  • Helps so much & is so mature & gay
  • PipPipPipPipPip
  • Group: Members
  • Posts: 835
  • Joined: 25-July 08
  • Gender:Male

Posted 14 June 2009 - 02:56 PM

Looking For Group roles is a new feature that was recently introduced in 3.1.

--------------------
|CMSG_LFG_SET_ROLES|
--------------------
| uint8 Role;	  |
--------------------


enum LgfRoles
{
	NONE = 0,
	LEADER = 1,
	TANK = 2,
	HEALER = 4,
	DAMAGE = 8
}

I can haz cookie?
0

#2 User is offline   whoami 

  • ArcEmu Lover
  • Group: Retired
  • Posts: 499
  • Joined: 28-August 08
  • Gender:Male

Posted 14 June 2009 - 03:24 PM

I wonder, did Blizzard forget there is such a thing as "odd" numbers? :P
0

#3 User is offline   alleycat 

  • Helps so much & is so mature & gay
  • PipPipPipPipPip
  • Group: Members
  • Posts: 835
  • Joined: 25-July 08
  • Gender:Male

Posted 14 June 2009 - 03:40 PM

I sometimes wonder that myself :-D
I can haz cookie?
0

#4 User is offline   dfighter 

  • Titles are overrated
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Administrator
  • Posts: 5,189
  • Joined: 14-June 08
  • IRC:dfighter
  • Gender:Male
  • Server OS:Linux

Posted 15 June 2009 - 12:54 AM

View Postwhoami, on Jun 14 2009, 10:24 PM, said:

I wonder, did Blizzard forget there is such a thing as "odd" numbers? :)

The flag type fields are usually bitfields. Which means they represent the flags with the individual bits.
These bits when interpreted as a number are powers of two:
( 2^0 = 1, 2^1 = 2, 2^2 = 4, etc) That's why you see mostly even numbers.
"The demand for free goods is infinite."
0

#5 User is offline   alleycat 

  • Helps so much & is so mature & gay
  • PipPipPipPipPip
  • Group: Members
  • Posts: 835
  • Joined: 25-July 08
  • Gender:Male

Posted 15 June 2009 - 02:21 AM

O.o
I can haz cookie?
0

#6 User is offline   vlack 

  • God of copy-paste
  • PipPipPipPipPipPip
  • Group: Developers
  • Posts: 1,159
  • Joined: 26-July 08
  • Gender:Male
  • Location:Hungary
  • Interests:Helping people who think they're RIL PRO, then come here crying that this or that doesn't work for them.

Posted 15 June 2009 - 04:39 AM

Yeah, we know about bits as flags, but interestingly he used for example 6 = 2^2 + 2^1 in a way where using the bits as flags separately would have more use. I think that we shouldn't keep the mixed flags, and keep only the ones that are powers of 2; and then when we have to check for one, then we can say "role&HEALER && role&TANK".

EDIT: the new enum should be like this:
enum LgfRoles
{
	NONE = 0,
	LEADER = 1,
	TANK = 2,
	HEALER = 4,
	DAMAGE = 8
}

Alleycat, you missed the LEADER role before...

The CMSG_LFG_SET_ROLES packet is not that important, as the client does not expect a direct answer to it, and the group list it receives from the server can be used just as before, the only problem will be that it doesn't matter what group role you want to be, it'll list all groups to you without filtering them.

How CMSG_LFG_SET_ROLES should be implemented: we have a 3 sized array of things initialized this way:
		for(i=0;i<3;i++)
		{
				LfgType[i]=0;
				LfgDungeonId[i]=0;
		}

These are the 3 slots...

Now we need one field to store our chosen role, so we should add it to the Player class like
uint8 LfgRole;
And we can initialize it as 0 where we clear the 2 arrays (the code block shown above).
When we receive this new packet, we should simply store the received uint8 value in this new member variable.


Additional informations regarding LFG functionality:

In LfgMgr.h
#define MAX_DUNGEONS 242+1
this is 244+1 on 3.1.2, I think (as the server reports 2 out of range dungeons on startup with 242)...

The format of the received MSG_LOOKING_FOR_GROUP remained the same, so this is OK in WorldSession::HandleMsgLookingForGroup (in LfgHandler.h).

But the response packet in LfgMgr::SendLfgList have to be reworked, I think even the structure is bad:
data << LfgDungeonTypes[Dungeon];
data << Dungeon;
Here we should send additional data, for example an uint8(0).
And the structure might need to be changed further down too, I haven't checked that.
Being an ArcEmu developer requires you to be committed to some specific case. That's why I refuse to be one.
What you see below my name doesn't mean I'm officially affiliated with ArcEmu; I'm still a freelancer programmer, but looks like I have earned that dev. tag.
0

#7 User is offline   alleycat 

  • Helps so much & is so mature & gay
  • PipPipPipPipPip
  • Group: Members
  • Posts: 835
  • Joined: 25-July 08
  • Gender:Male

Posted 15 June 2009 - 12:40 PM

Yup. Separating the damage/healer/tank now.

I was testing my client with lfg and its bugged most definetly. I don't think there is just one missing uint8 but rather two, but after I get this damn sniffitzt packet translator fixed, I will see if I can figure out where.

Btw, I at this point have been storing the role in the player.h as
uint8 lfgRole;

I can haz cookie?
0

#8 User is offline   dfighter 

  • Titles are overrated
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Administrator
  • Posts: 5,189
  • Joined: 14-June 08
  • IRC:dfighter
  • Gender:Male
  • Server OS:Linux

Posted 15 June 2009 - 07:59 PM

View Postvlack, on Jun 15 2009, 11:39 AM, said:

Yeah, we know about bits as flags, but interestingly he used for example 6 = 2^2 + 2^1 in a way where using the bits as flags separately would have more use. I think that we shouldn't keep the mixed flags, and keep only the ones that are powers of 2; and then when we have to check for one, then we can say "role&HEALER && role&TANK".

Yes I am sure that YOU knew about it, however it would appear that they did not.
"The demand for free goods is infinite."
0

#9 User is offline   alleycat 

  • Helps so much & is so mature & gay
  • PipPipPipPipPip
  • Group: Members
  • Posts: 835
  • Joined: 25-July 08
  • Gender:Male

Posted 17 June 2009 - 02:41 PM

UPDATE: CMSG_SET_LOOKING_FOR_GROUP has been changed!

New Structure:
uint32 LfgQueueId;
uint32 LfgDungeonId/Type;
uint8 Role;
uint8 AutoJoin;

I can haz cookie?
0

#10 User is offline   vlack 

  • God of copy-paste
  • PipPipPipPipPipPip
  • Group: Developers
  • Posts: 1,159
  • Joined: 26-July 08
  • Gender:Male
  • Location:Hungary
  • Interests:Helping people who think they're RIL PRO, then come here crying that this or that doesn't work for them.

Posted 17 June 2009 - 02:47 PM

View Postalleycat, on Jun 17 2009, 09:41 PM, said:

Update: CMSG_SET_LOOKING_FOR_GROUP has changed!

Structure is now:
uint32 LfgQueueId;
uint16 LfgDungeonId;
unit8 unk1;
uint8 LfgType;
uint8 Role;
uint8 unk2;


Please confirm.

If you fire up a server patched for 3.1.3 clients (for example with my patch) and you turn on packet logging, you can analyze the packet's structure using the "world.log" file.
First check if it is really 10 bytes long ( (32+16+8+8+8+8)/8=10 ). Then you can check if the first 4 bytes is the queueid, then if is there a sensible dungeon id in the next 2 bytes, and so on...
In fact checking this is pretty easy.
Being an ArcEmu developer requires you to be committed to some specific case. That's why I refuse to be one.
What you see below my name doesn't mean I'm officially affiliated with ArcEmu; I'm still a freelancer programmer, but looks like I have earned that dev. tag.
0

#11 User is offline   alleycat 

  • Helps so much & is so mature & gay
  • PipPipPipPipPip
  • Group: Members
  • Posts: 835
  • Joined: 25-July 08
  • Gender:Male

Posted 17 June 2009 - 03:35 PM

I got the new structure, and out of 4 3.1 packets, they all fit.
I can haz cookie?
0

#12 User is offline   alleycat 

  • Helps so much & is so mature & gay
  • PipPipPipPipPip
  • Group: Members
  • Posts: 835
  • Joined: 25-July 08
  • Gender:Male

Posted 17 June 2009 - 04:34 PM

UPDATE: Missing Packet Send!

When the client receives CMSG_SET_LOOKING_FOR_GROUP it is supposed to send back:

SMSG_LFG_UPDATE

struct:
uint8 unk1;
uint8 LFG;(wether are not you are lfg! Is either 0/1)
uint8 unk2;


unk1 and unk2 never seem to change.
I can haz cookie?
0

#13 User is offline   Hopla 

  • The branchmaster
  • Group: Retired
  • Posts: 947
  • Joined: 13-June 08
  • Gender:Male

Posted 17 June 2009 - 04:40 PM

Considered uint32, uint32, uint8, uint8?
0

#14 User is offline   alleycat 

  • Helps so much & is so mature & gay
  • PipPipPipPipPip
  • Group: Members
  • Posts: 835
  • Joined: 25-July 08
  • Gender:Male

Posted 17 June 2009 - 04:45 PM

I thought of that, bit if you try that structure on SET_LOOKING packet, all the info comes out completely wrong, wilst with mine, it comes out correct.
I can haz cookie?
0

#15 User is offline   alleycat 

  • Helps so much & is so mature & gay
  • PipPipPipPipPip
  • Group: Members
  • Posts: 835
  • Joined: 25-July 08
  • Gender:Male

Posted 17 June 2009 - 05:08 PM

Note: Just because I posted these does not mean I am sure they are correct. The idea of this post is so that I can have my work double, and triple checked.
I can haz cookie?
0

#16 User is offline   vlack 

  • God of copy-paste
  • PipPipPipPipPipPip
  • Group: Developers
  • Posts: 1,159
  • Joined: 26-July 08
  • Gender:Male
  • Location:Hungary
  • Interests:Helping people who think they're RIL PRO, then come here crying that this or that doesn't work for them.

Posted 17 June 2009 - 05:23 PM

View Postalleycat, on Jun 18 2009, 12:08 AM, said:

Note: Just because I posted these does not mean I am sure they are correct. The idea of this post is so that I can have my work double, and triple checked.

For structure reference, you can use other emulators too (if you're not sure of your results).

Here's a bit of code from Mangos:
void WorldSession::HandleSetLfgOpcode( WorldPacket & recv_data )
{
	CHECK_PACKET_SIZE(recv_data, 4+4+1+1);

	sLog.outDebug("CMSG_SET_LOOKING_FOR_GROUP");
	recv_data.hexlike();
	uint32 slot, temp, entry, type;
	uint8 roles, unk1;

	recv_data >> slot >> temp >> roles >> unk1;

	entry = ( temp & 0x00FFFFFF);
	type = ( (temp >> 24) & 0x000000FF);

	if(slot >= MAX_LOOKING_FOR_GROUP_SLOT)
		return;

	_player->m_lookingForGroup.slots[slot].Set(entry, type);
	_player->m_lookingForGroup.roles = roles;
	sLog.outDebug("LFG set: looknumber %u, temp %X, type %u, entry %u", slot, temp, type, entry);

	if(LookingForGroup_auto_join)
		AttemptJoin(_player);

	//SendLfgResult(type, entry, 0);
	SendLfgUpdate(0, 1, 0);
}

Size is 10 too, but as Hopla said, it is (uint32, uint32, uint8, uint8).

void WorldSession::SendLfgUpdate(uint8 unk1, uint8 unk2, uint8 unk3)
{
	WorldPacket data(SMSG_LFG_UPDATE, 3);
	data << uint8(unk1);
	data << uint8(unk2);
	data << uint8(unk3);
	SendPacket(&data);
}

And the response packet is a constant uint8s(0,1,0) on Mangos...
(Of course they have this function to send this packet for a good reason, the "clear" packet's response is a (0,0,0) packet.)
Being an ArcEmu developer requires you to be committed to some specific case. That's why I refuse to be one.
What you see below my name doesn't mean I'm officially affiliated with ArcEmu; I'm still a freelancer programmer, but looks like I have earned that dev. tag.
0

#17 User is offline   alleycat 

  • Helps so much & is so mature & gay
  • PipPipPipPipPip
  • Group: Members
  • Posts: 835
  • Joined: 25-July 08
  • Gender:Male

Posted 17 June 2009 - 05:30 PM

Weird.

	entry = ( temp & 0x00FFFFFF);
	type = ( (temp >> 24) & 0x000000FF);
?
I can haz cookie?
0

#18 User is offline   vlack 

  • God of copy-paste
  • PipPipPipPipPipPip
  • Group: Developers
  • Posts: 1,159
  • Joined: 26-July 08
  • Gender:Male
  • Location:Hungary
  • Interests:Helping people who think they're RIL PRO, then come here crying that this or that doesn't work for them.

Posted 17 June 2009 - 05:40 PM

View Postalleycat, on Jun 18 2009, 12:30 AM, said:

Weird.

	entry = ( temp & 0x00FFFFFF);
	type = ( (temp >> 24) & 0x000000FF);
?

No, not weird at all. The highest byte contains the type, the rest (lowest 3) the entry. It is an uint8 + uint24 structure, but you won't find an uint24 anywhere :P
That's why they play with shifting and doing the bitwise AND operation...

In my eyes this is a pretty elegant solution.
Being an ArcEmu developer requires you to be committed to some specific case. That's why I refuse to be one.
What you see below my name doesn't mean I'm officially affiliated with ArcEmu; I'm still a freelancer programmer, but looks like I have earned that dev. tag.
0

#19 User is offline   alleycat 

  • Helps so much & is so mature & gay
  • PipPipPipPipPip
  • Group: Members
  • Posts: 835
  • Joined: 25-July 08
  • Gender:Male

Posted 17 June 2009 - 05:44 PM

Weird...but cool :-).

That explains the uint16, uint8, uint8 :-D
I can haz cookie?
0

#20 User is offline   alleycat 

  • Helps so much & is so mature & gay
  • PipPipPipPipPip
  • Group: Members
  • Posts: 835
  • Joined: 25-July 08
  • Gender:Male

Posted 17 June 2009 - 05:48 PM

void WorldSession::HandleSetLookingForGroup(WorldPacket& recvPacket)
{
	uint32 LfgQueueId;
	uint32 LfgDungeon, LfgDungeonId, LfgType;
	uint8 Role,unk2;
	uint32 i;

	WorldPacket data(SMSG_LFG_UPDATE, 3);
	
	recvPacket >> LfgQueueId >> LfgDungeon >> Role >> unk2;

	LfgDungeonId = ( LfgDungeon & 0x00FFFFFF );
	LfgType = ( (LfgDungeon >> 24) & 0x000000FF );
	
	if(LfgDungeonId >= MAX_DUNGEONS || LfgQueueId >= MAX_LFG_QUEUE_ID || LfgType != LfgDungeonTypes[LfgDungeonId])		// last one is for cheaters
		return;
	
	if(_player->LfgDungeonId[LfgQueueId] != 0)
		sLfgMgr.RemovePlayerFromLfgQueue(_player, _player->LfgDungeonId[LfgQueueId]);
	
	_player->LfgDungeonId[LfgQueueId]=LfgDungeonId;
	_player->LfgType[LfgQueueId]=LfgType;
	_player->lfgRole = Role;

	if(LfgDungeonId)
	{
		sLfgMgr.SetPlayerInLFGqueue(_player, LfgDungeonId);

		if(LfgType == LFG_HEROIC_DUNGEON || LfgType == LFG_INSTANCE)
		{
			sLfgMgr.UpdateLfgQueue(LfgDungeonId);
			if(_player->m_Autojoin)
				_player->SendMeetingStoneQueue(LfgDungeonId, 1);
		}
		data << uint8(0) << uint8(1) << uint8(0);
		this->SendPacket(&data);
	}
	else
	{
		for(i = 0; i < 3; ++i)
		{
			if(_player->LfgDungeonId[i] != 0)
				break;
		}

		if( i == 3 )
			_player->PartLFGChannel();

		data << uint8(0) << uint8(0) << uint8(0);
		this->SendPacket(&data);
	}
}


and update struct above
I can haz cookie?
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users