Update of /cvsroot/seq/showeq/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14368/src Modified Files: everquest.h interface.cpp itemdb.cpp itemdb.h messageshell.cpp player.cpp player.h spawnshell.cpp spawnshell.h Log Message: Added OP_Shroud with handler so when someone shrouds while in the zone, you see spawn list changes properly for them. This involved splitting charProfileStruct out since part of it is shared in OP_Shroud, but not the whole thing. Index: player.h =================================================================== RCS file: /cvsroot/seq/showeq/src/player.h,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- player.h 13 Sep 2005 15:23:13 -0000 1.22 +++ player.h 10 Dec 2005 23:27:15 -0000 1.23 @@ -59,6 +59,7 @@ void setDefaultDeity(uint16_t); void player(const uint8_t* player); + void loadProfile(const playerProfileStruct& player); void increaseSkill(const uint8_t* skilli); void manaChange(const uint8_t* mana); void updateExp(const uint8_t* exp); Index: itemdb.h =================================================================== RCS file: /cvsroot/seq/showeq/src/itemdb.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- itemdb.h 13 Sep 2005 15:23:11 -0000 1.8 +++ itemdb.h 10 Dec 2005 23:27:15 -0000 1.9 @@ -110,6 +110,7 @@ void item(const uint8_t* item, size_t, uint8_t); void playerItem(const uint8_t* item, size_t, uint8_t); void itemInfo(const uint8_t* item, size_t, uint8_t); + void playerShroud(const uint8_t* shroudData, size_t, uint8_t); private: void logItem(const char* serializedItem, size_t len); Index: messageshell.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/messageshell.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- messageshell.cpp 18 Sep 2005 04:10:16 -0000 1.4 +++ messageshell.cpp 10 Dec 2005 23:27:15 -0000 1.5 @@ -693,12 +693,12 @@ player->name, player->lastName); m_messages->addMessage(MT_Player, message); - message.sprintf("Level: %d", player->level); + message.sprintf("Level: %d", player->profile.level); m_messages->addMessage(MT_Player, message); message.sprintf("PlayerMoney: P=%d G=%d S=%d C=%d", - player->platinum, player->gold, - player->silver, player->copper); + player->profile.platinum, player->profile.gold, + player->profile.silver, player->profile.copper); m_messages->addMessage(MT_Player, message); message.sprintf("BankMoney: P=%d G=%d S=%d C=%d", @@ -707,8 +707,8 @@ m_messages->addMessage(MT_Player, message); message.sprintf("CursorMoney: P=%d G=%d S=%d C=%d", - player->platinum_cursor, player->gold_cursor, - player->silver_cursor, player->copper_cursor); + player->profile.platinum_cursor, player->profile.gold_cursor, + player->profile.silver_cursor, player->profile.copper_cursor); m_messages->addMessage(MT_Player, message); message.sprintf("SharedMoney: P=%d", @@ -723,8 +723,8 @@ m_messages->addMessage(MT_Player, message); message = "ExpAA: " + Commanate(player->expAA) + - " (aa spent: " + Commanate(player->aa_spent) + - ", aa unspent: " + Commanate(player->aa_unspent) + ")"; + " (aa spent: " + Commanate(player->profile.aa_spent) + + ", aa unspent: " + Commanate(player->profile.aa_unspent) + ")"; m_messages->addMessage(MT_Player, message); #if 0 @@ -749,11 +749,12 @@ int buffnumber; for (buffnumber=0;buffnumber<MAX_BUFFS;buffnumber++) { - if (player->buffs[buffnumber].spellid && player->buffs[buffnumber].duration) + if (player->profile.buffs[buffnumber].spellid && + player->profile.buffs[buffnumber].duration) { message.sprintf("You have buff %s duration left is %d in ticks.", - (const char*)spell_name(player->buffs[buffnumber].spellid), - player->buffs[buffnumber].duration); + (const char*)spell_name(player->profile.buffs[buffnumber].spellid), + player->profile.buffs[buffnumber].duration); m_messages->addMessage(MT_Player, message); } } Index: spawnshell.h =================================================================== RCS file: /cvsroot/seq/showeq/src/spawnshell.h,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- spawnshell.h 13 Sep 2005 15:23:14 -0000 1.22 +++ spawnshell.h 10 Dec 2005 23:27:15 -0000 1.23 @@ -116,6 +116,7 @@ void renameSpawn(const uint8_t* renameupdate); void illusionSpawn(const uint8_t* illusionupdate); void updateSpawnAppearance(const uint8_t* appearanceupdate); + void shroudSpawn(const uint8_t* spawnupdate, size_t, uint8_t); void updateNpcHP(const uint8_t* hpupdate); void spawnWearingUpdate(const uint8_t* wearing); void consMessage(const uint8_t* con, size_t, uint8_t); Index: player.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/player.cpp,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- player.cpp 18 Sep 2005 04:10:16 -0000 1.47 +++ player.cpp 10 Dec 2005 23:27:15 -0000 1.48 @@ -234,6 +234,85 @@ pSEQPrefs->setPrefInt("DefaultDeity", "Defaults", deity); } +void Player::loadProfile(const playerProfileStruct& player) +{ + setGender(player.gender); + setRace(player.race); + setClassVal(player.class_); + setLevel(player.level); + m_curHP = player.curHp; + + + // set the player level + setLevel(player.level); + + // Stats hanling + setUseDefaults(false); + setDeity(player.deity); + + // Due to the delayed decode, we must reset + // maxplayer on zone and accumulate all totals. + m_maxSTR += player.STR; + m_maxSTA += player.STA; + m_maxCHA += player.CHA; + m_maxDEX += player.DEX; + m_maxINT += player.INT; + m_maxAGI += player.AGI; + m_maxWIS += player.WIS; + + emit statChanged (LIST_STR, m_maxSTR, m_maxSTR); + emit statChanged (LIST_STA, m_maxSTA, m_maxSTA); + emit statChanged (LIST_CHA, m_maxCHA, m_maxCHA); + emit statChanged (LIST_DEX, m_maxDEX, m_maxDEX); + emit statChanged (LIST_INT, m_maxINT, m_maxINT); + emit statChanged (LIST_AGI, m_maxAGI, m_maxAGI); + emit statChanged (LIST_WIS, m_maxWIS, m_maxWIS); + + // Done with stats + m_validAttributes = true; + + // Mana + m_mana = player.MANA; + + m_maxMana = calcMaxMana( m_maxINT, m_maxWIS, + m_class, m_level + ) + m_plusMana; + + emit manaChanged(m_mana, m_maxMana); // need max mana + + // done with mana + m_validMana = true; + + seqDebug("Player::backfill(bind): Pos (%f/%f/%f) Heading: %f", + player.binds[0].x, player.binds[0].y, player.binds[0].z, + player.binds[0].heading); + + // Merge in our new skills... + for (int a = 0; a < MAX_KNOWN_SKILLS; a++) + { + m_playerSkills[a] = player.skills[a]; + + emit addSkill (a, m_playerSkills[a]); + } + + // copy in the spell book + memcpy (&m_spellBookSlots[0], &player.sSpellBook[0], sizeof(m_spellBookSlots)); + + m_currentAApts = player.aa_spent; + + // Buffs + int buffnumber; + const struct spellBuff *buff; + for (buffnumber=0;buffnumber<MAX_BUFFS;buffnumber++) + { + if (player.buffs[buffnumber].spellid && player.buffs[buffnumber].duration) + { + buff = &(player.buffs[buffnumber]); + emit buffLoad(buff); + } + } +} + void Player::player(const uint8_t* data) { const charProfileStruct* player = (const charProfileStruct*)data; @@ -241,15 +320,10 @@ if (m_name != player->name) emit newPlayer(); - + // fill in base Spawn class // set the characteristics that probably haven't changed. setNPC(SPAWN_SELF); - setGender(player->gender); - setRace(player->race); - setClassVal(player->class_); - setLevel(player->level); - m_curHP = player->curHp; // save the raw name setTypeflag(1); @@ -259,20 +333,13 @@ // if it's got a last name add it setLastName(player->lastName); - // set the player level - setLevel(player->level); + // Load the profile + loadProfile(player->profile); - // Stats hanling - setUseDefaults(false); - setDeity(player->deity); setGuildID(player->guildID); setGuildTag(m_guildMgr->guildIdToName(guildID())); emit guildChanged(); -#if 1 // ZBTEMP - seqDebug("charProfile(%f/%f/%f - %f)", - player->x, player->y, player->z, player->heading); -#endif setPos((int16_t)lrintf(player->x), (int16_t)lrintf(player->y), (int16_t)lrintf(player->z), @@ -282,9 +349,6 @@ setDeltas(0,0,0); seqDebug("Player::backfill(): Pos (%f/%f/%f) Heading: %f", player->x, player->y, player->z, player->heading); - seqDebug("Player::backfill(bind): Pos (%f/%f/%f) Heading: %f", - player->binds[0].x, player->binds[0].y, player->binds[0].z, - player->binds[9].heading); setHeading((int8_t)lrintf(player->heading), 0); m_headingDegrees = 360 - ((((int8_t)lrintf(player->heading)) * 360) >> 11); m_validPos = true; @@ -292,41 +356,6 @@ emit posChanged(x(), y(), z(), deltaX(), deltaY(), deltaZ(), m_headingDegrees); - // Due to the delayed decode, we must reset - // maxplayer on zone and accumulate all totals. - m_maxSTR += player->STR; - m_maxSTA += player->STA; - m_maxCHA += player->CHA; - m_maxDEX += player->DEX; - m_maxINT += player->INT; - m_maxAGI += player->AGI; - m_maxWIS += player->WIS; - - emit statChanged (LIST_STR, m_maxSTR, m_maxSTR); - emit statChanged (LIST_STA, m_maxSTA, m_maxSTA); - emit statChanged (LIST_CHA, m_maxCHA, m_maxCHA); - emit statChanged (LIST_DEX, m_maxDEX, m_maxDEX); - emit statChanged (LIST_INT, m_maxINT, m_maxINT); - emit statChanged (LIST_AGI, m_maxAGI, m_maxAGI); - emit statChanged (LIST_WIS, m_maxWIS, m_maxWIS); - - m_mana = player->MANA; - - m_maxMana = calcMaxMana( m_maxINT, m_maxWIS, - m_class, m_level - ) + m_plusMana; - - emit manaChanged(m_mana, m_maxMana); // need max mana - - - // Merge in our new skills... - for (int a = 0; a < MAX_KNOWN_SKILLS; a++) - { - m_playerSkills[a] = player->skills[a]; - - emit addSkill (a, m_playerSkills[a]); - } - // Merge in our new languages... for (int a = 0; a < MAX_KNOWN_LANGS; a++) { @@ -335,12 +364,7 @@ emit addLanguage (a, m_playerLanguages[a]); } - // copy in the spell book - memcpy (&m_spellBookSlots[0], &player->sSpellBook[0], sizeof(m_spellBookSlots)); - // Move - m_validAttributes = true; - m_validMana = true; m_validExp = true; // update the con table @@ -353,7 +377,6 @@ m_currentExp = player->exp; m_currentAltExp = player->expAA; - m_currentAApts = player->aa_spent; emit expChangedInt (m_currentExp, m_minExp, m_maxExp); emit expAltChangedInt(m_currentAltExp, 0, 15000000); @@ -366,22 +389,6 @@ updateLastChanged(); emit changeItem(this, tSpawnChangedALL); - - QDir tmp("/tmp/"); - tmp.rename(QString("bankfile.") + QString::number(getpid()), - QString("bankfile.") + player->name); - - //Added by Halcyon - int buffnumber; - const struct spellBuff *buff; - for (buffnumber=0;buffnumber<MAX_BUFFS;buffnumber++) - { - if (player->buffs[buffnumber].spellid && player->buffs[buffnumber].duration) - { - buff = &(player->buffs[buffnumber]); - emit buffLoad(buff); - } - } } #if 0 // ZBTEMP Index: interface.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/interface.cpp,v retrieving revision 1.72 retrieving revision 1.73 diff -u -d -r1.72 -r1.73 --- interface.cpp 28 Oct 2005 06:25:46 -0000 1.72 +++ interface.cpp 10 Dec 2005 23:27:14 -0000 1.73 @@ -1681,6 +1681,9 @@ m_packet->connect2("OP_ItemLinkResponse", SP_Zone, DIR_Server, "itemInfoStruct", SZC_None, m_itemDB, SLOT(itemInfo(const uint8_t*, size_t, uint8_t))); + m_packet->connect2("OP_Shroud", SP_Zone, DIR_Server, + "spawnShroudOther", SZC_None, m_itemDB, + SLOT(playerShroud(const uint8_t*, size_t, uint8_t))); } if (m_groupMgr != 0) @@ -2012,6 +2015,9 @@ m_packet->connect2("OP_Death", SP_Zone, DIR_Server, "newCorpseStruct", SZC_Match, m_spawnShell, SLOT(killSpawn(const uint8_t*))); + m_packet->connect2("OP_Shroud", SP_Zone, DIR_Server, + "spawnShroudSelf", SZC_None, + m_spawnShell, SLOT(shroudSpawn(const uint8_t*, size_t, uint8_t))); #if 0 // ZBTEMP connect(m_packet, SIGNAL(spawnWearingUpdate(const uint8_t*, size_t, uint8_t)), m_spawnShell, SLOT(spawnWearingUpdate(const uint8_t*))); Index: spawnshell.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/spawnshell.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- spawnshell.cpp 13 Sep 2005 15:23:13 -0000 1.43 +++ spawnshell.cpp 10 Dec 2005 23:27:15 -0000 1.44 @@ -807,6 +807,30 @@ } } +void SpawnShell::shroudSpawn(const uint8_t* data, size_t len, uint8_t dir) +{ + if (len == sizeof(spawnShroudOther)) + { + // Other person shrouding. newSpawn handled updates too. + spawnShroudOther* shroud = (spawnShroudOther*) data; + seqInfo("Shrouding %s (id=%d)", + shroud->spawn.name, shroud->spawn.spawnId); + + newSpawn(shroud->spawn); + } + else + { + // Shrouding yourself. + spawnShroudSelf* shroud = (spawnShroudSelf*) data; + + seqInfo("Shrouding %s (id=%d)", + shroud->spawn.name, shroud->spawn.spawnId); + + m_player->zoneBegin((const ServerZoneEntryStruct*) &shroud->spawn); + m_player->loadProfile(shroud->profile); + } +} + void SpawnShell::updateSpawnAppearance(const uint8_t* data) { const spawnAppearanceStruct* app = (const spawnAppearanceStruct*)data; Index: itemdb.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/itemdb.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- itemdb.cpp 13 Sep 2005 15:23:11 -0000 1.11 +++ itemdb.cpp 10 Dec 2005 23:27:15 -0000 1.12 @@ -1963,6 +1963,20 @@ fclose(lh); } +void EQItemDB::playerShroud(const uint8_t* data, size_t size, uint8_t dir) +{ + if (size != sizeof(spawnShroudOther)) + { + // Shrouding self has items on it. It's just a flat serialization + // like OP_ItemPlayerPacket + spawnShroudSelf* shroud = (spawnShroudSelf*) data; + + playerItem(&shroud->items, + size - (sizeof(spawnShroudOther) + sizeof(playerProfileStruct)), + dir); + } +} + void EQItemDB::itemInfo(const uint8_t* data, size_t size, uint8_t) { const itemInfoStruct* item = (const itemInfoStruct*)data; Index: everquest.h =================================================================== RCS file: /cvsroot/seq/showeq/src/everquest.h,v retrieving revision 1.86 retrieving revision 1.87 diff -u -d -r1.86 -r1.87 --- everquest.h 8 Dec 2005 05:56:34 -0000 1.86 +++ everquest.h 10 Dec 2005 23:27:14 -0000 1.87 @@ -582,14 +582,15 @@ }; /*0796*/ -/* -** Player Profile -** Length: 19592 Octets -** OpCode: CharProfileCode -*/ -struct charProfileStruct +/** + * Player Profile. Common part of charProfileStruct shared between + * shrouding and zoning profiles. + * + * NOTE: Offsets are kept in here relative to OP_PlayerProfile to ease in + * diagnosing changes in that struct. + */ +struct playerProfileStruct { -/*00000*/ uint32_t checksum; // /*00004*/ uint32_t gender; // Player Gender - 0 Male, 1 Female /*00008*/ uint32_t race; // Player race /*00012*/ uint32_t class_; // Player class @@ -655,6 +656,17 @@ /*07444*/ uint8_t unknown07444[5120]; /*12564*/ InlineItem potionBelt[MAX_POTIONS_IN_BELT]; // potion belt /*12852*/ uint8_t unknown12852[88]; +}; + +/* +** Player Profile +** Length: 19592 Octets +** OpCode: CharProfileCode +*/ +struct charProfileStruct +{ +/*00000*/ uint32_t checksum; // +/*00004*/ playerProfileStruct profile; // Profile /*12940*/ char name[64]; // Name of player /*13004*/ char lastName[32]; // Last name of player /*13036*/ int32_t guildID; // guildID @@ -1224,6 +1236,39 @@ /*0080*/ uint8_t unknown0082[88]; // ***Placeholder }; +/** + * Shroud spawn. For others shrouding, this has their spawnId and + * spawnStruct. + * + * Length: 586 + * OpCode: OP_Shroud + */ +struct spawnShroudOther +{ +/*0000*/ uint32_t spawnId; // Spawn Id of the shrouded player +/*0004*/ spawnStruct spawn; // Updated spawn struct for the player +/*0586*/ +}; + +/** + * Shroud yourself. For yourself shrouding, this has your spawnId, spawnStruct, + * bits of your charProfileStruct (no checksum, then charProfile up till + * but not including name), and an itemPlayerPacket for only items on the player + * and not the bank. + * + * Length: Variable + * OpCode: OP_Shroud + */ +struct spawnShroudSelf +{ +/*00000*/ uint32_t spawnId; // Spawn Id of you +/*00004*/ spawnStruct spawn; // Updated spawnStruct for you +/*00586*/ playerProfileStruct profile; // Character profile for shrouded char +/*13522*/ uint8_t items; // Items on the player +/*xxxxx*/ +}; + + /* ** ShowEQ Specific Structures |