|
From: <cn...@us...> - 2021-03-10 21:19:24
|
Revision: 1153
http://sourceforge.net/p/seq/svn/1153
Author: cn187
Date: 2021-03-10 21:19:21 +0000 (Wed, 10 Mar 2021)
Log Message:
-----------
Merge branch 'cn187_devel'
Modified Paths:
--------------
showeq/trunk/conf/seqdef.xml
showeq/trunk/conf/zoneopcodes.xml
showeq/trunk/src/eqstr.cpp
showeq/trunk/src/everquest.h
showeq/trunk/src/guild.cpp
showeq/trunk/src/guild.h
showeq/trunk/src/interface.cpp
showeq/trunk/src/interface.h
showeq/trunk/src/map.cpp
showeq/trunk/src/messageshell.cpp
showeq/trunk/src/player.cpp
showeq/trunk/src/s_everquest.h
showeq/trunk/src/spawn.cpp
showeq/trunk/src/spawn.h
showeq/trunk/src/spawnlistcommon.cpp
showeq/trunk/src/spawnshell.cpp
showeq/trunk/src/spawnshell.h
showeq/trunk/src/zonemgr.cpp
Modified: showeq/trunk/conf/seqdef.xml
===================================================================
--- showeq/trunk/conf/seqdef.xml 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/conf/seqdef.xml 2021-03-10 21:19:21 UTC (rev 1153)
@@ -2500,7 +2500,7 @@
" />
</property>
<property name="GuildsFile" >
- <string value="guilds2.dat" />
+ <string value="guilds3.dat" />
<comment>Location of file containing guild strings</comment>
</property>
<property name="GuildsDumpFile" >
Modified: showeq/trunk/conf/zoneopcodes.xml
===================================================================
--- showeq/trunk/conf/zoneopcodes.xml 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/conf/zoneopcodes.xml 2021-03-10 21:19:21 UTC (rev 1153)
@@ -78,7 +78,7 @@
<comment>SpawnAppearanceCode</comment>
<payload dir="both" typename="spawnAppearanceStruct" sizechecktype="match"/>
</opcode>
- <opcode id="ffff" name="OP_Stamina" updated="06/19/19">
+ <opcode id="5a12" name="OP_Stamina" updated="02/17/21">
<comment>Server updating on hunger/thirst</comment>
<payload dir="server" typename="staminaStruct" sizechecktype="match"/>
</opcode>
@@ -115,11 +115,11 @@
<comment>Spawns getting renamed after initial NewSpawn</comment>
<payload dir="server" typename="spawnRenameStruct" sizechecktype="match"/>
</opcode>
- <opcode id="ffff" name="OP_Illusion" updated="06/19/19">
+ <opcode id="1bb2" name="OP_Illusion" updated="02/17/21">
<comment>Spawn being illusioned (changing forms)</comment>
<payload dir="both" typename="spawnIllusionStruct" sizechecktype="match"/>
</opcode>
- <opcode id="ffff" name="OP_Shroud" updated="06/19/19">
+ <opcode id="2d7f" name="OP_Shroud" updated="02/17/21">
<comment>Server putting players into shroud form</comment>
<payload dir="server" typename="spawnShroudSelf" sizechecktype="none"/>
</opcode>
@@ -127,23 +127,23 @@
<comment>old ZoneChangeCode</comment>
<payload dir="both" typename="zoneChangeStruct" sizechecktype="match"/>
</opcode>
- <opcode id="ffff" name="OP_GroupInvite" updated="06/19/19">
+ <opcode id="60e6" name="OP_GroupInvite" updated="02/17/21">
<payload dir="both" typename="groupInviteStruct" sizechecktype="none"/>
<comment>You invite someone while ungrouped or get invited by someone ungrouped </comment>
</opcode>
- <opcode id="ffff" name="OP_GroupInvite2" updated="06/19/19">
+ <opcode id="291c" name="OP_GroupInvite2" updated="02/17/21">
<payload dir="both" typename="groupInviteStruct" sizechecktype="none"/>
<comment>You're inviting someone and you are grouped or get invited by a group</comment>
</opcode>
- <opcode id="ffff" name="OP_GroupCancelInvite" updated="06/19/19">
+ <opcode id="64c1" name="OP_GroupCancelInvite" updated="02/17/21">
<payload dir="both" typename="groupDeclineStruct" sizechecktype="match"/>
<comment>Declining to join a group</comment>
</opcode>
- <opcode id="ffff" name="OP_GroupFollow" updated="06/19/19">
+ <opcode id="2040" name="OP_GroupFollow" updated="02/17/21">
<payload dir="server" typename="groupFollowStruct" sizechecktype="match"/>
<comment>You join a group or player joins group</comment>
</opcode>
- <opcode id="ffff" name="OP_GroupFollow2" updated="06/19/19">
+ <opcode id="a699" name="OP_GroupFollow2" updated="02/17/21">
<payload dir="server" typename="groupFollowStruct" sizechecktype="match"/>
<comment>Player joins your group</comment>
</opcode>
@@ -151,19 +151,19 @@
<comment>Group updates</comment>
<payload dir="both" typename="uint8_t" sizechecktype="none"/>
</opcode>
- <opcode id="ffff" name="OP_GroupDisband" updated="06/19/19">
+ <opcode id="7ee5" name="OP_GroupDisband" updated="02/17/21">
<comment>You disband from group</comment>
<payload dir="server" typename="groupDisbandStruct" sizechecktype="match"/>
</opcode>
- <opcode id="ffff" name="OP_GroupDisband2" updated="06/19/19">
+ <opcode id="64eb" name="OP_GroupDisband2" updated="02/17/21">
<comment>Other disbands from group</comment>
<payload dir="server" typename="groupDisbandStruct" sizechecktype="match"/>
</opcode>
- <opcode id="ffff" name="OP_GroupLeader" updated="06/19/19">
+ <opcode id="7f60" name="OP_GroupLeader" updated="02/17/21">
<comment>Group leader change</comment>
<payload dir="server" typename="groupLeaderChangeStruct" sizechecktype="match"/>
</opcode>
- <opcode id="ffff" name="OP_Buff" updated="06/19/19">
+ <opcode id="11f1" name="OP_Buff" updated="02/17/21">
<comment>old BuffDropCode</comment>
<payload dir="both" typename="buffStruct" sizechecktype="match"/>
</opcode>
@@ -183,11 +183,11 @@
<comment>MemSpellCode</comment>
<payload dir="both" typename="memSpellStruct" sizechecktype="match"/>
</opcode>
- <opcode id="ffff" name="OP_InspectAnswer" updated="06/19/19">
+ <opcode id="133b" name="OP_InspectAnswer" updated="02/17/21">
<comment>InspectDataCode</comment>
<payload dir="both" typename="inspectDataStruct" sizechecktype="match"/>
</opcode>
- <opcode id="ffff" name="OP_Emote" updated="06/19/19">
+ <opcode id="63e0" name="OP_Emote" updated="02/17/21">
<comment>EmoteTextCode</comment>
<payload dir="both" typename="emoteTextStruct" sizechecktype="none"/>
</opcode>
@@ -207,19 +207,19 @@
<comment>Communicate textual info to client including hail responses etc</comment>
<payload dir="server" typename="specialMessageStruct" sizechecktype="none"/>
</opcode>
- <opcode id="ffff" name="OP_RandomReq" updated="06/19/19">
+ <opcode id="6732" name="OP_RandomReq" updated="02/17/21">
<comment>RandomReqCode</comment>
<payload dir="client" typename="randomReqStruct" sizechecktype="match"/>
</opcode>
- <opcode id="ffff" name="OP_RandomReply" updated="06/19/19">
+ <opcode id="4609" name="OP_RandomReply" updated="02/17/21">
<comment>RandomCode</comment>
<payload dir="server" typename="randomStruct" sizechecktype="match"/>
</opcode>
- <opcode id="ffff" name="OP_ConsentResponse" updated="06/19/19">
+ <opcode id="31a0" name="OP_ConsentResponse" updated="02/17/21">
<comment>Server replying with consent information after /consent</comment>
<payload dir="server" typename="consentResponseStruct" sizechecktype="match"/>
</opcode>
- <opcode id="ffff" name="OP_DenyResponse" updated="06/19/19">
+ <opcode id="4330" name="OP_DenyResponse" updated="02/17/21">
<comment>Server replying with deny information after /deny</comment>
<payload dir="server" typename="consentResponseStruct" sizechecktype="match"/>
</opcode>
@@ -228,15 +228,15 @@
<payload dir="server" typename="manaDecrementStruct" sizechecktype="match"/>
<payload dir="client" typename="uint8_t" sizechecktype="none"/>
</opcode>
- <opcode id="ffff" name="OP_BazaarSearchRequest" updated="06/19/19">
+ <opcode id="1e02" name="OP_BazaarSearchRequest" updated="02/17/21">
<comment>Bazaar search request </comment>
<payload dir="client" typename="bazaarSearchQueryStruct" sizechecktype="none"/>
</opcode>
- <opcode id="ffff" name="OP_BazaarSearchResponse" updated="06/19/19">
+ <opcode id="2a82" name="OP_BazaarSearchResponse" updated="02/17/21">
<comment>Bazaar search Response - Struct incorrect </comment>
<payload dir="server" typename="bazaarSearchResponseStruct" sizechecktype="modulus"/>
</opcode>
- <opcode id="ffff" name="OP_MoneyOnCorpse" updated="06/19/19">
+ <opcode id="4c14" name="OP_MoneyOnCorpse" updated="02/17/21">
<comment>MoneyOnCorpseCode</comment>
<payload dir="server" typename="moneyOnCorpseStruct" sizechecktype="match"/>
</opcode>
@@ -248,23 +248,23 @@
<comment>LevelUpUpdateCode</comment>
<payload dir="server" typename="levelUpUpdateStruct" sizechecktype="match"/>
</opcode>
- <opcode id="ffff" name="OP_DzSwitchInfo" updated="06/19/19">
+ <opcode id="2c1a" name="OP_DzSwitchInfo" updated="02/17/21">
<comment>Expedition compass etc</comment>
<payload dir="server" typename="dzSwitchInfo" sizechecktype="none"/>
</opcode>
- <opcode id="ffff" name="OP_DzInfo" updated="06/19/19">
+ <opcode id="550c" name="OP_DzInfo" updated="02/17/21">
<comment>Expedition Information</comment>
<payload dir="server" typename="dzInfo" sizechecktype="match"/>
</opcode>
- <opcode id="ffff" name="OP_EnvDamage" updated="06/19/19">
+ <opcode id="3164" name="OP_EnvDamage" updated="02/17/21">
<comment>Environmental Damage</comment>
<payload dir="client" typename="environmentDamageStruct" sizechecktype="match"/>
</opcode>
- <opcode id="ffff" name="OP_SetRunMode" updated="06/19/19">
+ <opcode id="014c" name="OP_SetRunMode" updated="02/17/21">
<comment>old cRunToggleCode</comment>
<payload dir="client" typename="cRunToggleStruct" sizechecktype="match"/>
</opcode>
- <opcode id="ffff" name="OP_Trader" updated="06/19/19">
+ <opcode id="6e84" name="OP_Trader" updated="02/17/21">
<comment>PC's turning trader on and off</comment>
<payload dir="server" typename="bazaarTraderRequest" sizechecktype="match"/>
</opcode>
@@ -535,6 +535,14 @@
<comment>Listing of all guilds. Can be triggered by /lfg search?</comment>
<payload dir="server" typename="uint8_t" sizechecktype="none"/>
</opcode>
+ <opcode id="6ec0" name="OP_GuildsInZoneList" updated="02/17/21">
+ <comment>Listing of guild names present in the current zone. Generally seen on zoning</comment>
+ <payload dir="server" typename="guildsInZoneListStruct" sizechecktype="none"/>
+ </opcode>
+ <opcode id="33ba" name="OP_NewGuildInZone" updated="02/17/21">
+ <comment>An additional guild name has appeared in the current zone. Seen when a guilded player enters the current zone</comment>
+ <payload dir="server" typename="newGuildInZoneStruct" sizechecktype="none"/>
+ </opcode>
<opcode id="ffff" name="OP_LFGGetMatchesRequest" updated="11/28/12">
<comment>LFG/LFP client request - 16 bytes</comment>
<payload dir="client" typename="uint8_t" sizechecktype="none"/>
Modified: showeq/trunk/src/eqstr.cpp
===================================================================
--- showeq/trunk/src/eqstr.cpp 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/src/eqstr.cpp 2021-03-10 21:19:21 UTC (rev 1153)
@@ -207,7 +207,7 @@
}
// replace template argument with subst string
- if (substFormatStringRes.isEmpty())
+ if (!substFormatStringRes.isEmpty())
formatString.replace(curPos, rxt.matchedLength(), substFormatStringRes);
else
curPos += rxt.matchedLength(); // if no replacement string, skip over
Modified: showeq/trunk/src/everquest.h
===================================================================
--- showeq/trunk/src/everquest.h 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/src/everquest.h 2021-03-10 21:19:21 UTC (rev 1153)
@@ -122,7 +122,7 @@
#define MAX_SPELLBOOK_SLOTS 800
#define MAX_GROUP_MEMBERS 6
#define MAX_BUFFS 42
-#define MAX_GUILDS 8192
+#define MAX_GUILDS 32768
#define MAX_AA 300
#define MAX_BANDOLIERS 20
#define MAX_POTIONS_IN_BELT 5
@@ -797,6 +797,7 @@
/*20210*/ uint8_t gm; // 0=no, 1=yes (guessing!)
/*20211*/ int8_t guildstatus; // 0=member, 1=officer, 2=guildleader
/*20212*/ uint8_t unknown20212[16]; // *** Placeholder
+/*20224*/ uint32_t guildServerID;
/*20228*/ uint32_t exp; // Current Experience
/*20232*/ uint8_t unknown20232[12]; // *** Placeholder
/*20244*/ uint8_t languages[MAX_KNOWN_LANGS]; // List of languages
@@ -1100,6 +1101,7 @@
/*0000*/ uint8_t holding;
/*0000*/ uint32_t deity;
/*0000*/ uint32_t guildID;
+/*0000*/ uint32_t guildServerID;
/*0000*/ uint32_t guildstatus; // 0=member, 1=officer, 2=leader, -1=not guilded
/*0000*/ uint8_t class_;
/*0000*/ uint8_t state; // stand state
@@ -1991,18 +1993,18 @@
/*
** Money Loot
-** Length: 20 Octets
+** Length: 24 Octets
** OpCode: MoneyOnCorpseCode
*/
struct moneyOnCorpseStruct
{
-/*0000*/ uint8_t unknown0000[4]; // ***Placeholder
-/*0004*/ uint32_t platinum; // Platinum Pieces
-/*0008*/ uint32_t gold; // Gold Pieces
-/*0012*/ uint32_t silver; // Silver Pieces
-/*0016*/ uint32_t copper; // Copper Pieces
-/*0020*/
+/*0000*/ uint8_t unknown0000[8]; // ***Placeholder
+/*0008*/ uint32_t platinum; // Platinum Pieces
+/*0012*/ uint32_t gold; // Gold Pieces
+/*0016*/ uint32_t silver; // Silver Pieces
+/*0020*/ uint32_t copper; // Copper Pieces
+/*0024*/
};
/*
@@ -2506,11 +2508,22 @@
struct newGuildInZoneStruct
{
-/*0000*/ uint8_t unknown0000[8]; // ***Placeholder
-/*0008*/ char guildname[56]; // Guildname
-/*0064*/
+/*0000*/ uint32_t guildId; // Guild ID
+/*0004*/ uint32_t serverID; // ***Placeholder
+/*0008*/ char guildname[0]; // Guild name, null terminated
+/*xxxx*/
};
+struct guildsInZoneListStruct
+{
+/*0000*/ uint32_t name_len; // length of player name
+/*0004*/ char name[16]; // player name of length name_len,
+ // no null terminator, max 16
+/*xxxx*/ uint32_t num_guilds; // number of guild names in this struct
+/*xxxx*/ newGuildInZoneStruct guilds[0];
+/*xxxx*/
+};
+
struct moneyUpdateStruct
{
/*0000*/ uint32_t spawnid; // ***Placeholder
@@ -2615,14 +2628,14 @@
struct buffStruct
{
/*0000*/ uint32_t spawnid; //spawn id
-/*0004*/ uint8_t unknown0004[5];
-/*0009*/ int8_t level; // Level of person who cast buff
-/*0010*/ uint8_t unknown010[6];
-/*0016*/ uint32_t spellid; // spellid
-/*0020*/ uint32_t duration; // Time remaining in ticks
-/*0024*/ int32_t unknown0024; // Buff length in ticks
-/*0028*/ uint8_t unknown028[84];
-/*0112*/ uint32_t spellslot; // spellslot
+/*0004*/ uint8_t unknown0004[64];
+/*0068*/ uint32_t spellid; // spellid
+/*0072*/ uint32_t duration; // Time remaining in ticks
+/*0076*/ int32_t unknown0024; // Buff length in ticks
+/*0080*/ uint8_t unknown0080[25];
+/*0105*/ int8_t level; // Level of person who cast buff
+/*0106*/ uint8_t unknown0106[6];
+/*0112*/ uint32_t spellslot; // buff slot in buff window
/*0116*/ uint32_t changetype; // 1=buff fading,2=buff duration
/*0120*/
};
Modified: showeq/trunk/src/guild.cpp
===================================================================
--- showeq/trunk/src/guild.cpp 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/src/guild.cpp 2021-03-10 21:19:21 UTC (rev 1153)
@@ -47,21 +47,102 @@
{
}
-QString GuildMgr::guildIdToName(uint16_t guildID)
+QString GuildMgr::guildIdToName(uint16_t guildID, uint16_t guildServerID)
{
- if (guildID >= m_guildMap.size())
- return "";
- return m_guildMap[guildID];
+ uint32_t key = guildServerID << 16 | guildID;
+ //unguilded PCs have a guild ID of 0
+ if (!guildID || !guildServerID | !m_guildList.count(key))
+ return "";
+ return m_guildList[key];
}
-void GuildMgr::worldGuildList(const uint8_t* data, size_t len)
+
+void GuildMgr::newGuildInZone(const uint8_t* data, size_t len)
{
- writeGuildList(data, len);
- readGuildList();
+ NetStream netStream(data, len);
+ QString guildName;
+ uint32_t size = 0; // to keep track of how much we're reading from the packet
+ uint32_t guildId = 0;
+ uint32_t guildServerId = 0;
+
+ guildId = netStream.readUInt32NC();
+ size += 4;
+
+ guildServerId = netStream.readUInt32NC();
+ size += 4;
+
+ uint32_t key = guildServerId << 16 | guildId;
+
+ guildName = netStream.readText();
+ if (guildName.length() && !m_guildList.count(key))
+ {
+ m_guildList[key] = guildName;
+ writeGuildList();
+ emit guildTagUpdated(guildId);
+ }
+ size += guildName.length() + 1; // include null in count
+
+ if (size != len)
+ seqWarn("newGuildInZone packet is not the expected length: %u != %u", size, len);
}
-void GuildMgr::writeGuildList(const uint8_t* data, size_t len)
+void GuildMgr::guildsInZoneList(const uint8_t* data, size_t len)
{
+ NetStream netStream(data, len);
+ QString guildName;
+ QString emptyName = "";
+ uint32_t size = 0; // to keep track of how much we're reading from the packet
+ uint32_t guildId = 0;
+ uint32_t guildServerId = 0;
+ uint32_t numGuilds = 0;
+
+ uint32_t nameLen = netStream.readUInt32NC();
+ size += 4;
+
+ // skip the player name to get to the guilds
+ netStream.skipBytes(nameLen);
+ size += nameLen;
+
+ numGuilds = netStream.readUInt32NC();
+ size += 4;
+
+ bool need_save = false;
+
+ while(!netStream.end())
+ {
+ guildId = netStream.readUInt32NC();
+ size += 4;
+
+ guildServerId = netStream.readUInt32NC();
+ size += 4;
+
+ uint32_t key = guildServerId << 16 | guildId;
+
+ guildName = netStream.readText();
+ if (guildName.length() && !m_guildList.count(key))
+ {
+ m_guildList[key] = guildName;
+ need_save = true;
+ emit guildTagUpdated(guildId);
+ }
+
+ size += guildName.length() + 1; // include null in count
+
+ if (size >= len)
+ break;
+ }
+
+ if (size != len)
+ seqWarn("guildsInZoneList packet is not the expected length: %u != %u", size, len);
+
+ if (need_save)
+ writeGuildList();
+
+}
+
+
+void GuildMgr::writeGuildList()
+{
QFile guildsfile(guildsFileName);
if (guildsfile.exists()) {
@@ -76,58 +157,16 @@
seqWarn("GuildMgr: Could not open %s for writing, unable to replace with server data!",
guildsFileName.toLatin1().data());
- QDataStream guildDataStream(&guildsfile);
+ QTextStream guildDataStream(&guildsfile);
- NetStream netStream(data,len);
- QString guildName;
- QString emptyName = "";
- uint32_t size = 0; // to keep track of how much we're reading from the packet
- uint32_t guildId = 0;
-
- for (guildId = 0; guildId < 20000; guildId++)
- m_guildList[guildId] = emptyName;
- guildId = 0;
-
- /*
- 0x48 in the packet starts the serialized list. See guildListStruct
- and worldGuildListStruct in everquest.h
- */
-
- // skip to the first guild in the list
- netStream.skipBytes(0x44);
- size += 0x44;
-
- while(!netStream.end())
+ for (auto itr = m_guildList.begin(); itr != m_guildList.end(); ++itr)
{
- guildId = netStream.readUInt32NC();
- size += 4; // four bytes for the guild ID
- netStream.skipBytes(4);
- size += 4; // four bytes added 11/16/2016
- guildName = netStream.readText();
-
- if(guildName.length())
- {
- m_guildList[guildId] = guildName;
-
- // add guild name length, plus one for the null character
- size += guildName.length() + 1;
- }
-
- if(size + 1 == len)
- break; // the end
+ if (itr->first == 0)
+ continue;
+ QString line = QString::number(itr->first) + "|" + itr->second.toLatin1();
+ guildDataStream << line.trimmed() << "\n";
}
- std::map<uint32_t, QString>::iterator it;
-
- for(it = m_guildList.begin(); it != m_guildList.end(); it++)
- {
- char szGuildName[64] = {0};
-
- strcpy(szGuildName, it->second.toLatin1().data());
- //seqDebug("GuildMgr::writeGuildList - add guild '%s' (%d)", szGuildName, it->first);
- guildDataStream.writeRawData(szGuildName, sizeof(szGuildName));
- }
-
guildsfile.close();
seqInfo("GuildMgr: New guildsfile written");
}
@@ -135,17 +174,23 @@
void GuildMgr::readGuildList()
{
QFile guildsfile(guildsFileName);
+ m_guildList.clear();
- m_guildMap.clear();
if (guildsfile.open(QIODevice::ReadOnly))
{
while (!guildsfile.atEnd())
{
- char szGuildName[64] = {0};
-
- guildsfile.read(szGuildName, sizeof(szGuildName));
- //seqDebug("GuildMgr::readGuildList - read guild '%s'", szGuildName);
- m_guildMap.push_back(QString::fromUtf8(szGuildName));
+ QByteArray line = guildsfile.readLine();
+ QList<QByteArray> line_parts = line.split('|');
+ if (line_parts.size() != 2)
+ {
+ seqWarn("GuildMgr::readGuildList - skipping malformed line");
+ continue;
+ }
+ uint32_t key = line_parts.at(0).toULong();
+ QString guildName = line_parts.at(1).trimmed();
+ m_guildList[key] = guildName;
+ emit guildTagUpdated(key & 0x0000ffff);
}
guildsfile.close();
@@ -174,10 +219,11 @@
return;
}
- for (unsigned int i =0 ; i < m_guildMap.size(); i++)
+ for (auto itr = m_guildList.begin(); itr != m_guildList.end(); ++itr)
{
- if (!m_guildMap[i].isNull())
- guildtext << i << "\t" << m_guildMap[i] << endl;
+ if (itr->first == 0)
+ continue;
+ guildtext << itr->first << "\t" << itr->second << endl;
}
guildsfile.close();
@@ -188,10 +234,10 @@
void GuildMgr::listGuildInfo()
{
- for (unsigned int i = 0; i < m_guildMap.size(); i++)
+ for (auto itr = m_guildList.begin(); itr != m_guildList.end(); ++itr)
{
- if (!m_guildMap[i].isNull())
- seqInfo("%d\t%s", i, m_guildMap[i].toAscii().data());
+ if (!itr->second.isNull())
+ seqInfo("%d\t%s", itr->first, itr->second.toAscii().data());
}
}
Modified: showeq/trunk/src/guild.h
===================================================================
--- showeq/trunk/src/guild.h 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/src/guild.h 2021-03-10 21:19:21 UTC (rev 1153)
@@ -47,19 +47,21 @@
~GuildMgr();
- QString guildIdToName(uint16_t);
+ QString guildIdToName(uint16_t, uint16_t);
public slots:
- void worldGuildList(const uint8_t*, size_t);
+ void newGuildInZone(const uint8_t* data, size_t len);
+ void guildsInZoneList(const uint8_t * data, size_t len);
void readGuildList();
void guildList2text(QString);
void listGuildInfo();
+ void writeGuildList();
+ signals:
+ void guildTagUpdated(uint32_t);
+
private:
- std::vector<QString> m_guildMap;
std::map<uint32_t, QString> m_guildList;
-
- void writeGuildList(const uint8_t*, size_t);
QString guildsFileName;
Modified: showeq/trunk/src/interface.cpp
===================================================================
--- showeq/trunk/src/interface.cpp 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/src/interface.cpp 2021-03-10 21:19:21 UTC (rev 1153)
@@ -71,6 +71,7 @@
#include <unistd.h>
#include <cstdlib>
#include <cstdio>
+#include <ifaddrs.h>
#include <QFont>
#include <QApplication>
@@ -145,7 +146,8 @@
m_combatWindow(0),
m_netDiag(0),
m_messageFilterDialog(0),
- m_guildListWindow(0)
+ m_guildListWindow(0),
+ m_deviceList(enumerateDevices())
{
setObjectName(name);
setWindowFlags(Qt::Window);
@@ -221,10 +223,23 @@
fileInfo2 = m_dataLocationMgr->findExistingFile(".", fileName2);
+ QString net_device = pSEQPrefs->getPrefString("Device", section, "eth0");
+ if (!m_deviceList.contains(net_device))
+ {
+ QString selected = promptForNetDevice();
+
+ if (!selected.isEmpty())
+ {
+ // set it as the device to monitor next session
+ pSEQPrefs->setPrefString("Device", "Network", selected);
+ net_device = selected;
+ }
+ }
+
m_packet = new EQPacket(fileInfo.absoluteFilePath(),
fileInfo2.absoluteFilePath(),
pSEQPrefs->getPrefInt("ArqSeqGiveUp", section, 512),
- pSEQPrefs->getPrefString("Device", section, "eth0"),
+ net_device,
pSEQPrefs->getPrefString("IP", section,
AUTOMATIC_CLIENT_IP),
pSEQPrefs->getPrefString("MAC", section, "0"),
@@ -525,6 +540,7 @@
pFileMenu->addAction("Sa&ve Map", m_mapMgr, SLOT(saveMap()), Qt::Key_F2);
pFileMenu->addAction("Save SOE Map", m_mapMgr, SLOT(saveSOEMap()));
pFileMenu->addAction("Reload Guilds File", m_guildmgr, SLOT(readGuildList()));
+ pFileMenu->addAction("Save Guilds File", m_guildmgr, SLOT(writeGuildList()));
pFileMenu->addAction("Add Spawn Category", this, SLOT(addCategory()),
Qt::ALT+Qt::Key_C);
pFileMenu->addAction("Rebuild SpawnList", this, SLOT(rebuildSpawnList()),
@@ -2010,13 +2026,24 @@
if (m_guildmgr)
{
+ /*
m_packet->connect2("OP_GuildList", SP_World, DIR_Server,
"worldGuildListStruct", SZC_None,
m_guildmgr,
SLOT(worldGuildList(const uint8_t*, size_t)));
+ */
+ m_packet->connect2("OP_GuildsInZoneList", SP_Zone, DIR_Server,
+ "guildsInZoneListStruct", SZC_None, m_guildmgr,
+ SLOT(guildsInZoneList(const uint8_t*, size_t)));
+
+ m_packet->connect2("OP_NewGuildInZone", SP_Zone, DIR_Server,
+ "newGuildInZoneStruct", SZC_None, m_guildmgr,
+ SLOT(newGuildInZone(const uint8_t*, size_t)));
+
connect(this, SIGNAL(guildList2text(QString)),
m_guildmgr, SLOT(guildList2text(QString)));
+
}
if (m_guildShell)
@@ -2579,6 +2606,9 @@
if (m_guildShell != 0)
delete m_guildShell;
+ if (m_guildmgr != 0)
+ delete m_guildmgr;
+
if (m_zoneMgr != 0)
delete m_zoneMgr;
@@ -5134,23 +5164,68 @@
}
}
-void EQInterface::set_net_device()
+QStringList EQInterface::enumerateDevices()
{
- bool ok = false;
- QString dev =
- QInputDialog::getText(this, "ShowEQ - Device",
+ struct ifaddrs *ifaddr, *ifa;
+ int n;
+ QStringList devices;
+
+ if (getifaddrs(&ifaddr) == -1)
+ {
+ seqWarn("Could not enumerate network devices");
+ return QStringList();
+ }
+
+ for (ifa = ifaddr, n = 0; ifa != NULL; ifa = ifa->ifa_next, n++)
+ {
+ if (ifa->ifa_addr == NULL)
+ continue;
+
+ if (ifa->ifa_addr->sa_family == AF_INET)
+ devices.append(ifa->ifa_name);
+ }
+
+ freeifaddrs(ifaddr);
+
+ return devices;
+}
+
+QString EQInterface::promptForNetDevice()
+{
+ m_deviceList = enumerateDevices();
+
+ int current = 0;
+ if (m_packet)
+ current = m_deviceList.indexOf(m_packet->device());
+
+ bool ok = false;
+ QString selected = QInputDialog::getItem(this, "ShowEQ - Device",
"Enter the device to sniff for EQ Packets:",
- QLineEdit::Normal, m_packet->device(),
- &ok);
+ m_deviceList, current, true, &ok);
- if (ok)
- {
- // start monitoring the device
- m_packet->monitorDevice(dev);
+ if (ok)
+ return selected;
+ else
+ return QString();
+}
- // set it as the device to monitor next session
- pSEQPrefs->setPrefString("Device", "Network", m_packet->device());
- }
+
+void EQInterface::set_net_device()
+{
+
+ QString selected = promptForNetDevice();
+
+ if (!selected.isEmpty())
+ {
+ if (m_packet)
+ {
+ // start monitoring the device
+ m_packet->monitorDevice(selected);
+ }
+
+ // set it as the device to monitor next session
+ pSEQPrefs->setPrefString("Device", "Network", selected);
+ }
}
void EQInterface::set_net_arq_giveup(int giveup)
Modified: showeq/trunk/src/interface.h
===================================================================
--- showeq/trunk/src/interface.h 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/src/interface.h 2021-03-10 21:19:21 UTC (rev 1153)
@@ -341,6 +341,8 @@
void insertWindowMenu(SEQWindow* window);
void removeWindowMenu(SEQWindow* window);
void setDockEnabled(QDockWidget* dw, bool enable);
+ QStringList enumerateDevices();
+ QString promptForNetDevice();
public:
Player* m_player;
@@ -415,6 +417,9 @@
MessageFilterDialog* m_messageFilterDialog;
GuildListWindow* m_guildListWindow;
+ QStringList m_deviceList;
+
+
QLabel* m_stsbarSpawns;
QLabel* m_stsbarStatus;
QLabel* m_stsbarZone;
Modified: showeq/trunk/src/map.cpp
===================================================================
--- showeq/trunk/src/map.cpp 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/src/map.cpp 2021-03-10 21:19:21 UTC (rev 1153)
@@ -4258,18 +4258,15 @@
if (spawn)
{
QString guild;
- if (spawn->guildID() < MAX_GUILDS)
- {
- if (!spawn->guildTag().isEmpty())
+ if (!spawn->guildTag().isEmpty())
guild.sprintf("<%s>", spawn->guildTag().toAscii().data());
- else
+ else if (spawn->guildID())
guild = QString::number(spawn->guildID());
- }
else
guild = " ";
QString hp;
-
+
if (spawn->HP() <= 0)
hp = "<= 0";
else
Modified: showeq/trunk/src/messageshell.cpp
===================================================================
--- showeq/trunk/src/messageshell.cpp 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/src/messageshell.cpp 2021-03-10 21:19:21 UTC (rev 1153)
@@ -253,20 +253,21 @@
target = m_spawnShell->findID(tSpawn, smsg->target);
// calculate the message position
- const char* message = smsg->source + strlen(smsg->source) + 1
- + sizeof(smsg->unknown0xxx);
-
- if (target)
- m_messages->addMessage(chatColor2MessageType(smsg->messageColor),
- QString("Special: '%1' -> '%2' - %3")
- .arg(smsg->source)
- .arg(target->name())
- .arg(message));
- else
- m_messages->addMessage(chatColor2MessageType(smsg->messageColor),
- QString("Special: '%1' - %2")
- .arg(smsg->source)
- .arg(message));
+ // const char* message = smsg->source + strlen(smsg->source) + 1
+ // + sizeof(smsg->unknown0xxx);
+ // NOTE: gcc 8 (and maybe others) over-optimizes the above strlen call on the
+ // variable-sized source array (possibly because it isn't the last member
+ // of the struct), and as a result, strlen always returns 0 unless compiler
+ // optimizations are disabled. So we work around this by creating a QString
+ // and using its size
+ const char* message = smsg->source + QString(smsg->source).length() + 1
+ + sizeof(smsg->unknown0xxx);
+
+ if (target) m_messages->addMessage(chatColor2MessageType(smsg->messageColor),
+ QString("Special: '%1' -> '%2' - %3") .arg(smsg->source)
+ .arg(target->name()) .arg(message)); else
+ m_messages->addMessage(chatColor2MessageType(smsg->messageColor),
+ QString("Special: '%1' - %2") .arg(smsg->source) .arg(message));
}
void MessageShell::guildMOTD(const uint8_t* data, size_t, uint8_t dir)
Modified: showeq/trunk/src/player.cpp
===================================================================
--- showeq/trunk/src/player.cpp 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/src/player.cpp 2021-03-10 21:19:21 UTC (rev 1153)
@@ -375,7 +375,8 @@
// Guild
setGuildID(player->guildID);
- setGuildTag(m_guildMgr->guildIdToName(guildID()));
+ setGuildServerID(player->guildServerID);
+ setGuildTag(m_guildMgr->guildIdToName(guildID(), guildServerID()));
emit guildChanged();
// Position
Modified: showeq/trunk/src/s_everquest.h
===================================================================
--- showeq/trunk/src/s_everquest.h 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/src/s_everquest.h 2021-03-10 21:19:21 UTC (rev 1153)
@@ -110,6 +110,7 @@
AddStruct(attack1Struct);
AddStruct(attack2Struct);
AddStruct(newGuildInZoneStruct);
+AddStruct(guildsInZoneListStruct);
AddStruct(moneyUpdateStruct);
AddStruct(memorizeSlotStruct);
AddStruct(cRunToggleStruct);
Modified: showeq/trunk/src/spawn.cpp
===================================================================
--- showeq/trunk/src/spawn.cpp 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/src/spawn.cpp 2021-03-10 21:19:21 UTC (rev 1153)
@@ -399,6 +399,7 @@
setHP(s->HP());
setMaxHP(s->maxHP());
setGuildID(s->guildID());
+ setGuildServerID(s->guildServerID());
setLevel(s->level());
for (int i = 0; i <= tLastCoreWearSlot; i++)
setEquipment(i, s->equipment(i));
@@ -433,6 +434,7 @@
setHP(s->curHp);
setMaxHP(100); //the client sets this to 100
setGuildID(s->guildID);
+ setGuildServerID(s->guildServerID);
setLevel(s->level);
for (int i = 0; i <= tLastCoreWearSlot; i++)
setEquipment(i, s->equipment[i]);
@@ -541,8 +543,11 @@
// set guildID
if (s->NPC == SPAWN_PLAYER || s->NPC == SPAWN_SELF)
+ {
setGuildID(s->guildID);
- else
+ setGuildServerID(s->guildServerID);
+ }
+ else
setGuildID(0xffff);
}
Modified: showeq/trunk/src/spawn.h
===================================================================
--- showeq/trunk/src/spawn.h 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/src/spawn.h 2021-03-10 21:19:21 UTC (rev 1153)
@@ -239,6 +239,7 @@
int32_t HP() const { return m_curHP; }
int32_t maxHP() const { return m_maxHP; }
uint16_t guildID() const { return m_guildID; }
+ uint16_t guildServerID() const { return m_guildServerID; }
QString guildTag() const { return m_guildTag; }
uint16_t petOwnerID() const { return m_petOwnerID; }
uint8_t light() const { return m_light; }
@@ -338,6 +339,7 @@
void setHP(int32_t HP) { m_curHP = HP; }
void setMaxHP(int32_t maxHP) { m_maxHP = maxHP; }
void setGuildID(uint16_t GuildID) { m_guildID = GuildID; }
+ void setGuildServerID(uint16_t GuildServerID) { m_guildServerID = GuildServerID; }
void setGuildTag(QString GuildTag) { m_guildTag = GuildTag; }
void setLevel(int level) { m_level = level; }
void setEquipment(uint8_t wearSlot, EquipStruct item)
@@ -378,6 +380,7 @@
int32_t m_curHP;
int32_t m_maxHP;
uint16_t m_guildID;
+ uint16_t m_guildServerID;
uint16_t m_deity;
int16_t m_deityTeam;
EquipStruct m_equipment[tNumWearSlots];
Modified: showeq/trunk/src/spawnlistcommon.cpp
===================================================================
--- showeq/trunk/src/spawnlistcommon.cpp 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/src/spawnlistcommon.cpp 2021-03-10 21:19:21 UTC (rev 1153)
@@ -209,13 +209,12 @@
{
setText(tSpawnColDeity, spawn->deityName());
setText(tSpawnColBodyType, spawn->typeString());
- if (spawn->guildID() < MAX_GUILDS)
- {
- if(!spawn->guildTag().isEmpty())
+ if (!spawn->guildTag().isEmpty())
setText(tSpawnColGuildID, spawn->guildTag());
- else
+ else if (spawn->guildID())
setText(tSpawnColGuildID, QString::number(spawn->guildID()));
- }
+ else
+ setText(tSpawnColGuildID, " ");
}
}
else if (changeType == tSpawnChangedALL)
Modified: showeq/trunk/src/spawnshell.cpp
===================================================================
--- showeq/trunk/src/spawnshell.cpp 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/src/spawnshell.cpp 2021-03-10 21:19:21 UTC (rev 1153)
@@ -142,6 +142,10 @@
connect(m_player, SIGNAL(changedID(uint16_t)),
this, SLOT(playerChangedID(uint16_t)));
+ // connect to guildmgr to receive notifications of guild tag updates
+ connect(m_guildMgr, SIGNAL(guildTagUpdated(uint32_t)),
+ this, SLOT(updateGuildTag(uint32_t)));
+
// restore the spawn list if necessary
if (showeq_params->restoreSpawns)
restoreSpawns();
@@ -248,6 +252,47 @@
return closest;
}
+void SpawnShell::updateGuildTag(uint32_t guildId)
+{
+ ItemIterator it(m_spawns);
+ Spawn* spawn;
+
+ while (it.hasNext())
+ {
+ it.next();
+
+ spawn = (Spawn*)it.value();
+ if (!spawn)
+ break;
+
+ if (guildId == spawn->guildID())
+ {
+ spawn->setGuildTag(m_guildMgr->guildIdToName(spawn->guildID(), spawn->guildServerID()));
+ spawn->updateLastChanged();
+ emit changeItem(spawn, tSpawnChangedALL);
+ }
+ }
+
+ ItemIterator pl(m_players);
+
+ while (pl.hasNext())
+ {
+ pl.next();
+
+ spawn = (Spawn*)pl.value();
+ if (!spawn)
+ break;
+
+ if (guildId == spawn->guildID())
+ {
+ spawn->setGuildTag(m_guildMgr->guildIdToName(spawn->guildID(), spawn->guildServerID()));
+ spawn->updateLastChanged();
+ emit changeItem(spawn, tSpawnChangedALL);
+ }
+ }
+}
+
+
Spawn* SpawnShell::findSpawnByName(const QString& name)
{
ItemIterator it(m_spawns);
@@ -686,7 +731,7 @@
spawn->holding = netStream.readUInt8();
spawn->deity = netStream.readUInt32NC();
spawn->guildID = netStream.readUInt32NC();
- netStream.skipBytes(4); /* new data in 11/16/2016 patch */
+ spawn->guildServerID = netStream.readUInt32NC();
/* spawn->guildstatus = netStream.readUInt32NC(); disappeared 11/14/2018 */
spawn->guildstatus = 0;
spawn->class_ = netStream.readUInt32NC();
@@ -732,20 +777,22 @@
netStream.skipBytes(36);
for(i = 0; i < 9; i++)
{
+ spawn->equipment[i].itemId = netStream.readUInt32NC();
spawn->equipment[i].equip3 = netStream.readUInt32NC();
- spawn->equipment[i].itemId = netStream.readUInt32NC();
spawn->equipment[i].equip2 = netStream.readUInt32NC();
spawn->equipment[i].equip1 = netStream.readUInt32NC();
spawn->equipment[i].equip0 = netStream.readUInt32NC();
}
} else {
- netStream.skipBytes(28);
+ netStream.skipBytes(20);
spawn->equipment[7].itemId = netStream.readUInt32NC();
+ spawn->equipment[7].equip3 = netStream.readUInt32NC();
spawn->equipment[7].equip2 = netStream.readUInt32NC();
spawn->equipment[7].equip1 = netStream.readUInt32NC();
spawn->equipment[7].equip0 = netStream.readUInt32NC();
// secondary
spawn->equipment[8].itemId = netStream.readUInt32NC();
+ spawn->equipment[8].equip3 = netStream.readUInt32NC();
spawn->equipment[8].equip2 = netStream.readUInt32NC();
spawn->equipment[8].equip1 = netStream.readUInt32NC();
spawn->equipment[8].equip0 = netStream.readUInt32NC();
@@ -879,10 +926,8 @@
updateRuntimeFilterFlags(spawn);
item->updateLastChanged();
- if (spawn->guildID() < MAX_GUILDS)
- spawn->setGuildTag(m_guildMgr->guildIdToName(spawn->guildID()));
- else
- spawn->setGuildTag("");
+ spawn->setGuildTag(m_guildMgr->guildIdToName(spawn->guildID(), spawn->guildServerID()));
+
if (!showeq_params->fast_machine)
item->setDistanceToPlayer(m_player->calcDist2DInt(*item));
else
@@ -898,10 +943,8 @@
updateRuntimeFilterFlags(spawn);
m_spawns.insert(s.spawnId, item);
- if (spawn->guildID() < MAX_GUILDS)
- spawn->setGuildTag(m_guildMgr->guildIdToName(spawn->guildID()));
- else
- spawn->setGuildTag("");
+ spawn->setGuildTag(m_guildMgr->guildIdToName(spawn->guildID(), spawn->guildServerID()));
+
if (!showeq_params->fast_machine)
item->setDistanceToPlayer(m_player->calcDist2DInt(*item));
else
@@ -1577,14 +1620,7 @@
updateRuntimeFilterFlags(corpse);
m_spawns.insert(corpse->id(), corpse);
- if (corpse->guildID() < MAX_GUILDS)
- {
- corpse->setGuildTag(m_guildMgr->guildIdToName(corpse->guildID()));
- }
- else
- {
- corpse->setGuildTag("");
- }
+ corpse->setGuildTag(m_guildMgr->guildIdToName(corpse->guildID(), corpse->guildServerID()));
emit addItem(corpse);
Modified: showeq/trunk/src/spawnshell.h
===================================================================
--- showeq/trunk/src/spawnshell.h 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/src/spawnshell.h 2021-03-10 21:19:21 UTC (rev 1153)
@@ -150,6 +150,8 @@
void saveSpawns(void);
void restoreSpawns(void);
+ void updateGuildTag(uint32_t guildId);
+
protected:
void refilterSpawns(spawnItemType type);
void refilterSpawnsRuntime(spawnItemType type);
Modified: showeq/trunk/src/zonemgr.cpp
===================================================================
--- showeq/trunk/src/zonemgr.cpp 2021-02-21 23:07:03 UTC (rev 1152)
+++ showeq/trunk/src/zonemgr.cpp 2021-03-10 21:19:21 UTC (rev 1153)
@@ -475,9 +475,10 @@
player->standState = netStream.readUInt16();
player->anon = netStream.readUInt16();
player->guildID = netStream.readUInt32NC();
+ player->guildServerID = netStream.readUInt32NC();
// Unknown
- netStream.skipBytes(14);
+ netStream.skipBytes(10);
player->platinum_bank = netStream.readUInt32NC();
player->gold_bank = netStream.readUInt32NC();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|