mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-02 15:53:51 +00:00
refactor: add Packet::hasData(), replace 52 position checks and 14 more Lua guards
Add Packet::hasData() for 'has remaining data' checks, replacing 52 verbose getReadPos()<getSize() comparisons across 3 files. Also replace 14 more standalone Lua return patterns with luaReturnNil/Zero helpers.
This commit is contained in:
parent
4c26b1a8ae
commit
12355316b3
5 changed files with 67 additions and 66 deletions
|
|
@ -46,6 +46,7 @@ public:
|
||||||
return getRemainingSize() >= guidBytes;
|
return getRemainingSize() >= guidBytes;
|
||||||
}
|
}
|
||||||
void setReadPos(size_t pos) { readPos = pos; }
|
void setReadPos(size_t pos) { readPos = pos; }
|
||||||
|
bool hasData() const { return readPos < data.size(); }
|
||||||
void skipAll() { readPos = data.size(); }
|
void skipAll() { readPos = data.size(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -1182,7 +1182,7 @@ static int lua_GetAddOnInfo(lua_State* L) {
|
||||||
lua_getfield(L, LUA_REGISTRYINDEX, "wowee_addon_info");
|
lua_getfield(L, LUA_REGISTRYINDEX, "wowee_addon_info");
|
||||||
if (!lua_istable(L, -1)) {
|
if (!lua_istable(L, -1)) {
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
lua_pushnil(L); return 1;
|
return luaReturnNil(L);
|
||||||
}
|
}
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
@ -1570,11 +1570,11 @@ static int lua_GetSpellTabInfo(lua_State* L) {
|
||||||
auto* gh = getGameHandler(L);
|
auto* gh = getGameHandler(L);
|
||||||
int tabIdx = static_cast<int>(luaL_checknumber(L, 1));
|
int tabIdx = static_cast<int>(luaL_checknumber(L, 1));
|
||||||
if (!gh || tabIdx < 1) {
|
if (!gh || tabIdx < 1) {
|
||||||
lua_pushnil(L); return 1;
|
return luaReturnNil(L);
|
||||||
}
|
}
|
||||||
const auto& tabs = gh->getSpellBookTabs();
|
const auto& tabs = gh->getSpellBookTabs();
|
||||||
if (tabIdx > static_cast<int>(tabs.size())) {
|
if (tabIdx > static_cast<int>(tabs.size())) {
|
||||||
lua_pushnil(L); return 1;
|
return luaReturnNil(L);
|
||||||
}
|
}
|
||||||
// Compute offset: sum of spells in all preceding tabs (1-based)
|
// Compute offset: sum of spells in all preceding tabs (1-based)
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
@ -3072,7 +3072,7 @@ static int lua_GetFriendInfo(lua_State* L) {
|
||||||
auto* gh = getGameHandler(L);
|
auto* gh = getGameHandler(L);
|
||||||
int index = static_cast<int>(luaL_checknumber(L, 1));
|
int index = static_cast<int>(luaL_checknumber(L, 1));
|
||||||
if (!gh || index < 1) {
|
if (!gh || index < 1) {
|
||||||
lua_pushnil(L); return 1;
|
return luaReturnNil(L);
|
||||||
}
|
}
|
||||||
int found = 0;
|
int found = 0;
|
||||||
for (const auto& c : gh->getContacts()) {
|
for (const auto& c : gh->getContacts()) {
|
||||||
|
|
@ -3227,7 +3227,7 @@ static int lua_GetTalentTabInfo(lua_State* L) {
|
||||||
auto* gh = getGameHandler(L);
|
auto* gh = getGameHandler(L);
|
||||||
int tabIndex = static_cast<int>(luaL_checknumber(L, 1)); // 1-indexed
|
int tabIndex = static_cast<int>(luaL_checknumber(L, 1)); // 1-indexed
|
||||||
if (!gh || tabIndex < 1) {
|
if (!gh || tabIndex < 1) {
|
||||||
lua_pushnil(L); return 1;
|
return luaReturnNil(L);
|
||||||
}
|
}
|
||||||
uint8_t classId = gh->getPlayerClass();
|
uint8_t classId = gh->getPlayerClass();
|
||||||
uint32_t classMask = (classId > 0) ? (1u << (classId - 1)) : 0;
|
uint32_t classMask = (classId > 0) ? (1u << (classId - 1)) : 0;
|
||||||
|
|
@ -3239,7 +3239,7 @@ static int lua_GetTalentTabInfo(lua_State* L) {
|
||||||
std::sort(classTabs.begin(), classTabs.end(),
|
std::sort(classTabs.begin(), classTabs.end(),
|
||||||
[](const auto* a, const auto* b) { return a->orderIndex < b->orderIndex; });
|
[](const auto* a, const auto* b) { return a->orderIndex < b->orderIndex; });
|
||||||
if (tabIndex > static_cast<int>(classTabs.size())) {
|
if (tabIndex > static_cast<int>(classTabs.size())) {
|
||||||
lua_pushnil(L); return 1;
|
return luaReturnNil(L);
|
||||||
}
|
}
|
||||||
const auto* tab = classTabs[tabIndex - 1];
|
const auto* tab = classTabs[tabIndex - 1];
|
||||||
// Count points spent in this tab
|
// Count points spent in this tab
|
||||||
|
|
@ -3270,7 +3270,7 @@ static int lua_GetNumTalents(lua_State* L) {
|
||||||
std::sort(classTabs.begin(), classTabs.end(),
|
std::sort(classTabs.begin(), classTabs.end(),
|
||||||
[](const auto* a, const auto* b) { return a->orderIndex < b->orderIndex; });
|
[](const auto* a, const auto* b) { return a->orderIndex < b->orderIndex; });
|
||||||
if (tabIndex > static_cast<int>(classTabs.size())) {
|
if (tabIndex > static_cast<int>(classTabs.size())) {
|
||||||
lua_pushnumber(L, 0); return 1;
|
return luaReturnZero(L);
|
||||||
}
|
}
|
||||||
uint32_t targetTabId = classTabs[tabIndex - 1]->tabId;
|
uint32_t targetTabId = classTabs[tabIndex - 1]->tabId;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
@ -3355,11 +3355,11 @@ static int lua_GetLootSlotInfo(lua_State* L) {
|
||||||
auto* gh = getGameHandler(L);
|
auto* gh = getGameHandler(L);
|
||||||
int slot = static_cast<int>(luaL_checknumber(L, 1)); // 1-indexed
|
int slot = static_cast<int>(luaL_checknumber(L, 1)); // 1-indexed
|
||||||
if (!gh || !gh->isLootWindowOpen()) {
|
if (!gh || !gh->isLootWindowOpen()) {
|
||||||
lua_pushnil(L); return 1;
|
return luaReturnNil(L);
|
||||||
}
|
}
|
||||||
const auto& loot = gh->getCurrentLoot();
|
const auto& loot = gh->getCurrentLoot();
|
||||||
if (slot < 1 || slot > static_cast<int>(loot.items.size())) {
|
if (slot < 1 || slot > static_cast<int>(loot.items.size())) {
|
||||||
lua_pushnil(L); return 1;
|
return luaReturnNil(L);
|
||||||
}
|
}
|
||||||
const auto& item = loot.items[slot - 1];
|
const auto& item = loot.items[slot - 1];
|
||||||
const auto* info = gh->getItemInfo(item.itemId);
|
const auto* info = gh->getItemInfo(item.itemId);
|
||||||
|
|
@ -3389,7 +3389,7 @@ static int lua_GetLootSlotLink(lua_State* L) {
|
||||||
if (!gh || !gh->isLootWindowOpen()) { return luaReturnNil(L); }
|
if (!gh || !gh->isLootWindowOpen()) { return luaReturnNil(L); }
|
||||||
const auto& loot = gh->getCurrentLoot();
|
const auto& loot = gh->getCurrentLoot();
|
||||||
if (slot < 1 || slot > static_cast<int>(loot.items.size())) {
|
if (slot < 1 || slot > static_cast<int>(loot.items.size())) {
|
||||||
lua_pushnil(L); return 1;
|
return luaReturnNil(L);
|
||||||
}
|
}
|
||||||
const auto& item = loot.items[slot - 1];
|
const auto& item = loot.items[slot - 1];
|
||||||
const auto* info = gh->getItemInfo(item.itemId);
|
const auto* info = gh->getItemInfo(item.itemId);
|
||||||
|
|
@ -5162,7 +5162,7 @@ void LuaEngine::registerCoreAPI() {
|
||||||
int index = static_cast<int>(luaL_checknumber(L, 1));
|
int index = static_cast<int>(luaL_checknumber(L, 1));
|
||||||
const auto* sb = gh ? gh->getBgScoreboard() : nullptr;
|
const auto* sb = gh ? gh->getBgScoreboard() : nullptr;
|
||||||
if (!sb || index < 1 || index > static_cast<int>(sb->players.size())) {
|
if (!sb || index < 1 || index > static_cast<int>(sb->players.size())) {
|
||||||
lua_pushnil(L); return 1;
|
return luaReturnNil(L);
|
||||||
}
|
}
|
||||||
const auto& p = sb->players[index - 1];
|
const auto& p = sb->players[index - 1];
|
||||||
lua_pushstring(L, p.name.c_str()); // name
|
lua_pushstring(L, p.name.c_str()); // name
|
||||||
|
|
@ -5726,10 +5726,10 @@ void LuaEngine::registerCoreAPI() {
|
||||||
return 4;
|
return 4;
|
||||||
}},
|
}},
|
||||||
{"CalendarGetNumPendingInvites", [](lua_State* L) -> int {
|
{"CalendarGetNumPendingInvites", [](lua_State* L) -> int {
|
||||||
lua_pushnumber(L, 0); return 1;
|
return luaReturnZero(L);
|
||||||
}},
|
}},
|
||||||
{"CalendarGetNumDayEvents", [](lua_State* L) -> int {
|
{"CalendarGetNumDayEvents", [](lua_State* L) -> int {
|
||||||
lua_pushnumber(L, 0); return 1;
|
return luaReturnZero(L);
|
||||||
}},
|
}},
|
||||||
// --- Instance ---
|
// --- Instance ---
|
||||||
{"GetDifficultyInfo", [](lua_State* L) -> int {
|
{"GetDifficultyInfo", [](lua_State* L) -> int {
|
||||||
|
|
@ -6027,7 +6027,7 @@ void LuaEngine::registerCoreAPI() {
|
||||||
auto* gh = getGameHandler(L);
|
auto* gh = getGameHandler(L);
|
||||||
int index = static_cast<int>(luaL_checknumber(L, 1));
|
int index = static_cast<int>(luaL_checknumber(L, 1));
|
||||||
if (!gh || index < 1 || index > game::GameHandler::PET_ACTION_BAR_SLOTS) {
|
if (!gh || index < 1 || index > game::GameHandler::PET_ACTION_BAR_SLOTS) {
|
||||||
lua_pushnil(L); return 1;
|
return luaReturnNil(L);
|
||||||
}
|
}
|
||||||
uint32_t packed = gh->getPetActionSlot(index - 1);
|
uint32_t packed = gh->getPetActionSlot(index - 1);
|
||||||
uint32_t spellId = packed & 0x00FFFFFF;
|
uint32_t spellId = packed & 0x00FFFFFF;
|
||||||
|
|
|
||||||
|
|
@ -1638,7 +1638,7 @@ void GameHandler::registerOpcodeHandlers() {
|
||||||
dispatchTable_[Opcode::SMSG_PLAYED_TIME] = [this](network::Packet& packet) { if (state == WorldState::IN_WORLD) handlePlayedTime(packet); };
|
dispatchTable_[Opcode::SMSG_PLAYED_TIME] = [this](network::Packet& packet) { if (state == WorldState::IN_WORLD) handlePlayedTime(packet); };
|
||||||
dispatchTable_[Opcode::SMSG_WHO] = [this](network::Packet& packet) { if (state == WorldState::IN_WORLD) handleWho(packet); };
|
dispatchTable_[Opcode::SMSG_WHO] = [this](network::Packet& packet) { if (state == WorldState::IN_WORLD) handleWho(packet); };
|
||||||
dispatchTable_[Opcode::SMSG_WHOIS] = [this](network::Packet& packet) {
|
dispatchTable_[Opcode::SMSG_WHOIS] = [this](network::Packet& packet) {
|
||||||
if (packet.getReadPos() < packet.getSize()) {
|
if (packet.hasData()) {
|
||||||
std::string whoisText = packet.readString();
|
std::string whoisText = packet.readString();
|
||||||
if (!whoisText.empty()) {
|
if (!whoisText.empty()) {
|
||||||
std::string line;
|
std::string line;
|
||||||
|
|
@ -2846,7 +2846,7 @@ void GameHandler::registerOpcodeHandlers() {
|
||||||
if (packet.getRemainingSize() < 8) return;
|
if (packet.getRemainingSize() < 8) return;
|
||||||
uint64_t casterGuid = packet.readUInt64();
|
uint64_t casterGuid = packet.readUInt64();
|
||||||
std::string casterName;
|
std::string casterName;
|
||||||
if (packet.getReadPos() < packet.getSize())
|
if (packet.hasData())
|
||||||
casterName = packet.readString();
|
casterName = packet.readString();
|
||||||
if (casterGuid) {
|
if (casterGuid) {
|
||||||
resurrectCasterGuid_ = casterGuid;
|
resurrectCasterGuid_ = casterGuid;
|
||||||
|
|
@ -3188,7 +3188,7 @@ void GameHandler::registerOpcodeHandlers() {
|
||||||
dispatchTable_[Opcode::SMSG_NEW_WORLD] = [this](network::Packet& packet) { handleNewWorld(packet); };
|
dispatchTable_[Opcode::SMSG_NEW_WORLD] = [this](network::Packet& packet) { handleNewWorld(packet); };
|
||||||
dispatchTable_[Opcode::SMSG_TRANSFER_ABORTED] = [this](network::Packet& packet) {
|
dispatchTable_[Opcode::SMSG_TRANSFER_ABORTED] = [this](network::Packet& packet) {
|
||||||
uint32_t mapId = packet.readUInt32();
|
uint32_t mapId = packet.readUInt32();
|
||||||
uint8_t reason = (packet.getReadPos() < packet.getSize()) ? packet.readUInt8() : 0;
|
uint8_t reason = (packet.hasData()) ? packet.readUInt8() : 0;
|
||||||
(void)mapId;
|
(void)mapId;
|
||||||
const char* abortMsg = nullptr;
|
const char* abortMsg = nullptr;
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
|
|
@ -3504,7 +3504,7 @@ void GameHandler::registerOpcodeHandlers() {
|
||||||
|
|
||||||
// Group set leader
|
// Group set leader
|
||||||
dispatchTable_[Opcode::SMSG_GROUP_SET_LEADER] = [this](network::Packet& packet) {
|
dispatchTable_[Opcode::SMSG_GROUP_SET_LEADER] = [this](network::Packet& packet) {
|
||||||
if (packet.getSize() <= packet.getReadPos()) return;
|
if (!packet.hasData()) return;
|
||||||
std::string leaderName = packet.readString();
|
std::string leaderName = packet.readString();
|
||||||
for (const auto& m : partyData.members) {
|
for (const auto& m : partyData.members) {
|
||||||
if (m.name == leaderName) { partyData.leaderGuid = m.guid; break; }
|
if (m.name == leaderName) { partyData.leaderGuid = m.guid; break; }
|
||||||
|
|
@ -5572,7 +5572,7 @@ void GameHandler::registerOpcodeHandlers() {
|
||||||
packet.skipAll();
|
packet.skipAll();
|
||||||
};
|
};
|
||||||
dispatchTable_[Opcode::SMSG_GUILD_DECLINE] = [this](network::Packet& packet) {
|
dispatchTable_[Opcode::SMSG_GUILD_DECLINE] = [this](network::Packet& packet) {
|
||||||
if (packet.getReadPos() < packet.getSize()) {
|
if (packet.hasData()) {
|
||||||
std::string name = packet.readString();
|
std::string name = packet.readString();
|
||||||
addSystemChatMessage(name + " declined your guild invitation.");
|
addSystemChatMessage(name + " declined your guild invitation.");
|
||||||
}
|
}
|
||||||
|
|
@ -6600,7 +6600,7 @@ void GameHandler::registerOpcodeHandlers() {
|
||||||
// charName (cstring) + guid (uint64) + achievementId (uint32) + ...
|
// charName (cstring) + guid (uint64) + achievementId (uint32) + ...
|
||||||
dispatchTable_[Opcode::SMSG_SERVER_FIRST_ACHIEVEMENT] = [this](network::Packet& packet) {
|
dispatchTable_[Opcode::SMSG_SERVER_FIRST_ACHIEVEMENT] = [this](network::Packet& packet) {
|
||||||
// charName (cstring) + guid (uint64) + achievementId (uint32) + ...
|
// charName (cstring) + guid (uint64) + achievementId (uint32) + ...
|
||||||
if (packet.getReadPos() < packet.getSize()) {
|
if (packet.hasData()) {
|
||||||
std::string charName = packet.readString();
|
std::string charName = packet.readString();
|
||||||
if (packet.getRemainingSize() >= 12) {
|
if (packet.getRemainingSize() >= 12) {
|
||||||
/*uint64_t guid =*/ packet.readUInt64();
|
/*uint64_t guid =*/ packet.readUInt64();
|
||||||
|
|
@ -7386,7 +7386,7 @@ void GameHandler::registerOpcodeHandlers() {
|
||||||
}
|
}
|
||||||
/*uint32_t command =*/ packet.readUInt32();
|
/*uint32_t command =*/ packet.readUInt32();
|
||||||
uint8_t result = packet.readUInt8();
|
uint8_t result = packet.readUInt8();
|
||||||
std::string info = (packet.getReadPos() < packet.getSize()) ? packet.readString() : "";
|
std::string info = (packet.hasData()) ? packet.readString() : "";
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
// Map common calendar error codes to friendly strings
|
// Map common calendar error codes to friendly strings
|
||||||
static const char* kCalendarErrors[] = {
|
static const char* kCalendarErrors[] = {
|
||||||
|
|
@ -7425,7 +7425,7 @@ void GameHandler::registerOpcodeHandlers() {
|
||||||
packet.skipAll(); return;
|
packet.skipAll(); return;
|
||||||
}
|
}
|
||||||
/*uint64_t eventId =*/ packet.readUInt64();
|
/*uint64_t eventId =*/ packet.readUInt64();
|
||||||
std::string title = (packet.getReadPos() < packet.getSize()) ? packet.readString() : "";
|
std::string title = (packet.hasData()) ? packet.readString() : "";
|
||||||
packet.skipAll(); // consume remaining fields
|
packet.skipAll(); // consume remaining fields
|
||||||
if (!title.empty()) {
|
if (!title.empty()) {
|
||||||
addSystemChatMessage("Calendar invite: " + title);
|
addSystemChatMessage("Calendar invite: " + title);
|
||||||
|
|
@ -7453,7 +7453,7 @@ void GameHandler::registerOpcodeHandlers() {
|
||||||
uint8_t status = packet.readUInt8();
|
uint8_t status = packet.readUInt8();
|
||||||
/*uint8_t rank =*/ packet.readUInt8();
|
/*uint8_t rank =*/ packet.readUInt8();
|
||||||
/*uint8_t isGuild =*/ packet.readUInt8();
|
/*uint8_t isGuild =*/ packet.readUInt8();
|
||||||
std::string evTitle = (packet.getReadPos() < packet.getSize()) ? packet.readString() : "";
|
std::string evTitle = (packet.hasData()) ? packet.readString() : "";
|
||||||
// status: 0=Invited,1=Accepted,2=Declined,3=Confirmed,4=Out,5=Standby,6=SignedUp,7=Not Signed Up,8=Tentative
|
// status: 0=Invited,1=Accepted,2=Declined,3=Confirmed,4=Out,5=Standby,6=SignedUp,7=Not Signed Up,8=Tentative
|
||||||
static const char* kRsvpStatus[] = {
|
static const char* kRsvpStatus[] = {
|
||||||
"invited", "accepted", "declined", "confirmed",
|
"invited", "accepted", "declined", "confirmed",
|
||||||
|
|
@ -7533,7 +7533,7 @@ void GameHandler::registerOpcodeHandlers() {
|
||||||
uint64_t kickerGuid = packet.readUInt64();
|
uint64_t kickerGuid = packet.readUInt64();
|
||||||
uint32_t reasonType = packet.readUInt32();
|
uint32_t reasonType = packet.readUInt32();
|
||||||
std::string reason;
|
std::string reason;
|
||||||
if (packet.getReadPos() < packet.getSize())
|
if (packet.hasData())
|
||||||
reason = packet.readString();
|
reason = packet.readString();
|
||||||
(void)kickerGuid;
|
(void)kickerGuid;
|
||||||
(void)reasonType;
|
(void)reasonType;
|
||||||
|
|
@ -7578,14 +7578,14 @@ void GameHandler::registerOpcodeHandlers() {
|
||||||
uint32_t ticketId = packet.readUInt32();
|
uint32_t ticketId = packet.readUInt32();
|
||||||
std::string subject;
|
std::string subject;
|
||||||
std::string body;
|
std::string body;
|
||||||
if (packet.getReadPos() < packet.getSize()) subject = packet.readString();
|
if (packet.hasData()) subject = packet.readString();
|
||||||
if (packet.getReadPos() < packet.getSize()) body = packet.readString();
|
if (packet.hasData()) body = packet.readString();
|
||||||
uint32_t responseCount = 0;
|
uint32_t responseCount = 0;
|
||||||
if (packet.hasRemaining(4))
|
if (packet.hasRemaining(4))
|
||||||
responseCount = packet.readUInt32();
|
responseCount = packet.readUInt32();
|
||||||
std::string responseText;
|
std::string responseText;
|
||||||
for (uint32_t i = 0; i < responseCount && i < 10; ++i) {
|
for (uint32_t i = 0; i < responseCount && i < 10; ++i) {
|
||||||
if (packet.getReadPos() < packet.getSize()) {
|
if (packet.hasData()) {
|
||||||
std::string t = packet.readString();
|
std::string t = packet.readString();
|
||||||
if (i == 0) responseText = t;
|
if (i == 0) responseText = t;
|
||||||
}
|
}
|
||||||
|
|
@ -16519,9 +16519,9 @@ void GameHandler::handleLfgBootProposalUpdate(network::Packet& packet) {
|
||||||
lfgBootNeeded_ = votesNeeded;
|
lfgBootNeeded_ = votesNeeded;
|
||||||
|
|
||||||
// Optional: reason string and target name (null-terminated) follow the fixed fields
|
// Optional: reason string and target name (null-terminated) follow the fixed fields
|
||||||
if (packet.getReadPos() < packet.getSize())
|
if (packet.hasData())
|
||||||
lfgBootReason_ = packet.readString();
|
lfgBootReason_ = packet.readString();
|
||||||
if (packet.getReadPos() < packet.getSize())
|
if (packet.hasData())
|
||||||
lfgBootTargetName_ = packet.readString();
|
lfgBootTargetName_ = packet.readString();
|
||||||
|
|
||||||
if (inProgress) {
|
if (inProgress) {
|
||||||
|
|
@ -23516,7 +23516,7 @@ void GameHandler::handleWho(network::Packet& packet) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < displayCount; ++i) {
|
for (uint32_t i = 0; i < displayCount; ++i) {
|
||||||
if (packet.getReadPos() >= packet.getSize()) break;
|
if (!packet.hasData()) break;
|
||||||
std::string playerName = packet.readString();
|
std::string playerName = packet.readString();
|
||||||
std::string guildName = packet.readString();
|
std::string guildName = packet.readString();
|
||||||
if (packet.getRemainingSize() < 12) break;
|
if (packet.getRemainingSize() < 12) break;
|
||||||
|
|
|
||||||
|
|
@ -1246,7 +1246,7 @@ bool ClassicPacketParsers::parseMessageChat(network::Packet& packet, MessageChat
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read chat tag
|
// Read chat tag
|
||||||
if (packet.getReadPos() < packet.getSize()) {
|
if (packet.hasData()) {
|
||||||
data.chatTag = packet.readUInt8();
|
data.chatTag = packet.readUInt8();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1855,7 +1855,7 @@ bool ClassicPacketParsers::parseItemQueryResponse(network::Packet& packet, ItemQ
|
||||||
data.bindType = packet.readUInt32();
|
data.bindType = packet.readUInt32();
|
||||||
|
|
||||||
// Description (flavor/lore text)
|
// Description (flavor/lore text)
|
||||||
if (packet.getReadPos() < packet.getSize())
|
if (packet.hasData())
|
||||||
data.description = packet.readString();
|
data.description = packet.readString();
|
||||||
|
|
||||||
// Post-description: PageText, LanguageID, PageMaterial, StartQuest
|
// Post-description: PageText, LanguageID, PageMaterial, StartQuest
|
||||||
|
|
@ -2095,7 +2095,7 @@ bool TurtlePacketParsers::parseUpdateObject(network::Packet& packet, UpdateObjec
|
||||||
}
|
}
|
||||||
|
|
||||||
if (withHasTransportByte) {
|
if (withHasTransportByte) {
|
||||||
if (packet.getReadPos() >= packet.getSize()) {
|
if (!packet.hasData()) {
|
||||||
packet.setReadPos(start);
|
packet.setReadPos(start);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -2122,7 +2122,7 @@ bool TurtlePacketParsers::parseUpdateObject(network::Packet& packet, UpdateObjec
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i < count; ++i) {
|
for (uint32_t i = 0; i < count; ++i) {
|
||||||
if (packet.getReadPos() >= packet.getSize()) {
|
if (!packet.hasData()) {
|
||||||
packet.setReadPos(start);
|
packet.setReadPos(start);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -2136,7 +2136,7 @@ bool TurtlePacketParsers::parseUpdateObject(network::Packet& packet, UpdateObjec
|
||||||
out.blockCount = remainingBlockCount;
|
out.blockCount = remainingBlockCount;
|
||||||
out.blocks.reserve(out.blockCount);
|
out.blocks.reserve(out.blockCount);
|
||||||
for (uint32_t i = 0; i < out.blockCount; ++i) {
|
for (uint32_t i = 0; i < out.blockCount; ++i) {
|
||||||
if (packet.getReadPos() >= packet.getSize()) {
|
if (!packet.hasData()) {
|
||||||
packet.setReadPos(start);
|
packet.setReadPos(start);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -2167,7 +2167,7 @@ bool TurtlePacketParsers::parseUpdateObject(network::Packet& packet, UpdateObjec
|
||||||
case UpdateType::CREATE_OBJECT:
|
case UpdateType::CREATE_OBJECT:
|
||||||
case UpdateType::CREATE_OBJECT2:
|
case UpdateType::CREATE_OBJECT2:
|
||||||
block.guid = packet.readPackedGuid();
|
block.guid = packet.readPackedGuid();
|
||||||
if (packet.getReadPos() >= packet.getSize()) return false;
|
if (!packet.hasData()) return false;
|
||||||
block.objectType = static_cast<ObjectType>(packet.readUInt8());
|
block.objectType = static_cast<ObjectType>(packet.readUInt8());
|
||||||
if (!movementParser(packet, block)) return false;
|
if (!movementParser(packet, block)) return false;
|
||||||
if (!UpdateObjectParser::parseUpdateFields(packet, block)) return false;
|
if (!UpdateObjectParser::parseUpdateFields(packet, block)) return false;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasFullPackedGuid(const wowee::network::Packet& packet) {
|
bool hasFullPackedGuid(const wowee::network::Packet& packet) {
|
||||||
if (packet.getReadPos() >= packet.getSize()) {
|
if (!packet.hasData()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -451,7 +451,7 @@ bool CharEnumParser::parse(network::Packet& packet, CharEnumResponse& response)
|
||||||
character.guid = packet.readUInt64();
|
character.guid = packet.readUInt64();
|
||||||
|
|
||||||
// Read name (null-terminated string) - validate before reading
|
// Read name (null-terminated string) - validate before reading
|
||||||
if (packet.getReadPos() >= packet.getSize()) {
|
if (!packet.hasData()) {
|
||||||
LOG_WARNING("CharEnumParser: no bytes for name at index ", static_cast<int>(i));
|
LOG_WARNING("CharEnumParser: no bytes for name at index ", static_cast<int>(i));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -683,7 +683,7 @@ bool MotdParser::parse(network::Packet& packet, MotdData& data) {
|
||||||
|
|
||||||
for (uint32_t i = 0; i < lineCount; ++i) {
|
for (uint32_t i = 0; i < lineCount; ++i) {
|
||||||
// Validate at least 1 byte available for the string
|
// Validate at least 1 byte available for the string
|
||||||
if (packet.getReadPos() >= packet.getSize()) {
|
if (!packet.hasData()) {
|
||||||
LOG_WARNING("MotdParser: truncated at line ", i + 1);
|
LOG_WARNING("MotdParser: truncated at line ", i + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1154,7 +1154,7 @@ bool UpdateObjectParser::parseMovementBlock(network::Packet& packet, UpdateBlock
|
||||||
bool UpdateObjectParser::parseUpdateFields(network::Packet& packet, UpdateBlock& block) {
|
bool UpdateObjectParser::parseUpdateFields(network::Packet& packet, UpdateBlock& block) {
|
||||||
size_t startPos = packet.getReadPos();
|
size_t startPos = packet.getReadPos();
|
||||||
|
|
||||||
if (packet.getReadPos() >= packet.getSize()) return false;
|
if (!packet.hasData()) return false;
|
||||||
|
|
||||||
// Read number of blocks (each block is 32 fields = 32 bits)
|
// Read number of blocks (each block is 32 fields = 32 bits)
|
||||||
uint8_t blockCount = packet.readUInt8();
|
uint8_t blockCount = packet.readUInt8();
|
||||||
|
|
@ -1261,7 +1261,7 @@ bool UpdateObjectParser::parseUpdateFields(network::Packet& packet, UpdateBlock&
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UpdateObjectParser::parseUpdateBlock(network::Packet& packet, UpdateBlock& block) {
|
bool UpdateObjectParser::parseUpdateBlock(network::Packet& packet, UpdateBlock& block) {
|
||||||
if (packet.getReadPos() >= packet.getSize()) return false;
|
if (!packet.hasData()) return false;
|
||||||
|
|
||||||
// Read update type
|
// Read update type
|
||||||
uint8_t updateTypeVal = packet.readUInt8();
|
uint8_t updateTypeVal = packet.readUInt8();
|
||||||
|
|
@ -1272,7 +1272,7 @@ bool UpdateObjectParser::parseUpdateBlock(network::Packet& packet, UpdateBlock&
|
||||||
switch (block.updateType) {
|
switch (block.updateType) {
|
||||||
case UpdateType::VALUES: {
|
case UpdateType::VALUES: {
|
||||||
// Partial update - changed fields only
|
// Partial update - changed fields only
|
||||||
if (packet.getReadPos() >= packet.getSize()) return false;
|
if (!packet.hasData()) return false;
|
||||||
block.guid = packet.readPackedGuid();
|
block.guid = packet.readPackedGuid();
|
||||||
LOG_DEBUG(" VALUES update for GUID: 0x", std::hex, block.guid, std::dec);
|
LOG_DEBUG(" VALUES update for GUID: 0x", std::hex, block.guid, std::dec);
|
||||||
|
|
||||||
|
|
@ -1291,12 +1291,12 @@ bool UpdateObjectParser::parseUpdateBlock(network::Packet& packet, UpdateBlock&
|
||||||
case UpdateType::CREATE_OBJECT:
|
case UpdateType::CREATE_OBJECT:
|
||||||
case UpdateType::CREATE_OBJECT2: {
|
case UpdateType::CREATE_OBJECT2: {
|
||||||
// Create new object with full data
|
// Create new object with full data
|
||||||
if (packet.getReadPos() >= packet.getSize()) return false;
|
if (!packet.hasData()) return false;
|
||||||
block.guid = packet.readPackedGuid();
|
block.guid = packet.readPackedGuid();
|
||||||
LOG_DEBUG(" CREATE_OBJECT for GUID: 0x", std::hex, block.guid, std::dec);
|
LOG_DEBUG(" CREATE_OBJECT for GUID: 0x", std::hex, block.guid, std::dec);
|
||||||
|
|
||||||
// Read object type
|
// Read object type
|
||||||
if (packet.getReadPos() >= packet.getSize()) return false;
|
if (!packet.hasData()) return false;
|
||||||
uint8_t objectTypeVal = packet.readUInt8();
|
uint8_t objectTypeVal = packet.readUInt8();
|
||||||
block.objectType = static_cast<ObjectType>(objectTypeVal);
|
block.objectType = static_cast<ObjectType>(objectTypeVal);
|
||||||
LOG_DEBUG(" Object type: ", static_cast<int>(objectTypeVal));
|
LOG_DEBUG(" Object type: ", static_cast<int>(objectTypeVal));
|
||||||
|
|
@ -1421,7 +1421,7 @@ bool DestroyObjectParser::parse(network::Packet& packet, DestroyObjectData& data
|
||||||
|
|
||||||
data.guid = packet.readUInt64();
|
data.guid = packet.readUInt64();
|
||||||
// WotLK adds isDeath byte; vanilla/TBC packets are exactly 8 bytes
|
// WotLK adds isDeath byte; vanilla/TBC packets are exactly 8 bytes
|
||||||
if (packet.getReadPos() < packet.getSize()) {
|
if (packet.hasData()) {
|
||||||
data.isDeath = (packet.readUInt8() != 0);
|
data.isDeath = (packet.readUInt8() != 0);
|
||||||
} else {
|
} else {
|
||||||
data.isDeath = false;
|
data.isDeath = false;
|
||||||
|
|
@ -1915,7 +1915,7 @@ bool FriendStatusParser::parse(network::Packet& packet, FriendStatusData& data)
|
||||||
data.guid = packet.readUInt64();
|
data.guid = packet.readUInt64();
|
||||||
if (data.status == 1) { // Online
|
if (data.status == 1) { // Online
|
||||||
// Conditional: note (string) + chatFlag (1)
|
// Conditional: note (string) + chatFlag (1)
|
||||||
if (packet.getReadPos() < packet.getSize()) {
|
if (packet.hasData()) {
|
||||||
data.note = packet.readString();
|
data.note = packet.readString();
|
||||||
if (packet.getReadPos() + 1 <= packet.getSize()) {
|
if (packet.getReadPos() + 1 <= packet.getSize()) {
|
||||||
data.chatFlag = packet.readUInt8();
|
data.chatFlag = packet.readUInt8();
|
||||||
|
|
@ -2236,7 +2236,7 @@ bool GuildQueryResponseParser::parse(network::Packet& packet, GuildQueryResponse
|
||||||
data.guildId = packet.readUInt32();
|
data.guildId = packet.readUInt32();
|
||||||
|
|
||||||
// Validate before reading guild name
|
// Validate before reading guild name
|
||||||
if (packet.getReadPos() >= packet.getSize()) {
|
if (!packet.hasData()) {
|
||||||
LOG_WARNING("GuildQueryResponseParser: truncated before guild name");
|
LOG_WARNING("GuildQueryResponseParser: truncated before guild name");
|
||||||
data.guildName.clear();
|
data.guildName.clear();
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -2245,7 +2245,7 @@ bool GuildQueryResponseParser::parse(network::Packet& packet, GuildQueryResponse
|
||||||
|
|
||||||
// Read 10 rank names with validation
|
// Read 10 rank names with validation
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
if (packet.getReadPos() >= packet.getSize()) {
|
if (!packet.hasData()) {
|
||||||
LOG_WARNING("GuildQueryResponseParser: truncated at rank name ", i);
|
LOG_WARNING("GuildQueryResponseParser: truncated at rank name ", i);
|
||||||
data.rankNames[i].clear();
|
data.rankNames[i].clear();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2358,7 +2358,7 @@ bool GuildRosterParser::parse(network::Packet& packet, GuildRosterData& data) {
|
||||||
m.online = (packet.readUInt8() != 0);
|
m.online = (packet.readUInt8() != 0);
|
||||||
|
|
||||||
// Validate before reading name string
|
// Validate before reading name string
|
||||||
if (packet.getReadPos() >= packet.getSize()) {
|
if (!packet.hasData()) {
|
||||||
m.name.clear();
|
m.name.clear();
|
||||||
} else {
|
} else {
|
||||||
m.name = packet.readString();
|
m.name = packet.readString();
|
||||||
|
|
@ -2399,12 +2399,12 @@ bool GuildRosterParser::parse(network::Packet& packet, GuildRosterData& data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read notes
|
// Read notes
|
||||||
if (packet.getReadPos() >= packet.getSize()) {
|
if (!packet.hasData()) {
|
||||||
m.publicNote.clear();
|
m.publicNote.clear();
|
||||||
m.officerNote.clear();
|
m.officerNote.clear();
|
||||||
} else {
|
} else {
|
||||||
m.publicNote = packet.readString();
|
m.publicNote = packet.readString();
|
||||||
if (packet.getReadPos() >= packet.getSize()) {
|
if (!packet.hasData()) {
|
||||||
m.officerNote.clear();
|
m.officerNote.clear();
|
||||||
} else {
|
} else {
|
||||||
m.officerNote = packet.readString();
|
m.officerNote = packet.readString();
|
||||||
|
|
@ -3046,7 +3046,7 @@ bool ItemQueryResponseParser::parse(network::Packet& packet, ItemQueryResponseDa
|
||||||
data.bindType = packet.readUInt32();
|
data.bindType = packet.readUInt32();
|
||||||
|
|
||||||
// Flavor/lore text (Description cstring)
|
// Flavor/lore text (Description cstring)
|
||||||
if (packet.getReadPos() < packet.getSize())
|
if (packet.hasData())
|
||||||
data.description = packet.readString();
|
data.description = packet.readString();
|
||||||
|
|
||||||
// Post-description fields: PageText, LanguageID, PageMaterial, StartQuest
|
// Post-description fields: PageText, LanguageID, PageMaterial, StartQuest
|
||||||
|
|
@ -3094,7 +3094,7 @@ bool MonsterMoveParser::parse(network::Packet& packet, MonsterMoveData& data) {
|
||||||
if (data.guid == 0) return false;
|
if (data.guid == 0) return false;
|
||||||
|
|
||||||
// uint8 unk (toggle for MOVEMENTFLAG2_UNK7)
|
// uint8 unk (toggle for MOVEMENTFLAG2_UNK7)
|
||||||
if (packet.getReadPos() >= packet.getSize()) return false;
|
if (!packet.hasData()) return false;
|
||||||
packet.readUInt8();
|
packet.readUInt8();
|
||||||
|
|
||||||
// Current position (server coords: float x, y, z)
|
// Current position (server coords: float x, y, z)
|
||||||
|
|
@ -3108,7 +3108,7 @@ bool MonsterMoveParser::parse(network::Packet& packet, MonsterMoveData& data) {
|
||||||
packet.readUInt32();
|
packet.readUInt32();
|
||||||
|
|
||||||
// uint8 moveType
|
// uint8 moveType
|
||||||
if (packet.getReadPos() >= packet.getSize()) return false;
|
if (!packet.hasData()) return false;
|
||||||
data.moveType = packet.readUInt8();
|
data.moveType = packet.readUInt8();
|
||||||
|
|
||||||
if (data.moveType == 1) {
|
if (data.moveType == 1) {
|
||||||
|
|
@ -3231,7 +3231,7 @@ bool MonsterMoveParser::parseVanilla(network::Packet& packet, MonsterMoveData& d
|
||||||
if (packet.getReadPos() + 4 > packet.getSize()) return false;
|
if (packet.getReadPos() + 4 > packet.getSize()) return false;
|
||||||
/*uint32_t splineIdOrTick =*/ packet.readUInt32();
|
/*uint32_t splineIdOrTick =*/ packet.readUInt32();
|
||||||
|
|
||||||
if (packet.getReadPos() >= packet.getSize()) return false;
|
if (!packet.hasData()) return false;
|
||||||
data.moveType = packet.readUInt8();
|
data.moveType = packet.readUInt8();
|
||||||
|
|
||||||
if (data.moveType == 1) {
|
if (data.moveType == 1) {
|
||||||
|
|
@ -3328,7 +3328,7 @@ bool AttackStartParser::parse(network::Packet& packet, AttackStartData& data) {
|
||||||
bool AttackStopParser::parse(network::Packet& packet, AttackStopData& data) {
|
bool AttackStopParser::parse(network::Packet& packet, AttackStopData& data) {
|
||||||
data.attackerGuid = packet.readPackedGuid();
|
data.attackerGuid = packet.readPackedGuid();
|
||||||
data.victimGuid = packet.readPackedGuid();
|
data.victimGuid = packet.readPackedGuid();
|
||||||
if (packet.getReadPos() < packet.getSize()) {
|
if (packet.hasData()) {
|
||||||
data.unknown = packet.readUInt32();
|
data.unknown = packet.readUInt32();
|
||||||
}
|
}
|
||||||
LOG_DEBUG("Attack stopped: 0x", std::hex, data.attackerGuid, std::dec);
|
LOG_DEBUG("Attack stopped: 0x", std::hex, data.attackerGuid, std::dec);
|
||||||
|
|
@ -3780,7 +3780,7 @@ bool SpellStartParser::parse(network::Packet& packet, SpellStartData& data) {
|
||||||
}
|
}
|
||||||
// STRING: null-terminated
|
// STRING: null-terminated
|
||||||
if (targetFlags & 0x0200u) {
|
if (targetFlags & 0x0200u) {
|
||||||
while (packet.getReadPos() < packet.getSize() && packet.readUInt8() != 0) {}
|
while (packet.hasData() && packet.readUInt8() != 0) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEBUG("Spell start: spell=", data.spellId, " castTime=", data.castTime, "ms");
|
LOG_DEBUG("Spell start: spell=", data.spellId, " castTime=", data.castTime, "ms");
|
||||||
|
|
@ -3919,7 +3919,7 @@ bool SpellGoParser::parse(network::Packet& packet, SpellGoData& data) {
|
||||||
// WotLK 3.3.5a SpellCastTargets — consume ALL target payload bytes so that
|
// WotLK 3.3.5a SpellCastTargets — consume ALL target payload bytes so that
|
||||||
// any trailing fields after the target section are not misaligned for
|
// any trailing fields after the target section are not misaligned for
|
||||||
// ground-targeted or AoE spells. Same layout as SpellStartParser.
|
// ground-targeted or AoE spells. Same layout as SpellStartParser.
|
||||||
if (packet.getReadPos() < packet.getSize()) {
|
if (packet.hasData()) {
|
||||||
if (packet.getRemainingSize() >= 4) {
|
if (packet.getRemainingSize() >= 4) {
|
||||||
uint32_t targetFlags = packet.readUInt32();
|
uint32_t targetFlags = packet.readUInt32();
|
||||||
|
|
||||||
|
|
@ -3955,7 +3955,7 @@ bool SpellGoParser::parse(network::Packet& packet, SpellGoData& data) {
|
||||||
}
|
}
|
||||||
// STRING: null-terminated
|
// STRING: null-terminated
|
||||||
if (targetFlags & 0x0200u) {
|
if (targetFlags & 0x0200u) {
|
||||||
while (packet.getReadPos() < packet.getSize() && packet.readUInt8() != 0) {}
|
while (packet.hasData() && packet.readUInt8() != 0) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3975,7 +3975,7 @@ bool AuraUpdateParser::parse(network::Packet& packet, AuraUpdateData& data, bool
|
||||||
uint32_t maxAuras = isAll ? 512 : 1;
|
uint32_t maxAuras = isAll ? 512 : 1;
|
||||||
uint32_t auraCount = 0;
|
uint32_t auraCount = 0;
|
||||||
|
|
||||||
while (packet.getReadPos() < packet.getSize() && auraCount < maxAuras) {
|
while (packet.hasData() && auraCount < maxAuras) {
|
||||||
// Validate we can read slot (1) + spellId (4) = 5 bytes minimum
|
// Validate we can read slot (1) + spellId (4) = 5 bytes minimum
|
||||||
if (packet.getRemainingSize() < 5) {
|
if (packet.getRemainingSize() < 5) {
|
||||||
LOG_DEBUG("Aura update: truncated entry at position ", auraCount);
|
LOG_DEBUG("Aura update: truncated entry at position ", auraCount);
|
||||||
|
|
@ -4043,7 +4043,7 @@ bool AuraUpdateParser::parse(network::Packet& packet, AuraUpdateData& data, bool
|
||||||
if (!isAll) break;
|
if (!isAll) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auraCount >= maxAuras && packet.getReadPos() < packet.getSize()) {
|
if (auraCount >= maxAuras && packet.hasData()) {
|
||||||
LOG_WARNING("Aura update: capped at ", maxAuras, " entries, remaining data ignored");
|
LOG_WARNING("Aura update: capped at ", maxAuras, " entries, remaining data ignored");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4995,7 +4995,7 @@ bool TrainerListParser::parse(network::Packet& packet, TrainerListData& data, bo
|
||||||
data.spells.push_back(spell);
|
data.spells.push_back(spell);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packet.getReadPos() >= packet.getSize()) {
|
if (!packet.hasData()) {
|
||||||
LOG_WARNING("TrainerListParser: truncated before greeting");
|
LOG_WARNING("TrainerListParser: truncated before greeting");
|
||||||
data.greeting.clear();
|
data.greeting.clear();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -5378,7 +5378,7 @@ bool PacketParsers::parseMailList(network::Packet& packet, std::vector<MailMessa
|
||||||
size_t consumed = packet.getReadPos() - startPos;
|
size_t consumed = packet.getReadPos() - startPos;
|
||||||
if (consumed < msgSize) {
|
if (consumed < msgSize) {
|
||||||
size_t skip = msgSize - consumed;
|
size_t skip = msgSize - consumed;
|
||||||
for (size_t s = 0; s < skip && packet.getReadPos() < packet.getSize(); ++s)
|
for (size_t s = 0; s < skip && packet.hasData(); ++s)
|
||||||
packet.readUInt8();
|
packet.readUInt8();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5517,12 +5517,12 @@ bool GuildBankListParser::parse(network::Packet& packet, GuildBankData& data) {
|
||||||
data.tabs.resize(tabCount);
|
data.tabs.resize(tabCount);
|
||||||
for (uint8_t i = 0; i < tabCount; ++i) {
|
for (uint8_t i = 0; i < tabCount; ++i) {
|
||||||
// Validate before reading strings
|
// Validate before reading strings
|
||||||
if (packet.getReadPos() >= packet.getSize()) {
|
if (!packet.hasData()) {
|
||||||
LOG_WARNING("GuildBankListParser: truncated tab at index ", static_cast<int>(i));
|
LOG_WARNING("GuildBankListParser: truncated tab at index ", static_cast<int>(i));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
data.tabs[i].tabName = packet.readString();
|
data.tabs[i].tabName = packet.readString();
|
||||||
if (packet.getReadPos() >= packet.getSize()) {
|
if (!packet.hasData()) {
|
||||||
data.tabs[i].tabIcon.clear();
|
data.tabs[i].tabIcon.clear();
|
||||||
} else {
|
} else {
|
||||||
data.tabs[i].tabIcon = packet.readString();
|
data.tabs[i].tabIcon = packet.readString();
|
||||||
|
|
@ -5606,7 +5606,7 @@ bool AuctionHelloParser::parse(network::Packet& packet, AuctionHelloData& data)
|
||||||
data.auctioneerGuid = packet.readUInt64();
|
data.auctioneerGuid = packet.readUInt64();
|
||||||
data.auctionHouseId = packet.readUInt32();
|
data.auctionHouseId = packet.readUInt32();
|
||||||
// WotLK has an extra uint8 enabled field; Vanilla does not
|
// WotLK has an extra uint8 enabled field; Vanilla does not
|
||||||
if (packet.getReadPos() < packet.getSize()) {
|
if (packet.hasData()) {
|
||||||
data.enabled = packet.readUInt8();
|
data.enabled = packet.readUInt8();
|
||||||
} else {
|
} else {
|
||||||
data.enabled = 1;
|
data.enabled = 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue