Core/PacketIO: Add some (possible) missing FlushBits
This commit is contained in:
@@ -1013,6 +1013,8 @@ void AchievementMgr<Guild>::SendCriteriaUpdate(AchievementCriteriaEntry const* e
|
||||
data.WriteBit(counter[7]);
|
||||
data.WriteBit(guid[4]);
|
||||
|
||||
data.FlushBits();
|
||||
|
||||
data.WriteByteSeq(guid[5]);
|
||||
data << uint32(progress->date); // unknown date
|
||||
data.WriteByteSeq(counter[3]);
|
||||
|
||||
@@ -3429,16 +3429,16 @@ void ObjectMgr::GetPlayerClassLevelInfo(uint32 class_, uint8 level, uint32& base
|
||||
|
||||
if (level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
level = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
|
||||
|
||||
|
||||
GtOCTBaseHPByClassEntry const* hp = sGtOCTBaseHPByClassStore.LookupEntry((class_-1) * GT_MAX_LEVEL + level-1);
|
||||
GtOCTBaseMPByClassEntry const* mp = sGtOCTBaseMPByClassStore.LookupEntry((class_-1) * GT_MAX_LEVEL + level-1);
|
||||
|
||||
|
||||
if (!hp || !mp)
|
||||
{
|
||||
sLog->outError("Tried to get non-existant Class-Level combination data for base hp/mp. Class %u Level %u", class_, level);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
baseHP = uint32(hp->ratio);
|
||||
baseMana = uint32(mp->ratio);
|
||||
}
|
||||
|
||||
@@ -1311,7 +1311,7 @@ void Guild::HandleGuildRanks(WorldSession* session)
|
||||
// perhaps move to guild.cpp.....
|
||||
ByteBuffer rankData(100);
|
||||
WorldPacket data(SMSG_GUILD_RANK, 100);
|
||||
|
||||
|
||||
data.WriteBits(_GetRanksSize(), 18);
|
||||
|
||||
for (uint8 i = 0; i < _GetRanksSize(); i++)
|
||||
@@ -1599,7 +1599,7 @@ void Guild::HandleInviteMember(WorldSession* session, const std::string& name)
|
||||
data.WriteByteSeq(newGuildGuid[4]);
|
||||
|
||||
data.append(m_name.c_str(), m_name.length());
|
||||
|
||||
|
||||
data.WriteByteSeq(newGuildGuid[5]);
|
||||
data.WriteByteSeq(newGuildGuid[3]);
|
||||
data.WriteByteSeq(oldGuildGuid[4]);
|
||||
@@ -1688,7 +1688,7 @@ void Guild::HandleUpdateMemberRank(WorldSession* session, uint64 targetGuid, boo
|
||||
SendCommandResult(session, GUILD_INVITE, ERR_GUILD_PERMISSIONS);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Player cannot promote himself
|
||||
if (member->IsSamePlayer(player->GetGUID()))
|
||||
{
|
||||
@@ -1741,7 +1741,7 @@ void Guild::HandleSetMemberRank(WorldSession* session, uint64 targetGuid, uint64
|
||||
SendCommandResult(session, GUILD_INVITE, ERR_GUILD_PERMISSIONS);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Player cannot promote himself
|
||||
if (member->IsSamePlayer(player->GetGUID()))
|
||||
{
|
||||
|
||||
@@ -820,7 +820,7 @@ private:
|
||||
void _SendBankMoneyUpdate(WorldSession* session) const;
|
||||
void _SendBankContentUpdate(MoveItemData* pSrc, MoveItemData* pDest) const;
|
||||
void _SendBankContentUpdate(uint8 tabId, SlotIds slots) const;
|
||||
|
||||
|
||||
void SendGuildRanksUpdate(uint64 setterGuid, uint64 targetGuid, uint32 rank);
|
||||
|
||||
void _BroadcastEvent(GuildEvents guildEvent, uint64 guid, const char* param1 = NULL, const char* param2 = NULL, const char* param3 = NULL) const;
|
||||
|
||||
@@ -28,6 +28,8 @@ void WorldSession::SendAuthResponse(uint8 code, bool queued, uint32 queuePos)
|
||||
|
||||
packet.WriteBit(1); // has account info
|
||||
|
||||
packet.FlushBits();
|
||||
|
||||
// account info
|
||||
packet << uint32(0); // BillingTimeRemaining
|
||||
packet << uint8(Expansion()); // 0 - normal, 1 - TBC, 2 - WOTLK, 3 - CATA; must be set in database manually for each account
|
||||
|
||||
@@ -670,7 +670,7 @@ void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket & recv_data)
|
||||
bag = INVENTORY_SLOT_BAG_0;
|
||||
else
|
||||
bagItem = _player->GetItemByGuid(bagguid);
|
||||
|
||||
|
||||
if (bagItem && bagItem->IsBag())
|
||||
bag = bagItem->GetSlot();
|
||||
|
||||
@@ -684,10 +684,10 @@ void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleBuyItemOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUY_ITEM");
|
||||
uint64 vendorguid, bagGuid;
|
||||
uint64 vendorguid, bagGuid;
|
||||
uint32 item, slot, count;
|
||||
uint8 itemType; // 1 = item, 2 = currency
|
||||
int8 bagSlot;
|
||||
int8 bagSlot;
|
||||
|
||||
recv_data >> vendorguid >> itemType >> item >> slot >> count >> bagGuid >> bagSlot;
|
||||
|
||||
@@ -696,12 +696,12 @@ void WorldSession::HandleBuyItemOpcode(WorldPacket& recv_data)
|
||||
--slot;
|
||||
else
|
||||
return; // cheating
|
||||
|
||||
|
||||
Item* bagItem = _player->GetItemByGuid(bagGuid);
|
||||
|
||||
|
||||
if (bagItem && bagItem->IsBag())
|
||||
bag = bagItem->GetSlot();
|
||||
|
||||
|
||||
GetPlayer()->BuyItemFromVendorSlot(vendorguid, slot, item, count, bag, bagSlot);
|
||||
}
|
||||
|
||||
@@ -1642,9 +1642,9 @@ void WorldSession::HandleReforgeItemOpcode(WorldPacket& recvData)
|
||||
ObjectGuid guid;
|
||||
uint32 bag;
|
||||
Player* player = GetPlayer();
|
||||
|
||||
|
||||
recvData >> reforgeEntry >> slot >> bag;
|
||||
|
||||
|
||||
guid[2] = recvData.ReadBit();
|
||||
guid[6] = recvData.ReadBit();
|
||||
guid[3] = recvData.ReadBit();
|
||||
@@ -1653,7 +1653,9 @@ void WorldSession::HandleReforgeItemOpcode(WorldPacket& recvData)
|
||||
guid[0] = recvData.ReadBit();
|
||||
guid[7] = recvData.ReadBit();
|
||||
guid[5] = recvData.ReadBit();
|
||||
|
||||
|
||||
recvData.FlushBits();
|
||||
|
||||
recvData.ReadByteSeq(guid[2]);
|
||||
recvData.ReadByteSeq(guid[3]);
|
||||
recvData.ReadByteSeq(guid[6]);
|
||||
@@ -1669,16 +1671,16 @@ void WorldSession::HandleReforgeItemOpcode(WorldPacket& recvData)
|
||||
SendReforgeResult(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Item* item = player->GetItemByPos(bag, slot);
|
||||
|
||||
|
||||
Item* item = player->GetItemByPos(bag, slot);
|
||||
|
||||
if (!item)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleReforgeItemOpcode - Player (Guid: %u Name: %s) tried to reforge an invalid/non-existant item.", player->GetGUIDLow(), player->GetName());
|
||||
SendReforgeResult(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!reforgeEntry)
|
||||
{
|
||||
// Reset the item
|
||||
@@ -1686,25 +1688,25 @@ void WorldSession::HandleReforgeItemOpcode(WorldPacket& recvData)
|
||||
SendReforgeResult(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!sItemReforgeStore.LookupEntry(reforgeEntry))
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleReforgeItemOpcode - Player (Guid: %u Name: %s) tried to reforge an item with invalid reforge entry (%u).", player->GetGUIDLow(), player->GetName(), reforgeEntry);
|
||||
SendReforgeResult(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (player->HasEnoughMoney(uint64(item->GetSpecialPrice()))) // cheating
|
||||
{
|
||||
SendReforgeResult(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
player->ModifyMoney(-int64(item->GetSpecialPrice()));
|
||||
|
||||
|
||||
item->SetEnchantment(REFORGE_ENCHANTMENT_SLOT, reforgeEntry, 0, 0);
|
||||
|
||||
|
||||
SendReforgeResult(true);
|
||||
|
||||
|
||||
// ToDo: Apply and remove the destination/source stats to the player
|
||||
}
|
||||
|
||||
@@ -42,29 +42,33 @@ void WorldSession::SendTradeStatus(TradeStatus status)
|
||||
{
|
||||
case TRADE_STATUS_BEGIN_TRADE:
|
||||
data.WriteBits(0, 8); // zero guid
|
||||
data.FlushBits();
|
||||
break;
|
||||
case TRADE_STATUS_OPEN_WINDOW:
|
||||
data.FlushBits();
|
||||
data << uint32(0); // unk
|
||||
break;
|
||||
case TRADE_STATUS_CLOSE_WINDOW:
|
||||
data.WriteBit(0); // unk
|
||||
data.FlushBits();
|
||||
data << uint32(0); // unk
|
||||
data << uint32(0); // unk
|
||||
break;
|
||||
case TRADE_STATUS_ONLY_CONJURED:
|
||||
case TRADE_STATUS_NOT_ELIGIBLE:
|
||||
data.FlushBits();
|
||||
data << uint8(0); // unk
|
||||
break;
|
||||
case TRADE_STATUS_CURRENCY: // Not implemented
|
||||
case TRADE_STATUS_CURRENCY_NOT_TRADABLE: // Not implemented
|
||||
data.FlushBits();
|
||||
data << uint32(0); // unk
|
||||
data << uint32(0); // unk
|
||||
default:
|
||||
data.FlushBits();
|
||||
break;
|
||||
}
|
||||
|
||||
data.FlushBits();
|
||||
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ void InitOpcodes()
|
||||
//DEFINE_OPCODE_HANDLER(CMSG_GROUP_CHANGE_SUB_GROUP, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGroupChangeSubGroupOpcode );
|
||||
//DEFINE_OPCODE_HANDLER(CMSG_GROUP_DECLINE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGroupDeclineOpcode );
|
||||
//DEFINE_OPCODE_HANDLER(CMSG_GROUP_DISBAND, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGroupDisbandOpcode );
|
||||
//DEFINE_OPCODE_HANDLER(CMSG_GROUP_INVITE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGroupInviteOpcode );
|
||||
DEFINE_OPCODE_HANDLER(CMSG_GROUP_INVITE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGroupInviteOpcode );
|
||||
//DEFINE_OPCODE_HANDLER(CMSG_GROUP_RAID_CONVERT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGroupRaidConvertOpcode );
|
||||
//DEFINE_OPCODE_HANDLER(CMSG_GROUP_SET_LEADER, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGroupSetLeaderOpcode );
|
||||
//DEFINE_OPCODE_HANDLER(CMSG_GROUP_SWAP_SUB_GROUP, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGroupSwapSubGroupOpcode );
|
||||
|
||||
@@ -672,6 +672,7 @@ void WorldSession::SendAuthWaitQue(uint32 position)
|
||||
WorldPacket packet(SMSG_AUTH_RESPONSE, 1);
|
||||
packet.WriteBit(0); // has queue info
|
||||
packet.WriteBit(0); // has account info
|
||||
packet.FlushBits();
|
||||
packet << uint8(AUTH_OK);
|
||||
SendPacket(&packet);
|
||||
}
|
||||
@@ -681,6 +682,7 @@ void WorldSession::SendAuthWaitQue(uint32 position)
|
||||
packet.WriteBit(1); // has queue info
|
||||
packet.WriteBit(0); // unk queue bool
|
||||
packet.WriteBit(0); // has account info
|
||||
packet.FlushBits();
|
||||
packet << uint8(AUTH_WAIT_QUEUE);
|
||||
packet << uint32(position);
|
||||
SendPacket(&packet);
|
||||
|
||||
@@ -922,7 +922,7 @@ class WorldSession
|
||||
|
||||
// Transmogrification
|
||||
void HandleTransmogrifyItems(WorldPacket& recvData);
|
||||
|
||||
|
||||
// Reforge
|
||||
void HandleReforgeItemOpcode(WorldPacket& recvData);
|
||||
void SendReforgeResult(bool success);
|
||||
|
||||
Reference in New Issue
Block a user