|
From: <iea...@us...> - 2008-06-09 00:52:15
|
Revision: 701
http://seq.svn.sourceforge.net/seq/?rev=701&view=rev
Author: ieatacid
Date: 2008-06-08 17:52:12 -0700 (Sun, 08 Jun 2008)
Log Message:
-----------
+ Updated version to 5.12.4
+ Updated OP_ZoneSpawns
+ Updated structs and code to handle variable-length spawn data
-This line, and those below, will be ignored--
M conf/zoneopcodes.xml
M configure.in
M src/netstream.cpp
M src/netstream.h
M src/spawnshell.h
M src/s_everquest.h
M src/everquest.h
M src/spawnshell.cpp
M src/interface.cpp
M ChangeLog
Modified Paths:
--------------
showeq/trunk/ChangeLog
showeq/trunk/conf/zoneopcodes.xml
showeq/trunk/configure.in
showeq/trunk/src/everquest.h
showeq/trunk/src/interface.cpp
showeq/trunk/src/netstream.cpp
showeq/trunk/src/netstream.h
showeq/trunk/src/s_everquest.h
showeq/trunk/src/spawnshell.cpp
showeq/trunk/src/spawnshell.h
Modified: showeq/trunk/ChangeLog
===================================================================
--- showeq/trunk/ChangeLog 2008-04-23 02:15:01 UTC (rev 700)
+++ showeq/trunk/ChangeLog 2008-06-09 00:52:12 UTC (rev 701)
@@ -1,5 +1,11 @@
Version: $Id$ $Name$
+ieatacid (6/8/08)
+----------------
++ Updated version to 5.12.4
++ Updated OP_ZoneSpawns
++ Updated structs and code to handle variable-length spawn data
+
ieatacid (4/22/08)
----------------
+ Updated version to 5.12.3.1
Modified: showeq/trunk/conf/zoneopcodes.xml
===================================================================
--- showeq/trunk/conf/zoneopcodes.xml 2008-04-23 02:15:01 UTC (rev 700)
+++ showeq/trunk/conf/zoneopcodes.xml 2008-06-09 00:52:12 UTC (rev 701)
@@ -11,9 +11,9 @@
<payload dir="client" typename="ClientZoneEntryStruct" sizechecktype="match"/>
<payload dir="server" typename="ServerZoneEntryStruct" sizechecktype="none"/>
</opcode>
- <opcode id="72f8" name="OP_ZoneSpawns" updated="01/17/08">
+ <opcode id="1900" name="OP_ZoneSpawns" updated="05/29/08">
<comment>old ZoneSpawnsCode</comment>
- <payload dir="server" typename="spawnStruct" sizechecktype="modulus"/>
+ <payload dir="server" typename="spawnStruct" sizechecktype="none"/>
</opcode>
<opcode id="6015" name="OP_TimeOfDay" updated="01/17/08">
<comment>old TimeOfDayCode</comment>
@@ -74,7 +74,7 @@
<payload dir="both" typename="deleteSpawnStruct" sizechecktype="match"/>
</opcode>
<opcode id="3164" name="OP_RemoveSpawn" updated="04/17/08">
- <comment>Remove spawn from update radius</comment>
+ <comment>Remove spawn from zone</comment>
<payload dir="server" typename="removeSpawnStruct" sizechecktype="none"/>
</opcode>
<opcode id="1B85" name="OP_Death" updated="01/17/08">
Modified: showeq/trunk/configure.in
===================================================================
--- showeq/trunk/configure.in 2008-04-23 02:15:01 UTC (rev 700)
+++ showeq/trunk/configure.in 2008-06-09 00:52:12 UTC (rev 701)
@@ -2,7 +2,7 @@
dnl $Id$ $Name$
AC_PREREQ(2.59)
-AC_INIT(showeq, 5.12.3.1)
+AC_INIT(showeq, 5.12.4.0)
AC_CONFIG_SRCDIR(src/main.cpp)
AC_CANONICAL_SYSTEM
Modified: showeq/trunk/src/everquest.h
===================================================================
--- showeq/trunk/src/everquest.h 2008-04-23 02:15:01 UTC (rev 700)
+++ showeq/trunk/src/everquest.h 2008-06-09 00:52:12 UTC (rev 701)
@@ -939,111 +939,253 @@
};
#endif
-/*
+/*
** Generic Spawn Struct
-** Length: 532 Octets
+** Length: Variable.
** Used in:
** dbSpawnStruct
** petStruct
** spawnShroudOther
** spawnShroudSelf
-*/
+*/
+// Fixed-length struct that we'll fill with data from the variable-length packet,
+// unnecessary fields removed, arranged in order with the packet.
struct spawnStruct
{
-/*0000*/ uint8_t unknown0000[6];
-/*0006*/ uint8_t bodytype; // Bodytype
-/*0007*/ uint8_t unknown0007[40];
-/*0047*/ char suffix[32]; // Player's suffix (of Veeshan, etc.)
-/*0079*/ char lastName[32]; // Player's Lastname
-/*0111*/ int16_t deity; // Player's Deity
-/*0113*/ uint8_t unknown0113[2];
-/*0115*/ uint8_t state; // stand state
-/*0116*/ uint8_t unknown0116[9];
-/*0125*/ char title[32]; // Title
-/*0157*/ uint8_t unknown0157[4];
-/*0161*/ signed padding0000:12; // ***Placeholder
+/*0000*/ char name[64];
+/*0000*/ uint32_t spawnId;
+/*0000*/ uint8_t level;
+/*0000*/ uint8_t NPC; // 0=player,1=npc,2=pc corpse,3=npc corpse
+/*0000*/ union
+ {
+ struct
+ {
+ unsigned padding7:1;
+ unsigned AFK:1;
+ unsigned sneak:1;
+ unsigned LFG:1;
+ unsigned padding6:1;
+ unsigned invis:1;
+ unsigned padding5:11;
+ unsigned gm:1;
+ unsigned anon:1; // 0=normal, 1=anon, 2=roleplay
+ unsigned padding4:1;
+ unsigned gender:1; // Gender (0=male, 1=female)
+ unsigned padding3:1;
+ unsigned linkdead:1;
+ unsigned betabuffed:1;
+ unsigned padding2:2;
+ unsigned targetable:1;
+ unsigned targetcyclable:1;
+ unsigned padding1:2;
+ unsigned trader:1;
+ unsigned buyer:1;
+ };
+ int32_t miscData;
+ };
+/*0000*/ uint8_t hasTitleOrSuffix;
+/*0000*/ uint32_t race;
+/*0000*/ uint8_t charProperties;
+/*0000*/ uint32_t bodytype;
+/*0000*/ uint32_t bodytype2;
+/*0000*/ uint8_t curHp;
+/*0000*/ uint8_t holding;
+/*0000*/ uint32_t deity;
+/*0000*/ uint32_t guildID;
+/*0000*/ uint32_t guildstatus; // 0=member, 1=officer, 2=leader, -1=not guilded
+/*0000*/ uint8_t class_;
+/*0000*/ uint8_t state; // stand state
+/*0000*/ uint8_t light;
+/*0000*/ char lastName[32];
+/*0000*/ uint32_t petOwnerId;
+ union
+ {
+ struct
+ {
+/*0000*/ signed padding0000:12; // ***Placeholder
+ signed deltaX:13; // change in x
+ signed padding0005:7; // ***Placeholder
+/*0000*/ signed deltaHeading:10;// change in heading
+ signed deltaY:13; // change in y
+ signed padding0006:9; // ***Placeholder
+/*0000*/ signed y:19; // y coord
+ signed animation:13; // animation
+/*0000*/ unsigned heading:12; // heading
+ signed x:19; // x coord
+ signed padding0014:1; // ***Placeholder
+/*0000*/ signed z:19; // z coord
+ signed deltaZ:13; // change in z
+ };
+ int32_t posData[5];
+ };
+/*0000*/ union
+ {
+ struct
+ {
+ /*0000*/ Color_Struct color_helmet; // Color of helmet item
+ /*0000*/ Color_Struct color_chest; // Color of chest item
+ /*0000*/ Color_Struct color_arms; // Color of arms item
+ /*0000*/ Color_Struct color_bracers; // Color of bracers item
+ /*0000*/ Color_Struct color_hands; // Color of hands item
+ /*0000*/ Color_Struct color_legs; // Color of legs item
+ /*0000*/ Color_Struct color_feet; // Color of feet item
+ /*0000*/ Color_Struct color_primary; // Color of primary item
+ /*0000*/ Color_Struct color_secondary; // Color of secondary item
+ } equipment_colors;
+ /*0000*/ Color_Struct colors[9]; // Array elements correspond to struct equipment_colors above
+ };
+/*0000*/ union
+ {
+ struct
+ {
+ /*0000*/ EquipStruct equip_helmet; // Equiptment: Helmet visual
+ /*0000*/ EquipStruct equip_chest; // Equiptment: Chest visual
+ /*0000*/ EquipStruct equip_arms; // Equiptment: Arms visual
+ /*0000*/ EquipStruct equip_bracers; // Equiptment: Wrist visual
+ /*0000*/ EquipStruct equip_hands; // Equiptment: Hands visual
+ /*0000*/ EquipStruct equip_legs; // Equiptment: Legs visual
+ /*0000*/ EquipStruct equip_feet; // Equiptment: Boots visual
+ /*0000*/ EquipStruct equip_primary; // Equiptment: Main visual
+ /*0000*/ EquipStruct equip_secondary; // Equiptment: Off visual
+ } equip;
+ /*0000*/ EquipStruct equipment[9];
+ };
+/*0000*/ char title[32];
+/*0000*/ char suffix[32];
+};
+
+#if 0
+// Basic structure of how the packet looks on the wire, for reference.
+// May 29, 2008 eqgame.exe
+struct spawnStruct
+{
+/*0000*/ char name[0];
+/*0000*/ uint32_t spawnId;
+/*0000*/ uint8_t level;
+/*0000*/ float unknown1;
+/*0000*/ uint8_t NPC; // 0=player,1=npc,2=pc corpse,3=npc corpse
+/*0000*/ unsigned padding7:1;
+ unsigned AFK:1;
+ unsigned sneak:1;
+ unsigned LFG:1;
+ unsigned padding6:1;
+ unsigned invis:1;
+ unsigned padding5:11;
+ unsigned gm:1;
+ unsigned anon:1; // 0=normal, 1=anon, 2=roleplay
+ unsigned padding4:1;
+ unsigned gender:1; // Gender (0=male, 1=female)
+ unsigned padding3:1;
+ unsigned linkdead:1;
+ unsigned betabuffed:1;
+ unsigned padding2:2;
+ unsigned targetable:1;
+ unsigned targetcyclable:1;
+ unsigned padding1:2;
+ unsigned trader:1;
+ unsigned buyer:1;
+/*0000*/ uint8_t hasTitleOrSuffix; // & 4=title, & 8=suffix, & 1 - it's a chest
+/*0000*/ uint32_t unknown3;
+/*0000*/ uint32_t unknown4;
+/*0000*/ uint32_t unknown5;
+/*0000*/ uint8_t facestyle;
+/*0000*/ float walkspeed;
+/*0000*/ float runspeed;
+/*0000*/ uint32_t race;
+/*0000*/ uint8_t charProperties; // for body types
+/*0000*/ uint32_t bodytype;
+/*0000*/ uint32_t bodytype2; // this is only present if charProperties==2
+ // are there more than two possible properties?
+/*0000*/ uint8_t curHp;
+/*0000*/ uint8_t haircolor;
+/*0000*/ uint8_t facialhaircolor;
+/*0000*/ uint8_t eyecolor1;
+/*0000*/ uint8_t eyecolor2;
+/*0000*/ uint8_t hairstyle;
+/*0000*/ uint8_t facialhair;
+/*0000*/ uint32_t heritage;
+/*0000*/ uint32_t tattoo;
+/*0000*/ uint32_t details;
+/*0000*/ uint8_t holding;
+/*0000*/ uint32_t deity;
+/*0000*/ uint32_t guildID;
+/*0000*/ uint32_t guildstatus; // 0=member, 1=officer, 2=leader, -1=not guilded
+/*0000*/ uint8_t class_;
+/*0000*/ uint8_t PVP;
+/*0000*/ uint8_t state; // stand state
+/*0000*/ uint8_t light;
+/*0000*/ uint8_t unknown7;
+/*0000*/ uint8_t unknown8;
+/*0000*/ uint8_t unknown9;
+/*0000*/ uint8_t unknown10;
+/*0000*/ uint8_t unknown11;
+/*0000*/ char lastName[0];
+/*0000*/ uint32_t AARank;
+/*0000*/ uint8_t unknown12;
+/*0000*/ uint32_t petOwnerId;
+/*0000*/ uint8_t unknown13;
+/*0000*/ uint32_t unknown14;
+/*0000*/ uint32_t unknown15;
+/*0000*/ uint32_t unknown16;
+/*0000*/ uint32_t unknown17;
+/*0000*/ uint32_t unknown18;
+/*0000*/ uint32_t unknown19;
+/*0000*/ signed padding0000:12; // ***Placeholder
signed deltaX:13; // change in x
signed padding0005:7; // ***Placeholder
-/*0165*/ signed deltaHeading:10;// change in heading
+/*0000*/ signed deltaHeading:10;// change in heading
signed deltaY:13; // change in y
signed padding0006:9; // ***Placeholder
-/*0169*/ signed y:19; // y coord
+/*0000*/ signed y:19; // y coord
signed animation:13; // animation
-/*0173*/ unsigned heading:12; // heading
+/*0000*/ unsigned heading:12; // heading
signed x:19; // x coord
signed padding0014:1; // ***Placeholder
-/*0177*/ signed z:19; // z coord
+/*0000*/ signed z:19; // z coord
signed deltaZ:13; // change in z
-/*0181*/ uint8_t unknown0181[25];
-/*0206*/ char name[64];// // Player's Name
-/*0270*/ uint8_t unknown0270[4];
-/*0274*/ uint8_t light; // Spawn's lightsource
-/*0275*/ uint8_t unknown0275[5];
-/*0280*/ uint8_t NPC; // 0=player,1=npc,2=pc corpse,3=npc corpse
-/*0281*/ uint8_t unknown0281[11];
-/*0292*/ uint8_t level; // Spawn Level
-/*0293*/ uint8_t unknown0293;
-/*0294*/ uint8_t gender; // Gender (0=male, 1=female)
-/*0295*/ uint8_t unknown0295[3];
-/*0298*/ uint32_t guildID; // Current guild
-/*0302*/ uint8_t unknown0302[15];
-/*0317*/ uint8_t anon; // 0=normal, 1=anon, 2=roleplay
-/*0318*/ uint8_t unknown0318[5];
-/*0323*/ uint32_t petOwnerId; // If this is a pet, the spawn id of owner
-/*0327*/ uint8_t class_; // Player's class
-/*0328*/ uint8_t unknown0328[15];
-/*0343*/ uint32_t spawnId; // Spawn Id
-/*0347*/ uint8_t unknown0347;
-/*0348*/ union
+/*0000*/ union
{
- struct
- {
- /*0348*/ EquipStruct equip_helmet; // Equiptment: Helmet visual
- /*0360*/ EquipStruct equip_chest; // Equiptment: Chest visual
- /*0372*/ EquipStruct equip_arms; // Equiptment: Arms visual
- /*0384*/ EquipStruct equip_bracers; // Equiptment: Wrist visual
- /*0396*/ EquipStruct equip_hands; // Equiptment: Hands visual
- /*0408*/ EquipStruct equip_legs; // Equiptment: Legs visual
- /*0420*/ EquipStruct equip_feet; // Equiptment: Boots visual
- /*0432*/ EquipStruct equip_primary; // Equiptment: Main visual
- /*0444*/ EquipStruct equip_secondary; // Equiptment: Off visual
- } equip;
- /*0348*/ EquipStruct equipment[9];
+ struct
+ {
+ /*0000*/ Color_Struct color_helmet; // Color of helmet item
+ /*0000*/ Color_Struct color_chest; // Color of chest item
+ /*0000*/ Color_Struct color_arms; // Color of arms item
+ /*0000*/ Color_Struct color_bracers; // Color of bracers item
+ /*0000*/ Color_Struct color_hands; // Color of hands item
+ /*0000*/ Color_Struct color_legs; // Color of legs item
+ /*0000*/ Color_Struct color_feet; // Color of feet item
+ /*0000*/ Color_Struct color_primary; // Color of primary item
+ /*0000*/ Color_Struct color_secondary; // Color of secondary item
+ } equipment_colors;
+ /*0000*/ Color_Struct colors[9]; // Array elements correspond to struct equipment_colors above
};
-/*0456*/ uint8_t unknown0465[11];
-/*0467*/ uint8_t gm;
-/*0468*/ float runspeed; // Speed when running
-/*0472*/ uint8_t unknown0472[3];
-/*0475*/ union
+
+// skip these bytes if not a valid player race
+/*0000*/ union
{
- struct
- {
- /*0475*/ Color_Struct color_helmet; // Color of helmet item
- /*0479*/ Color_Struct color_chest; // Color of chest item
- /*0483*/ Color_Struct color_arms; // Color of arms item
- /*0487*/ Color_Struct color_bracers; // Color of bracers item
- /*0491*/ Color_Struct color_hands; // Color of hands item
- /*0495*/ Color_Struct color_legs; // Color of legs item
- /*0499*/ Color_Struct color_feet; // Color of feet item
- /*0503*/ Color_Struct color_primary; // Color of primary item
- /*0507*/ Color_Struct color_secondary; // Color of secondary item
- } equipment_colors;
- /*0475*/ Color_Struct colors[9]; // Array elements correspond to struct equipment_colors above
+ struct
+ {
+ /*0000*/ EquipStruct equip_helmet; // Equiptment: Helmet visual
+ /*0000*/ EquipStruct equip_chest; // Equiptment: Chest visual
+ /*0000*/ EquipStruct equip_arms; // Equiptment: Arms visual
+ /*0000*/ EquipStruct equip_bracers; // Equiptment: Wrist visual
+ /*0000*/ EquipStruct equip_hands; // Equiptment: Hands visual
+ /*0000*/ EquipStruct equip_legs; // Equiptment: Legs visual
+ /*0000*/ EquipStruct equip_feet; // Equiptment: Boots visual
+ /*0000*/ EquipStruct equip_primary; // Equiptment: Main visual
+ /*0000*/ EquipStruct equip_secondary; // Equiptment: Off visual
+ } equip;
+ /*0000*/ EquipStruct equipment[9];
};
-/*0511*/ uint32_t race; // Spawn race
-/*0515*/ uint8_t unknown0515;
-/*0516*/ uint8_t curHp; // Current hp
-/*0517*/ uint8_t unknown0517[15];
-/*0532*/
-/*0891*/ //float walkspeed; // Speed when walking (couldn't find for 4/17/2008 patch - ieatacid)
+/*0000*/ char title[0]; // only read if(hasTitleOrSuffix & 4)
+/*0000*/ char suffix[0]; // only read if(hasTitleOrSuffix & 8)
+/*0000*/ char unknown20[32];
};
+#endif
-
-
-
#if 0
// Old stuff from spawnStruct seq doesn't actually use at all..
//
@@ -1280,15 +1422,15 @@
* Shroud spawn. For others shrouding, this has their spawnId and
* spawnStruct.
*
- * Length: 586
+ * Length: variable
* OpCode: OP_Shroud
*/
struct spawnShroudOther
{
/*00000*/ uint32_t spawnId; // Spawn Id of the shrouded player
-/*00004*/ spawnStruct spawn; // Updated spawn struct for the player
-/*00536*/ uint8_t unknown00536[465];
-/*1001*/
+/*00004*/ uint16_t spawnStructSize; // Size of spawnStruct (or start of)
+/*00006*/ spawnStruct spawn; // Updated spawn struct for the player (variable length)
+/*xxxxx*/
};
/**
@@ -1303,10 +1445,10 @@
struct spawnShroudSelf
{
/*00000*/ uint32_t spawnId; // Spawn Id of you
-/*00004*/ spawnStruct spawn; // Updated spawnStruct for you
-/*00536*/ uint8_t unknown00536[465];
-/*01001*/ playerProfileStruct profile; // Character profile for shrouded char
-/*16153*/ uint8_t items; // Items on the player
+/*00004*/ uint16_t ppStart; // Start of playerProfile data (spawnId+ppStart+spawnStruct)
+/*00004*/ spawnStruct spawn; // Updated spawnStruct for you (variable length)
+/*xxxxx*/ playerProfileStruct profile; // Character profile for shrouded char
+/*xxxxx*/ uint8_t items; // Items on the player
/*xxxxx*/
};
Modified: showeq/trunk/src/interface.cpp
===================================================================
--- showeq/trunk/src/interface.cpp 2008-04-23 02:15:01 UTC (rev 700)
+++ showeq/trunk/src/interface.cpp 2008-06-09 00:52:12 UTC (rev 701)
@@ -1982,7 +1982,7 @@
"corpseLocStruct", SZC_Match,
m_spawnShell, SLOT(corpseLoc(const uint8_t*)));
m_packet->connect2("OP_ZoneSpawns", SP_Zone, DIR_Server,
- "spawnStruct", SZC_Modulus,
+ "spawnStruct", SZC_None,
m_spawnShell, SLOT(zoneSpawns(const uint8_t*, size_t)));
// connect the SpellShell slots to ZoneMgr signals
Modified: showeq/trunk/src/netstream.cpp
===================================================================
--- showeq/trunk/src/netstream.cpp 2008-04-23 02:15:01 UTC (rev 700)
+++ showeq/trunk/src/netstream.cpp 2008-06-09 00:52:12 UTC (rev 701)
@@ -157,6 +157,48 @@
return QString();
}
+uint16_t NetStream::readUInt16NC()
+{
+ uint16_t val;
+
+ // make sure there is enough data left
+ if ((m_lastPos - m_pos) >= 2)
+ {
+ // convert the data and increment past it
+ val = eqtohuint16(m_pos);
+ m_pos += 2;
+ }
+ else
+ val = 0; // just return 0 if no data left
+
+ return val;
+}
+
+uint32_t NetStream::readUInt32NC()
+{
+ uint32_t val;
+
+ // make sure there is enough data left
+ if ((m_lastPos - m_pos) >= 4)
+ {
+ // convert the data and increment past it
+ val = eqtohuint32(m_pos);
+ m_pos += 4;
+ }
+ else
+ val = 0; // just return 0 if no data left
+
+ return val;
+}
+
+void NetStream::skipBytes(size_t byteCount)
+{
+ if ((m_lastPos - m_pos) >= byteCount)
+ {
+ m_pos += byteCount;
+ }
+}
+
BitStream::BitStream(const uint8_t* data, size_t length)
: m_data(data)
{
Modified: showeq/trunk/src/netstream.h
===================================================================
--- showeq/trunk/src/netstream.h 2008-04-23 02:15:01 UTC (rev 700)
+++ showeq/trunk/src/netstream.h 2008-06-09 00:52:12 UTC (rev 701)
@@ -24,6 +24,7 @@
size_t length() { return m_length; }
void reset();
bool end() { return (m_pos >= m_lastPos); }
+ const uint8_t* pos() { return m_pos; }
uint8_t readUInt8();
int8_t readInt8();
@@ -32,6 +33,9 @@
uint32_t readUInt32();
int32_t readInt32();
QString readText();
+ uint16_t readUInt16NC();
+ uint32_t readUInt32NC();
+ void skipBytes(size_t byteCount);
protected:
const uint8_t* m_data;
Modified: showeq/trunk/src/s_everquest.h
===================================================================
--- showeq/trunk/src/s_everquest.h 2008-04-23 02:15:01 UTC (rev 700)
+++ showeq/trunk/src/s_everquest.h 2008-06-09 00:52:12 UTC (rev 701)
@@ -32,6 +32,7 @@
AddStruct(charProfileStruct);
AddStruct(playerAAStruct);
AddStruct(spawnStruct);
+AddStruct(spawnStruct);
AddStruct(ServerZoneEntryStruct);
AddStruct(doorStruct);
AddStruct(makeDropStruct);
Modified: showeq/trunk/src/spawnshell.cpp
===================================================================
--- showeq/trunk/src/spawnshell.cpp 2008-04-23 02:15:01 UTC (rev 700)
+++ showeq/trunk/src/spawnshell.cpp 2008-06-09 00:52:12 UTC (rev 701)
@@ -421,114 +421,213 @@
void SpawnShell::zoneSpawns(const uint8_t* data, size_t len)
{
- int spawndatasize = len / sizeof(spawnStruct);
+ NetStream netStream(data,len);
+ spawnStruct *spawn = new spawnStruct;
+ uint32_t spawnStructSize;
+ uint16_t parm1;
- const spawnStruct* zspawns = (const spawnStruct*)data;
+ while(!netStream.end())
+ {
+ memset(spawn,0,sizeof(spawnStruct));
+ parm1=netStream.readUInt16NC();
+ if(parm1==0x1ff)
+ parm1=netStream.readUInt16NC();
- for (int i = 0; i < spawndatasize; i++)
- {
-#if 0
- // Dump position updates for debugging spawn struct position changes
- for (int j=54; j<70; i++)
- {
- printf("%.2x", zspawns[i][j]);
+ netStream.skipBytes(1);
+ spawnStructSize=fillSpawnStruct(spawn,netStream.pos(),len,false);
+ newSpawn(*spawn);
+ netStream.skipBytes(spawnStructSize);
+ }
+}
- if ((j+1) % 8 == 0)
+uint32_t SpawnShell::fillSpawnStruct(spawnStruct *spawn, const uint8_t *data, size_t len, bool checkLen)
+{
+ NetStream netStream(data,len);
+
+ QString name=netStream.readText();
+
+ if(name.length())
+ strcpy(spawn->name,name.latin1());
+// seqDebug("name=%s",spawn->name);
+
+ spawn->spawnId=netStream.readUInt32NC();
+// seqDebug("id=%d (%x)",spawn->spawnId,spawn->spawnId);
+
+ spawn->level=netStream.readUInt8();
+// seqDebug("level=%d",spawn->level);
+
+ // skip the next 4 bytes
+ netStream.skipBytes(4);
+
+ spawn->NPC=netStream.readUInt8();
+// seqDebug("NPC=%d",spawn->NPC);
+
+ spawn->miscData=netStream.readUInt32NC();
+
+ spawn->hasTitleOrSuffix=netStream.readUInt8();
+
+// seqDebug("miscData: %x hasTitleOrSuffix: %x",spawn->miscData,spawn->hasTitleOrSuffix);
+
+// seqDebug("buyer=%d trader=%d TC=%d T=%d BB=%d LD=%d gen=%d anon=%d gm=%d invis=%d LFG=%d sneak=%d AFK=%d",
+// spawn->buyer,spawn->trader,spawn->targetcyclable,spawn->targetable,spawn->betabuffed,
+// spawn->linkdead,spawn->gender,spawn->anon,spawn->gm,spawn->invis,spawn->LFG,spawn->sneak,spawn->AFK);
+
+ if(spawn->hasTitleOrSuffix & 1)
+ {
+ // it's a chest. skip usual 21 plus extra 56
+ netStream.skipBytes(77);
+ }
+ else
+ {
+ // skip facestyle, walk/run speeds, unknowns
+ netStream.skipBytes(21);
+ }
+
+ spawn->race=netStream.readUInt32NC();
+// seqDebug("race=%d",spawn->race);
+
+ spawn->charProperties=netStream.readUInt8();
+// seqDebug("charProperties=%d",spawn->charProperties);
+
+ if(spawn->charProperties)
+ {
+ spawn->bodytype=netStream.readUInt32NC();
+// seqDebug("bodytype=%d",spawn->bodytype);
+ for(int i=1; i < spawn->charProperties; i++)
{
- printf(" ");
+ // extra character properties
+ int j=netStream.readUInt32NC();
+// netStream.skipBytes(4);
}
- else
+ }
+
+ spawn->curHp=netStream.readUInt8();
+// seqDebug("curHp=%d",spawn->curHp);
+
+ // skip hair and face stuff
+ netStream.skipBytes(18);
+
+ spawn->holding=netStream.readUInt8();
+ spawn->deity=netStream.readUInt32NC();
+ spawn->guildID=netStream.readUInt32NC();
+ spawn->guildstatus=netStream.readUInt32NC();
+ spawn->class_=netStream.readUInt8();
+// seqDebug("holding=%d deity=%d guildID=%d guildstatus=%d class_=%d",spawn->holding,
+// spawn->deity,spawn->guildID,spawn->guildstatus,spawn->class_);
+
+ netStream.skipBytes(1);
+
+ spawn->state=netStream.readUInt8();
+ spawn->light=netStream.readUInt8();
+
+ netStream.skipBytes(5);
+
+ name=netStream.readText();
+
+ if(name.length())
+ {
+ strcpy(spawn->lastName,name.latin1());
+// seqDebug("surname=%s",spawn->lastName);
+ }
+
+ netStream.skipBytes(5);
+
+ spawn->petOwnerId=netStream.readUInt32NC();
+// seqDebug("petOwnerId=%d",spawn->petOwnerId);
+
+ netStream.skipBytes(25);
+
+ spawn->posData[0]=netStream.readUInt32NC();
+ spawn->posData[1]=netStream.readUInt32NC();
+ spawn->posData[2]=netStream.readUInt32NC();
+ spawn->posData[3]=netStream.readUInt32NC();
+ spawn->posData[4]=netStream.readUInt32NC();
+
+// seqDebug("%x %x %x %x %x",spawn->posData[0],spawn->posData[1],spawn->posData[2],spawn->posData[3],spawn->posData[4]);
+
+// seqDebug("%d %d %d | %d %d %d | %d %d | %d",spawn->y>>3,spawn->x>>3,spawn->z>>3,
+// spawn->deltaY>>2,spawn->deltaX>>2,spawn->deltaZ>>2,
+// spawn->heading,spawn->deltaHeading,spawn->animation);
+
+ // skip color
+ netStream.skipBytes(36);
+
+ uint32_t race=spawn->race;
+
+ // this is how the client checks if equipment should be read.
+ if(spawn->NPC==0 || race <= 12 || race==128 || race==130 || race==330 || race==522)
+ {
+ for(int i=0; i<9; i++)
{
- printf(" ");
+ spawn->equipment[i].itemId=netStream.readUInt32NC();
+ spawn->equipment[i].equip1=netStream.readUInt32NC();
+ spawn->equipment[i].equip0=netStream.readUInt32NC();
}
- }
- printf("\n");
-#endif
+ }
-#if 0
- // Debug positioning without having to recompile everything...
-#pragma pack(1)
-struct pos
-{
-/*0002*/ signed padding0000:12; // ***Placeholder
- signed deltaX:13; // change in x
- signed padding0005:7; // ***Placeholder
-/*0006*/ signed deltaHeading:10;// change in heading
- signed deltaY:13; // change in y
- signed padding0006:9; // ***Placeholder
-/*0010*/ signed y:19; // y coord
- signed animation:13; // animation
-/*0014*/ unsigned heading:12; // heading
- signed x:19; // x coord
- signed padding0014:1; // ***Placeholder
-/*0018*/ signed z:19; // z coord
- signed deltaZ:13; // change in z
-/*0022*/
-};
-#pragma pack(0)
- struct pos *p = (struct pos *)(data + i*sizeof(spawnStruct) + 151);
- printf("[%.2x](%f, %f, %f), dx %f dy %f dz %f head %f dhead %f anim %d (%x, %x, %x, %x)\n",
- zspawns[i].spawnId,
- float(p->x)/8.0, float(p->y/8.0), float(p->z)/8.0,
- float(p->deltaX)/4.0, float(p->deltaY)/4.0,
- float(p->deltaZ)/4.0,
- float(p->heading), float(p->deltaHeading),
- p->animation, p->padding0000,
- p->padding0005, p->padding0006, p->padding0014);
-#endif
- newSpawn(zspawns[i]);
- }
+ if(spawn->hasTitleOrSuffix & 4)
+ {
+ name=netStream.readText();
+ strcpy(spawn->title,name.latin1());
+// seqDebug("title=%s",spawn->title);
+ }
+
+ if(spawn->hasTitleOrSuffix & 8)
+ {
+ name=netStream.readText();
+ strcpy(spawn->suffix,name.latin1());
+// seqDebug("suffix=%s",spawn->suffix);
+ }
+
+ netStream.skipBytes(32);
+
+ // now we're at the end
+
+ uint32_t retVal=netStream.pos()-netStream.data();
+
+ if(checkLen && (int32_t)len!=retVal)
+ {
+ seqDebug("SpawnShell::fillSpawnStruct - expected length: %d, read: %d",len,retVal);
+ }
+ return retVal;
}
void SpawnShell::zoneEntry(const uint8_t* data, size_t len)
{
- const spawnStruct* spawn = (const spawnStruct*)data;
+ // Zone Entry. Sent when players are added to the zone.
+ spawnStruct *spawn = new spawnStruct;
+
+ memset(spawn,0,sizeof(spawnStruct));
+
+ fillSpawnStruct(spawn,data,len,true);
+
#ifdef SPAWNSHELL_DIAG
seqDebug("SpawnShell::zoneEntry(spawnStruct *(name='%s'))", spawn->name);
#endif
- // Zone Entry. This is a semi-filled in spawnStruct that we
- // see for ourself when entering a zone. We also get sent this
- // when shrouding and when respawning from corpse hover mode. Auras
- // also get sent this sometimes.
- /* Now all PCs are 0, including self
- if (spawn->NPC==0)
- {
- // Align the player instance with these values
- m_player->update(spawn);
+ Item *item;
- emit changeItem(m_player, tSpawnChangedALL);
-}*/
- Item *item;
- if(len==sizeof(spawnStruct) || len==sizeof(spawnCampfire))
+ if(!strcmp(spawn->name,m_player->name()))
{
- if(!strcmp(spawn->name,m_player->name()))
+ // Multiple zoneEntry packets are received for your spawn after you zone.
+ m_player->update(spawn);
+ emit changeItem(m_player, tSpawnChangedALL);
+ }
+ else
+ {
+ if((item=m_spawns.find(spawn->spawnId)))
{
- // Multiple zoneEntry packets are received for your spawn after you zone.
- m_player->update(spawn);
- emit changeItem(m_player, tSpawnChangedALL);
+ // Update existing spawn
+ Spawn *s=(Spawn*)item;
+ s->update(spawn);
}
else
{
- if((item=m_spawns.find(spawn->spawnId)))
- {
- // Update existing spawn
- Spawn *s=(Spawn*)item;
- s->update(spawn);
- }
- else
- {
- // Create a new spawn
- newSpawn(data);
- }
+ // Create a new spawn
+ newSpawn(*spawn);
}
}
- else
- {
- seqWarn("OP_ZoneEntry (datalen: %d) doesn't match: sizeof(spawnStruct):%d or sizeof(spawnCampfire):%d",
- len,sizeof(spawnStruct),sizeof(spawnCampfire));
- }
}
void SpawnShell::newSpawn(const uint8_t* data)
@@ -539,7 +638,6 @@
const spawnStruct* spawn = (const spawnStruct*)data;
-
newSpawn(*spawn);
}
@@ -560,12 +658,18 @@
// found a match, remove it from the deleted spawn list
m_deadSpawnID[i] = 0;
+ /* Commented this out because it wasn't adding shrouded spawns.
+ Shrouded spawns get deleted from the zone first then added
+ as a new spawn. leaving this here in case another work-around
+ needs to be found. (ieatacid - 6-8-2008)
+
// let the user know what's going on
seqInfo("%s(%d) has already been removed from the zone before we processed it.",
s.name, s.spawnId);
-
+
// and stop the attempt to add the spawn.
return;
+ */
}
}
@@ -973,22 +1077,31 @@
void SpawnShell::shroudSpawn(const uint8_t* data, size_t len, uint8_t dir)
{
- if (len == sizeof(spawnShroudOther))
+ // Self or other person shrouding. newSpawn handled updates too.
+
+ NetStream netStream(data,len);
+
+ uint32_t spawnID=netStream.readUInt32NC();
+ uint16_t spawnStructSize=netStream.readUInt16NC();
+ spawnStructSize-=6;
+
+ if(spawnID!=m_player->id())
{
- // Other person shrouding. newSpawn handled updates too.
- spawnShroudOther* shroud = (spawnShroudOther*) data;
- seqInfo("Shrouding %s (id=%d)",
- shroud->spawn.name, shroud->spawn.spawnId);
-
+ // Shrouding other player
+ spawnShroudOther *shroud = new spawnShroudOther;
+ fillSpawnStruct(&shroud->spawn,netStream.pos(),spawnStructSize,true);
+ seqInfo("Shrouding %s (id=%d)", shroud->spawn.name, shroud->spawn.spawnId);
newSpawn(shroud->spawn);
}
else
{
// Shrouding yourself.
- spawnShroudSelf* shroud = (spawnShroudSelf*) data;
+ spawnShroudSelf *shroud = new spawnShroudSelf;
- seqInfo("Shrouding %s (id=%d)",
- shroud->spawn.name, shroud->spawn.spawnId);
+ fillSpawnStruct(&shroud->spawn,netStream.pos(),spawnStructSize,true);
+ netStream.skipBytes(spawnStructSize);
+ memcpy(&shroud->profile,netStream.pos(),sizeof(playerProfileStruct));
+ seqInfo("Shrouding %s (id=%d)", shroud->spawn.name, shroud->spawn.spawnId);
m_player->loadProfile(shroud->profile);
@@ -1155,6 +1268,10 @@
}
}
}
+ else
+ {
+
+ }
}
else if((len+1)!=sizeof(removeSpawnStruct))
{
Modified: showeq/trunk/src/spawnshell.h
===================================================================
--- showeq/trunk/src/spawnshell.h 2008-04-23 02:15:01 UTC (rev 700)
+++ showeq/trunk/src/spawnshell.h 2008-06-09 00:52:12 UTC (rev 701)
@@ -140,6 +140,7 @@
void deleteItem(spawnItemType type, int id);
bool updateFilterFlags(Item* item);
bool updateRuntimeFilterFlags(Item* item);
+ uint32_t fillSpawnStruct(spawnStruct *spawn, const uint8_t *data, size_t len, bool checkLen);
ItemMap& getMap(spawnItemType type);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|