2026-03-01 12:16:08 +08:00
|
|
|
#include "stdafx.h"
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include "InputOutputStream.h"
|
|
|
|
|
#include "PacketListener.h"
|
|
|
|
|
#include "SetCarriedItemPacket.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-03-02 17:37:16 +07:00
|
|
|
SetCarriedItemPacket::SetCarriedItemPacket()
|
2026-03-01 12:16:08 +08:00
|
|
|
{
|
|
|
|
|
slot = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-02 17:37:16 +07:00
|
|
|
SetCarriedItemPacket::SetCarriedItemPacket(int slot)
|
2026-03-01 12:16:08 +08:00
|
|
|
{
|
|
|
|
|
this->slot = slot;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SetCarriedItemPacket::read(DataInputStream *dis) //throws IOException
|
|
|
|
|
{
|
|
|
|
|
slot = dis->readShort();
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-02 17:37:16 +07:00
|
|
|
void SetCarriedItemPacket::write(DataOutputStream *dos) //throws IOException
|
2026-03-01 12:16:08 +08:00
|
|
|
{
|
|
|
|
|
dos->writeShort(slot);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-02 17:37:16 +07:00
|
|
|
void SetCarriedItemPacket::handle(PacketListener *listener)
|
2026-03-01 12:16:08 +08:00
|
|
|
{
|
|
|
|
|
listener->handleSetCarriedItem(shared_from_this());
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-02 17:37:16 +07:00
|
|
|
int SetCarriedItemPacket::getEstimatedSize()
|
2026-03-01 12:16:08 +08:00
|
|
|
{
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-02 17:37:16 +07:00
|
|
|
bool SetCarriedItemPacket::canBeInvalidated()
|
2026-03-01 12:16:08 +08:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-02 17:37:16 +07:00
|
|
|
bool SetCarriedItemPacket::isInvalidatedBy(shared_ptr<Packet> packet)
|
2026-03-01 12:16:08 +08:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|