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