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 //write flags
buffer.WriteUInt8(flags.data[0]); buffer.WriteStructure(flags);
buffer.WriteUInt8(flags.data[1]);
buffer.WriteUInt8(flags.data[2]);
buffer.WriteUInt8(flags.data[3]);
buffer.WriteUInt8(flags.data[4]);
/* /*
float EmitterScalingRadius; float EmitterScalingRadius;
@ -1871,10 +1867,106 @@ namespace Larion
} }
//u8 CPhysicsData[20]; //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 // DECODE methods

View File

@ -193,8 +193,6 @@ namespace Larion {
struct Spawn_Struct_Bitfields struct Spawn_Struct_Bitfields
{ {
union {
struct {
// byte 1 // byte 1
/*00*/ unsigned gender : 2; // Gender (0=male, 1=female, 2=monster) /*00*/ unsigned gender : 2; // Gender (0=male, 1=female, 2=monster)
/*02*/ unsigned ispet : 1; // Guessed based on observing live spawns /*02*/ unsigned ispet : 1; // Guessed based on observing live spawns
@ -227,9 +225,6 @@ namespace Larion {
/*38*/ unsigned unk38 : 1; /*38*/ unsigned unk38 : 1;
/*39*/ unsigned unk39 : 1; /*39*/ unsigned unk39 : 1;
}; };
uint8_t data[5];
};
};
struct Spawn_Struct_Position struct Spawn_Struct_Position
{ {

View File

@ -181,6 +181,21 @@ public:
m_pos += len; 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 size() const { return m_pos; }
size_t length() const { return size(); } size_t length() const { return size(); }
size_t capacity() const { return m_capacity; } size_t capacity() const { return m_capacity; }