Exemple #1
0
        private void UnEquipBag(Bag bag, InventoryPage targetPage, byte targetSlot)
        {
            Debug.Requires(bag != null);
            Debug.Requires(targetPage != null);
            Debug.Requires(targetSlot < targetPage.Size);
            Debug.Requires(bag != targetPage);
            Debug.Requires(InventoryPage.Items.All(entry => entry.Value.Key != bag));

            byte bagSlot;

            if (!TryGetBagSlot(bag, out bagSlot))
            {
                Debug.ThrowException(new ArgumentException("bag not equipped"));
            }

            _bags[bagSlot] = null;

            targetPage.PutItem(bag.Bag, targetSlot);

            if (Game.State == GameState.Playing)
            {
                Network.GameServer.Send(GameServerMessage.UnEquipBag, (ushort)1, IdManager.GetId(bag.Bag), IdManager.GetId(targetPage), targetSlot);
            }
        }