[Request] NPC Spawn Packet Patch 5325

12/03/2010 05:29 stealarcher#1
Im currently working on a source for 5325, and for some odd reason the NPCs dont want to spawn. The packets are sending at the correct time etc, so its something with the packet. The current packet i have is this:

Packet Length = 36
ushort 28, offset 0 //also tried ushort of 20
ushort 2030, offset 2
uint UID, offset 4
ushort X, offset 8
ushort Y, offset 10
ushort Type, offset 12
ushort Kind, offset 14
ushort 1, offset 16 //also tried offset of 20

I looked on korvacs wiki, seems that its the same. Cant seem to find any more information. Any help would be greatly appreciated.
12/03/2010 06:37 FuriousFang#2
fixed =]
Good luck with your server!
12/03/2010 08:12 InfamousNoone#3
Code:
CNpcEntity::CNpcEntity(BYTE* pMsg, int MsgLength)
{
	PACKETREADER rdr;
	CreatePacketReader(&rdr, pMsg, MsgLength);
	StepPacket(&rdr, sizeof(WORD) * 2);
	this->NpcID = ReadPacket<int>(&rdr);
	StepPacket(&rdr, 4);
	this->X = ReadPacket<WORD>(&rdr);
	this->Y = ReadPacket<WORD>(&rdr);
	this->NpcType = ReadPacket<WORD>(&rdr);
	this->Interaction = ReadPacket<WORD>(&rdr);
	StepPacket(&rdr, sizeof(WORD));
	if (ReadPacket<BYTE>(&rdr))
	{
		int len = ReadPacket<BYTE>(&rdr);
		for (int i = 0; i < len; i++)
			szName[i] = ReadPacket<char>(&rdr);
		szName[len] = NULL;
	}
	else
	{
		char szNpc[MAX_PATH];
		strcpy(szNpc, szConquerPath);
		strcat(szNpc, "ini\\npc.ini");
		char szLookFor[32];		
		sprintf(szLookFor, "NpcType%d", (int)(this->NpcType / 10));
		memset(szName, 0,sizeof(szName));
		GetPrivateProfileStringA(szLookFor, "Name", "NPC_ERROR", szName, sizeof(szName), szNpc);
	}
}
Albeit,
Code:
WORD Size;
WORD Type;
DWORD NpcID;
DWORD StatusFlag;
WORD X;
WORD Y;
WORD NpcType;
WORD Interaction;
WORD wUnknown;
/* where StringCount>0, the first string is the name */
BYTE StringCount;
{
	BYTE Length;
	char Value[Length];
} Strings[StringCount];
12/03/2010 10:41 FuriousFang#4
What on earth is that Infamous... x.x I can't even understand it.
12/03/2010 10:55 _DreadNought_#5
C++.

The first block of code Infamous shows you is the packet structure(?) and the second one is the INpc interface. I know nothing about C++ so I could be wrong.
12/03/2010 11:42 Nullable#6
The first code block is a constructor for CNpcEntity class.
The second code block looks like a pseudo-struct (since the last part about the strings isn't correct syntax-wise) for the packet.
However that's probably a snippet from a proxy/client-emulator.

EDIT:

The packet structure put out simply:
Code:
ushort Length; 0
ushort Type; 2
uint NpcID; 4
uint StatusFlags; 8
ushort X; 12
ushort Y; 14
ushort NpcType; 16
ushort Interaction; 18
ushort uUnknown; 20
byte StringCount; 22

// add the npc name as the first string
foreach string
byte StringLength; 23 + pos
string Value; 24 + pos