コード例 #1
0
        // This packet feels wonky and insecure - wackyracer
        public static void AddItem(Character pTo, byte TradeSlot, BaseItem pItem, byte User)
        {
            int    itemType = (pItem.ItemID / 1000000);
            Packet pw       = new Packet(ServerMessages.MINI_ROOM_BASE);

            pw.WriteByte(13);
            pw.WriteByte(User);           // 0 or 1 based on left/right side of trade window
            pw.WriteByte(TradeSlot);      // item slot in the trade window
            pw.WriteByte((byte)itemType); // Item Type (EQ, USE, SETUP, ETC, PET)
            PacketHelper.AddItemData(pw, pItem, 0, false);
            pTo.SendPacket(pw);
        }
コード例 #2
0
        public static void PersonalShopRefresh(Character pCharacter, PlayerShop ps)
        {
            Packet pw = new Packet(ServerMessages.MINI_ROOM_BASE);

            pw.WriteByte(0x15);
            pw.WriteByte((byte)ps.Items.Count);
            foreach (KeyValuePair <byte, PlayerShopItem> pst in ps.Items)
            {
                pw.WriteShort(pst.Value.Bundles);
                pw.WriteShort(pst.Value.BundleAmount);
                pw.WriteInt(pst.Value.Price);
                pw.WriteByte(WvsBeta.Common.Constants.getItemTypeInPacket(pst.Value.sItem.ItemID));
                PacketHelper.AddItemData(pw, pst.Value.sItem, 0, false);
            }
            ps.BroadcastPacket(pw);
        }
コード例 #3
0
        public void GenerateInventoryPacket(Packet packet)
        {
            packet.WriteInt(Mesos);

            foreach (var item in Equips[0])
            {
                if (item == null)
                {
                    continue;
                }
                PacketHelper.AddItemData(packet, item, item.InventorySlot, false);
            }

            packet.WriteByte(0);

            foreach (var item in Equips[1])
            {
                if (item == null)
                {
                    continue;
                }
                PacketHelper.AddItemData(packet, item, item.InventorySlot, false);
            }
            packet.WriteByte(0);

            for (int i = 0; i < 5; i++)
            {
                packet.WriteByte(MaxSlots[i]);
                foreach (BaseItem item in Items[i])
                {
                    if (item != null && item.InventorySlot > 0)
                    {
                        PacketHelper.AddItemData(packet, item, item.InventorySlot, false);
                    }
                }

                packet.WriteByte(0);
            }
        }
コード例 #4
0
        public static void AddItem2(Character chr, byte inventory, BaseItem item, bool isNew, short amount)
        {
            Packet pw = new Packet(ServerMessages.INVENTORY_OPERATION);

            pw.WriteByte(0x01);
            pw.WriteByte(0x01);
            pw.WriteBool(!isNew);
            pw.WriteByte(inventory);
            if (isNew)
            {
                PacketHelper.AddItemData(pw, item, item.InventorySlot, true);
            }
            else
            {
                pw.WriteShort(item.InventorySlot);
                pw.WriteShort(amount);
            }
            pw.WriteLong(0x00);
            pw.WriteLong(0x00);
            pw.WriteLong(0x00);
            chr.SendPacket(pw);
        }