CGuildMenuSellPacket::CGuildMenuSellPacket(CCharEntity* PChar, CItemContainer* PGuild)
{
    this->type = 0x85;
    this->size = 0x7C;

    DSP_DEBUG_BREAK_IF(PChar == nullptr);
    DSP_DEBUG_BREAK_IF(PGuild == nullptr);

    uint8 ItemCount = 0;
    uint8 PacketCount = 0;

    for (uint8 SlotID = 1; SlotID <= PGuild->GetSize(); ++SlotID) 
    {
        CItemShop* PItem = (CItemShop*)PGuild->GetItem(SlotID);

        if (ItemCount == 30)
        {
            ref<uint8>(0xF4) = ItemCount;
            ref<uint8>(0xF5) = (PacketCount == 0 ? 0x40 : PacketCount);

            PChar->pushPacket(new CBasicPacket(*this));

            ItemCount = 0;
            PacketCount++;
						
            memset(data + 4, 0, PACKET_SIZE - 8);
        }
        ref<uint16>(0x08 * ItemCount + 0x04) = PItem->getID();
        ref<uint8>(0x08 * ItemCount + 0x06) = PItem->getQuantity();
        ref<uint8>(0x08 * ItemCount + 0x07) = PItem->getStackSize();
        ref<uint32>(0x08 * ItemCount + 0x08) = PItem->getSellPrice();

        ItemCount++;
    }
    ref<uint8>(0xF4) = ItemCount;
    ref<uint8>(0xF5) = PacketCount + 0x80;
}
Beispiel #2
0
CGuildMenuSellPacket::CGuildMenuSellPacket(CCharEntity* PChar, CItemContainer* PGuild)
{
    this->type = 0x85;
    this->size = 0x7C;

    DSP_DEBUG_BREAK_IF(PChar == nullptr);
    DSP_DEBUG_BREAK_IF(PGuild == nullptr);

    uint8 ItemCount = 0;
    uint8 PacketCount = 0;

    for (uint8 SlotID = 1; SlotID <= PGuild->GetSize(); ++SlotID) 
    {
        CItemShop* PItem = (CItemShop*)PGuild->GetItem(SlotID);

        if (ItemCount == 30)
        {
            WBUFB(data,(0xF4)-4) = ItemCount;
            WBUFB(data,(0xF5)-4) = (PacketCount == 0 ? 0x40 : PacketCount);

            PChar->pushPacket(new CBasicPacket(*this));

            ItemCount = 0;
            PacketCount++;
						
            memset(data, 0, sizeof(data));
        }
        WBUFW(data,(0x08*ItemCount+0x04)-4) = PItem->getID();
        WBUFB(data,(0x08*ItemCount+0x06)-4) = PItem->getQuantity();
        WBUFB(data,(0x08*ItemCount+0x07)-4) = PItem->getStackSize();
        WBUFL(data,(0x08*ItemCount+0x08)-4) = PItem->getSellPrice();

        ItemCount++;
    }
    WBUFB(data,(0xF4)-4) = ItemCount;
    WBUFB(data,(0xF5)-4) = PacketCount + 0x80;
}