Confused about the spawn entity packet

12/19/2010 14:41 Kiyono#1
So I wanted to update the spawn entity packet from Hybrid's source (5135 -> 5165)
Code:
public unsafe struct SpawnEntityPacket
    {
        [FieldOffset(0)]
        public ushort Size;
        [FieldOffset(2)]
        public ushort Type;
        [FieldOffset(4)]
        public uint Model;
        [FieldOffset(8)]
        public uint UID;
        [FieldOffset(12)]
        public ushort GuildID;
        [FieldOffset(15)]
        public GuildRank GuildRank;
        [FieldOffset(16)]
        public ulong StatusFlag;

        [FieldOffset(24)]
        public uint HelmetID;
        [FieldOffset(28)]
        public uint HorseID;
        [FieldOffset(32)]
        public uint ArmorID;
        [FieldOffset(36)]
        public uint LeftHandID;
        [FieldOffset(40)]
        public uint RightHandID;

        [FieldOffset(48)]
        public ushort Hitpoints;
        [FieldOffset(50)]
        public ushort Level;
        [FieldOffset(52)]
        public ushort Hairstyle;
        [FieldOffset(54)]
        public ushort X;
        [FieldOffset(56)]
        public ushort Y;
        [FieldOffset(58)]
        public ConquerAngle Facing;
        [FieldOffset(59)]
        public ConquerAction Action;
        [FieldOffset(64)]
        public byte Reborn;

        [FieldOffset(65)]
        public ushort LevelPotency;
        [FieldOffset(70)]
        public int OtherPotency;
        [FieldOffset(84)]
        public NobilityID Nobility;

        [FieldOffset(88)]
        public ushort ArmorColor;
        [FieldOffset(90)]
        public ushort ShieldColor;
        [FieldOffset(92)]
        public ushort HeadColor;

        [FieldOffset(110)]
        public byte StringsCount;
        [FieldOffset(111)]
        public byte NameLength;
        [FieldOffset(112)]
        public fixed byte Strings[24];

        public void SetName(string value)
        {
            string m_Name = value;
            if (m_Name.Length > 15)
                m_Name = m_Name.Substring(0, 15);
            Size = (byte)(0x70 + m_Name.Length);
            StringsCount = 1;
            NameLength = (byte)m_Name.Length;
            fixed (byte* ptr = Strings)
            {
                MSVCRT.memset(ptr, 0, 24);
                value.CopyTo(ptr);
                PacketBuilder.AppendTQServer(ptr + NameLength, 8);
            }
        }

        public static SpawnEntityPacket Create()
        {
            // Size and TQServer are appended when SetName() is called.
            SpawnEntityPacket packet = new SpawnEntityPacket();
            packet.Type = 0x271E;
            return packet;
        }
But there are a few things confusing me:

[FieldOffset(48)]
public ushort Hitpoints;
[FieldOffset(65)]
public ushort LevelPotency;
[FieldOffset(70)]
public int OtherPotency;

According to the packet wiki ([Only registered and activated users can see links. Click Here To Register...]) there's no such thing as HP, LevelPotency and OtherPotency in the packet yet there is in Hybrid's.
So how should I update this?
12/19/2010 14:47 Korvacs#2
Depends which your spawning, the packet wiki only contains the offsets for the character spawning, monster spawning uses offsets which are also used by characters but in a different way. HP, Level Potency and Other Potency are only ever used, to my knowledge for monsters, since they display these details, characters do not.
12/19/2010 15:29 Kiyono#3
Quote:
Originally Posted by Korvacs View Post
Depends which your spawning, the packet wiki only contains the offsets for the character spawning, monster spawning uses offsets which are also used by characters but in a different way. HP, Level Potency and Other Potency are only ever used, to my knowledge for monsters, since they display these details, characters do not.
I thought that Level and Other Potency were used for this:
[Only registered and activated users can see links. Click Here To Register...]
And it doesn't really explain why those values aren't there in the 5165 version.
12/19/2010 17:42 pro4never#4
as korv said. not all values for every use of packets are posted on his wiki. spawn entity can be used for a number of things and therefor some fields will be used in different ones. IE; hp when spawning mobs or the bp calc as mentioned.

Just run through the diff offsets yourself using a cmd and you'll be able to structure it easily enough.
12/19/2010 18:22 Korvacs#5
Quote:
Originally Posted by Kiyono View Post
I thought that Level and Other Potency were used for this:
[Only registered and activated users can see links. Click Here To Register...]
And it doesn't really explain why those values aren't there in the 5165 version.
Your confusing 2 systems, the spawn packet does not relate to that.
12/19/2010 18:58 InfamousNoone#6
Quote:
Originally Posted by Kiyono View Post
So I wanted to update the spawn entity packet from Hybrid's source (5135 -> 5165)
Code:
public unsafe struct SpawnEntityPacket
    {
        [FieldOffset(0)]
        public ushort Size;
        [FieldOffset(2)]
        public ushort Type;
        [FieldOffset(4)]
        public uint Model;
        [FieldOffset(8)]
        public uint UID;
        [FieldOffset(12)]
        public ushort GuildID;
        [FieldOffset(15)]
        public GuildRank GuildRank;
        [FieldOffset(16)]
        public ulong StatusFlag;

        [FieldOffset(24)]
        public uint HelmetID;
        [FieldOffset(28)]
        public uint HorseID;
        [FieldOffset(32)]
        public uint ArmorID;
        [FieldOffset(36)]
        public uint LeftHandID;
        [FieldOffset(40)]
        public uint RightHandID;

        [FieldOffset(48)]
        public ushort Hitpoints;
        [FieldOffset(50)]
        public ushort Level;
        [FieldOffset(52)]
        public ushort Hairstyle;
        [FieldOffset(54)]
        public ushort X;
        [FieldOffset(56)]
        public ushort Y;
        [FieldOffset(58)]
        public ConquerAngle Facing;
        [FieldOffset(59)]
        public ConquerAction Action;
        [FieldOffset(64)]
        public byte Reborn;

        [FieldOffset(65)]
        public ushort LevelPotency;
        [FieldOffset(70)]
        public int OtherPotency;
        [FieldOffset(84)]
        public NobilityID Nobility;

        [FieldOffset(88)]
        public ushort ArmorColor;
        [FieldOffset(90)]
        public ushort ShieldColor;
        [FieldOffset(92)]
        public ushort HeadColor;

        [FieldOffset(110)]
        public byte StringsCount;
        [FieldOffset(111)]
        public byte NameLength;
        [FieldOffset(112)]
        public fixed byte Strings[24];

        public void SetName(string value)
        {
            string m_Name = value;
            if (m_Name.Length > 15)
                m_Name = m_Name.Substring(0, 15);
            Size = (byte)(0x70 + m_Name.Length);
            StringsCount = 1;
            NameLength = (byte)m_Name.Length;
            fixed (byte* ptr = Strings)
            {
                MSVCRT.memset(ptr, 0, 24);
                value.CopyTo(ptr);
                PacketBuilder.AppendTQServer(ptr + NameLength, 8);
            }
        }

        public static SpawnEntityPacket Create()
        {
            // Size and TQServer are appended when SetName() is called.
            SpawnEntityPacket packet = new SpawnEntityPacket();
            packet.Type = 0x271E;
            return packet;
        }
But there are a few things confusing me:

[FieldOffset(48)]
public ushort Hitpoints;
[FieldOffset(65)]
public ushort LevelPotency;
[FieldOffset(70)]
public int OtherPotency;

According to the packet wiki ([Only registered and activated users can see links. Click Here To Register...]) there's no such thing as HP, LevelPotency and OtherPotency in the packet yet there is in Hybrid's.
So how should I update this?
Hitpoints refers to a monsters hitpoints (as monters are spawned with given HP). LevelPotency, and OtherPotency is visible when you view a persons equipment. I'd assume this is "LevelPotency":
Quote:
69 byte Character_Level
and OtherPotency simply isn't documented in this structure (so you'd have to guess & test to find out where it is, it's likely between 69-88).

So, you'll have to find the new offsets for OtherPotency, and Hitpoints. You can base them off my current offsets, and, [Only registered and activated users can see links. Click Here To Register...]
Essentially, this hints the value is either at the offset specified or above it.
12/19/2010 22:42 Kiyono#7
Quote:
Originally Posted by InfamousNoone View Post
Hitpoints refers to a monsters hitpoints (as monters are spawned with given HP). LevelPotency, and OtherPotency is visible when you view a persons equipment. I'd assume this is "LevelPotency":

and OtherPotency simply isn't documented in this structure (so you'd have to guess & test to find out where it is, it's likely between 69-88).

So, you'll have to find the new offsets for OtherPotency, and Hitpoints. You can base them off my current offsets, and, [Only registered and activated users can see links. Click Here To Register...]
Essentially, this hints the value is either at the offset specified or above it.
Isn't this the character level?
[FieldOffset(50)]
public ushort Level;
12/20/2010 01:41 InfamousNoone#8
Quote:
Originally Posted by Kiyono View Post
Isn't this the character level?
[FieldOffset(50)]
public ushort Level;

Uh, there's two "level" offsets in the spawn packet. One is for monsters (it's how the client determines whether a monster is black name or redname)... and the other one is for potency (like, when you view someone's equipment, it says their level).