1
0

recover hotbar selected slot after reconnect (#4249)

1. implement protocol message SendHeldItemChange
2. add save / load inventory equipped item slot in JSON
3. send held item slot message after player connect to server

Fixes #4189
This commit is contained in:
changyong guo
2018-07-23 06:23:33 +08:00
committed by peterbell10
parent 7b431bed51
commit 3e802932a6
12 changed files with 79 additions and 0 deletions

View File

@@ -592,6 +592,19 @@ void cProtocol_1_8_0::SendHealth(void)
void cProtocol_1_8_0::SendHeldItemChange(int a_ItemIndex)
{
ASSERT((a_ItemIndex >= 0) && (a_ItemIndex <= 8)); // Valid check
cPacketizer Pkt(*this, 0x09); // Held item change
cPlayer * Player = m_Client->GetPlayer();
Pkt.WriteBEInt8(static_cast<Int8>(Player->GetInventory().GetEquippedSlotNum()));
}
void cProtocol_1_8_0::SendHideTitle(void)
{
ASSERT(m_State == 3); // In game mode?