コード例 #1
0
 public ClientMoveShopItemEventArgs(MoveShopItemInfo i)
 {
     info = i;
 }
コード例 #2
0
        private bool MoveShopItem(Client c, MoveShopItemInfo m, BaseItem item)
        {
            BaseItem itemunder = null;
            if (m.ItemUnderID != 0)
                itemunder = c.MyCharacter.Shop.Items.First(x => x.ItemID == m.ItemUnderID);

            if (m.ToSlot <= 36)
            {
                if (c.MyCharacter.Shop.MoveItem(c.MyCharacter, item, m.ToSlot, out itemunder))
                {
                    if (itemunder == null)
                    {
                        item.Slot = (byte)(m.ToSlot);

                        itemDataManager.UpdateShopItemById(item);
                    }
                    else
                    {
                        int tempslot;
                        tempslot = item.Slot;
                        item.Slot = itemunder.Slot;
                        itemunder.Slot = (byte)tempslot;

                        itemDataManager.UpdateShopItemById(item);
                        itemDataManager.UpdateShopItemById(itemunder);
                    }

                    byte[] SendRemoveShopItem = PacketManager.SendRemoveShopItem(m.FromSlot, item.ItemID, item.Amount);
                    c.Send(SendRemoveShopItem);

                    if (itemunder != null)
                    {
                        byte[] SendRemoveShopItemUnder = PacketManager.SendRemoveShopItem(m.ToSlot, itemunder.ItemID, itemunder.Amount);
                        c.Send(SendRemoveShopItemUnder);

                        byte[] SendAddShopItemUnder = PacketManager.SendAddItemToShop(itemunder, itemunder.SellPrice);
                        c.Send(SendAddShopItemUnder);
                    }

                    byte[] SendAddShopItem = PacketManager.SendAddItemToShop(item, item.SellPrice);
                    c.Send(SendAddShopItem);
                    return true;
                }
            }

            return false;
        }
コード例 #3
0
        public static MoveShopItemInfo RecvMoveShopItem(Packet p)
        {
            p.Skip(2);
            byte fromslot = p.ReadByte();
            int itemid = p.ReadInt();
            byte toslot = p.ReadByte();
            int itemunderid = p.ReadInt();

            MoveShopItemInfo i = new MoveShopItemInfo
            {
                FromSlot = fromslot,
                ItemID = itemid,
                ToSlot = toslot,
                ItemUnderID = itemunderid
            };

            return i;
        }