Ejemplo n.º 1
0
        public void Close()
        {
            foreach (PlayerShopItem loopShopItem in Items)
            {
                if (loopShopItem.Quantity > 0)
                {
                    Owner.Items.AddItemToInventory(new Item(loopShopItem.MapleID, loopShopItem.Quantity));
                }
            }

            if (Opened)
            {
                Map.PlayerShops.Remove(this);

                foreach (var curVisitor in Visitors.Where(curVisitor => curVisitor != null))
                {
                    using (Packet oPacket = new Packet(ServerOperationCode.PlayerInteraction))
                    {
                        oPacket
                        .WriteByte((byte)InteractionConstants.InteractionCode.Exit)
                        .WriteByte(1)
                        .WriteByte(10);

                        curVisitor.Client.Send(oPacket);
                    }

                    curVisitor.PlayerShop = null;
                }
            }

            Owner.PlayerShop = null;
        }
Ejemplo n.º 2
0
        public Visitor Exit()
        {
            Visitor visitor;

            if (currentFloor is GroundFloor)
            {
                visitor = Visitors.Where(x => x.Served).FirstOrDefault();
            }
            else
            {
                visitor = Visitors.Where(x => x.FloorNumber == floorNumber).FirstOrDefault();
            }
            Visitors.Remove(visitor);
            return(visitor);
        }