initial implementation of zone entry packet.

This commit is contained in:
KimLS 2024-11-16 11:52:06 -08:00
parent 45d39f44f2
commit 7888fb2655
3 changed files with 144 additions and 42 deletions

View File

@ -1626,11 +1626,7 @@ namespace Larion
}
//write flags
buffer.WriteUInt8(flags.data[0]);
buffer.WriteUInt8(flags.data[1]);
buffer.WriteUInt8(flags.data[2]);
buffer.WriteUInt8(flags.data[3]);
buffer.WriteUInt8(flags.data[4]);
buffer.WriteStructure(flags);
/*
float EmitterScalingRadius;
@ -1871,10 +1867,106 @@ namespace Larion
}
//u8 CPhysicsData[20];
structs::Spawn_Struct_Position position;
position.y = emu->y;
position.deltaZ = emu->deltaZ;
position.deltaX = emu->deltaX;
position.x = emu->x;
position.heading = emu->heading;
position.deltaHeading = emu->deltaHeading;
position.z = emu->z;
position.animation = emu->animation;
position.deltaY = emu->deltaY;
buffer.WriteStructure(position);
/*
if(Flags.title) {
char Title[];
}
*/
if (flags.title) {
buffer.WriteString(emu->title);
}
/*
if(Flags.suffix) {
char Suffix[];
}
*/
if (flags.suffix) {
buffer.WriteString(emu->suffix);
}
/*
u32 Unknown0x0164;
s32 SplineID;
*/
buffer.WriteUInt32(0);
buffer.WriteUInt32(0);
/*
u8 Mercenary;
*/
buffer.WriteUInt8(emu->IsMercenary);
/*
char realEstateItemGuid[];
s32 RealEstateID;
s32 RealEstateItemId;
*/
buffer.WriteString("0000000000000000");
buffer.WriteInt32(-1);
buffer.WriteInt32(-1);
/*
s32 MercId;
s32 ContractorID;
u32 Birthdate;
u8 bAlwaysShowAura;
*/
buffer.WriteInt32(0);
buffer.WriteInt32(0);
buffer.WriteUInt32(0);
buffer.WriteUInt8(0);
/*
u32 physicsEffectCount;
PhysicsEffect physicsEffects[physicsEffectCount];
*/
buffer.WriteUInt32(0);
//s32 SpawnStatus[6];
buffer.WriteUInt32(0);
buffer.WriteUInt32(0);
buffer.WriteUInt32(0);
buffer.WriteUInt32(0);
buffer.WriteUInt32(0);
buffer.WriteUInt32(0);
if (flags.interactiveobject && emu->DestructibleUnk9 == 4) {
/*
s32 BannerIndex0;
s32 BannerIndex1;
s32 BannerTint0;
s32 BannerTint1;
*/
buffer.WriteUInt32(0);
buffer.WriteUInt32(0);
buffer.WriteUInt32(0);
buffer.WriteUInt32(0);
}
auto outapp = new EQApplicationPacket(OP_ZoneEntry, buffer.size());
outapp->WriteData(buffer.buffer(), buffer.size());
dest->FastQueuePacket(&outapp, ack_req);
}
delete in;
}
// DECODE methods

View File

@ -193,42 +193,37 @@ namespace Larion {
struct Spawn_Struct_Bitfields
{
union {
struct {
// byte 1
/*00*/ unsigned gender : 2; // Gender (0=male, 1=female, 2=monster)
/*02*/ unsigned ispet : 1; // Guessed based on observing live spawns
/*03*/ unsigned afk : 1; // 0=no, 1=afk
/*04*/ unsigned anon : 2; // 0=normal, 1=anon, 2=roleplay
/*06*/ unsigned gm : 1;
/*07*/ unsigned sneak : 1;
// byte 2
/*08*/ unsigned lfg : 1;
/*09*/ unsigned unk9 : 1;
/*10*/ unsigned invis : 12; // there are 3000 different (non-GM) invis levels
/*22*/ unsigned linkdead : 1; // 1 Toggles LD on or off after name. Correct for RoF2
/*23*/ unsigned showhelm : 1;
// byte 4
/*24*/ unsigned betabuffed : 1; // Prefixes name with !
/*25*/ unsigned trader : 1;
/*26*/ unsigned animationonpop : 1;
/*27*/ unsigned targetable : 1;
/*28*/ unsigned targetable_with_hotkey : 1;
/*29*/ unsigned showname : 1;
/*30*/ unsigned idleanimationsoff : 1; // what we called statue?
/*31*/ unsigned untargetable : 1; // bClickThrough
// byte 5
/*32*/ unsigned buyer : 1;
/*33*/ unsigned offline : 1;
/*34*/ unsigned interactiveobject : 1;
/*35*/ unsigned missile : 1;
/*36*/ unsigned title : 1;
/*37*/ unsigned suffix : 1;
/*38*/ unsigned unk38 : 1;
/*39*/ unsigned unk39 : 1;
};
uint8_t data[5];
};
// byte 1
/*00*/ unsigned gender : 2; // Gender (0=male, 1=female, 2=monster)
/*02*/ unsigned ispet : 1; // Guessed based on observing live spawns
/*03*/ unsigned afk : 1; // 0=no, 1=afk
/*04*/ unsigned anon : 2; // 0=normal, 1=anon, 2=roleplay
/*06*/ unsigned gm : 1;
/*07*/ unsigned sneak : 1;
// byte 2
/*08*/ unsigned lfg : 1;
/*09*/ unsigned unk9 : 1;
/*10*/ unsigned invis : 12; // there are 3000 different (non-GM) invis levels
/*22*/ unsigned linkdead : 1; // 1 Toggles LD on or off after name. Correct for RoF2
/*23*/ unsigned showhelm : 1;
// byte 4
/*24*/ unsigned betabuffed : 1; // Prefixes name with !
/*25*/ unsigned trader : 1;
/*26*/ unsigned animationonpop : 1;
/*27*/ unsigned targetable : 1;
/*28*/ unsigned targetable_with_hotkey : 1;
/*29*/ unsigned showname : 1;
/*30*/ unsigned idleanimationsoff : 1; // what we called statue?
/*31*/ unsigned untargetable : 1; // bClickThrough
// byte 5
/*32*/ unsigned buyer : 1;
/*33*/ unsigned offline : 1;
/*34*/ unsigned interactiveobject : 1;
/*35*/ unsigned missile : 1;
/*36*/ unsigned title : 1;
/*37*/ unsigned suffix : 1;
/*38*/ unsigned unk38 : 1;
/*39*/ unsigned unk39 : 1;
};
struct Spawn_Struct_Position

View File

@ -181,6 +181,21 @@ public:
m_pos += len;
}
template<typename T>
void WriteStructurePtr(T *value) {
auto type_size = sizeof(T);
if (m_pos + type_size > m_capacity)
Grow(m_capacity + type_size);
memcpy(m_buffer + m_pos, value, type_size);
m_pos += sizeof(type_size);
}
template<typename T>
void WriteStructure(T& value) {
WriteStructurePtr(&value);
}
size_t size() const { return m_pos; }
size_t length() const { return size(); }
size_t capacity() const { return m_capacity; }