Exemple #1
0
        // TODO: map debug
        public static void AddTileDescription(Connection connection, NetworkMessage message, Tile tile)
        {
            if (tile != null)
            {
                int count = 0;
                if (tile.Ground != null)
                {
                    message.AddItem(tile.Ground);
                    ++count;
                }

                foreach (Item item in tile.GetTopItems())
                {
                    message.AddItem(item);
                    ++count;
                }

                foreach (Creature creature in tile.Creatures)
                {
                    if (true)// (player->canSeeCreature(*cit))
                    {
                        uint removeKnown;
                        bool known = connection.IsCreatureKnown(creature.Id, out removeKnown);
                        message.AddCreature(creature, known, removeKnown);
                        count++;
                    }
                }

                foreach (Item item in tile.GetDownItems())
                {
                    message.AddItem(item);
                    ++count;
                }
            }
        }
Exemple #2
0
        public override void ToNetworkMessage(NetworkMessage msg)
        {
            msg.AddByte((byte)Type);
            msg.AddByte(Slot);

            msg.AddItem(Item);
        }
        public override void Add(NetworkMessage message)
        {
            message.AddByte(PacketType);

            message.AddByte((byte)Slot);
            message.AddItem(Item);
        }
        public override void Add(NetworkMessage message)
        {
            var addInventoryItem = new Action <Slot>(slot =>
            {
                if (Player.Inventory[(byte)slot] == null)
                {
                    message.AddByte((byte)GameOutgoingPacketType.InventoryEmpty);
                    message.AddByte((byte)slot);
                }
                else
                {
                    message.AddByte((byte)GameOutgoingPacketType.InventoryItem);
                    message.AddByte((byte)slot);
                    message.AddItem(Player.Inventory[(byte)slot]);
                }
            });

            addInventoryItem(Slot.Head);
            addInventoryItem(Slot.Necklace);
            addInventoryItem(Slot.Backpack);
            addInventoryItem(Slot.Body);
            addInventoryItem(Slot.Right);
            addInventoryItem(Slot.Left);
            addInventoryItem(Slot.Legs);
            addInventoryItem(Slot.Feet);
            addInventoryItem(Slot.Ring);
            addInventoryItem(Slot.Ammo);
        }
        public override void ToNetworkMessage(NetworkMessage msg)
        {
            msg.AddByte((byte)Type);
            msg.AddByte(Slot);

            msg.AddItem(Item);
        }
Exemple #6
0
        public override void Add(NetworkMessage message)
        {
            message.AddByte(PacketType);

            message.AddLocation(Location);
            message.AddItem(Item);
        }
        public override void Add(NetworkMessage message)
        {
            message.AddByte(PacketType);

            message.AddByte(ContainerId);
            message.AddItem(Item);
        }
        public override void ToNetworkMessage(NetworkMessage msg)
        {
            msg.AddByte((byte)Type);

            msg.AddString(Name);
            msg.AddByte((byte)Items.Count);

            foreach (Objects.Item i in Items)
            {
                msg.AddItem(i);
            }
        }
        public static void Add
        (
            NetworkMessage message,
            byte containerIndex,
            Item item
        )
        {
            message.AddByte((byte)ServerPacketType.ContainerAddItem);

            message.AddByte(containerIndex);
            message.AddItem(item);
        }
        public override void ToNetworkMessage(NetworkMessage msg)
        {
            msg.AddByte((byte)Type);

            msg.AddString(Name);
            msg.AddByte((byte)Items.Count);

            foreach (Objects.Item i in Items)
            {
                msg.AddItem(i);
            }
        }
Exemple #11
0
        public static void Add
        (
            NetworkMessage message,
            Location location,
            byte stackPosition,
            Item item
        )
        {
            message.AddByte((byte)ServerPacketType.TileAddThing);

            message.AddLocation(location);
            message.AddByte(stackPosition);
            message.AddItem(item);
        }
Exemple #12
0
        public override void Add(NetworkMessage message)
        {
            message.AddByte(PacketType);

            message.AddByte(ContainerId);
            message.AddUInt16(ClientItemId);
            message.AddString(Name);
            message.AddByte(Volume);
            message.AddByte(Convert.ToByte(HasParent ? 0x01 : 0x00));
            message.AddByte(Convert.ToByte(Contents.Count));

            foreach (var item in Contents.Reverse())
            {
                message.AddItem(item);
            }
        }
        public override void ToNetworkMessage(NetworkMessage msg)
        {
            msg.AddByte((byte)Type);

            msg.AddByte(Id);
            msg.AddUInt16(ItemId);
            msg.AddString(Name);
            msg.AddByte(Capacity);
            msg.AddByte(HasParent);
            msg.AddByte((byte)Items.Count);


            foreach (Objects.Item i in Items)
            {
                msg.AddItem(i);
            }
        }
        public override void ToNetworkMessage(NetworkMessage msg)
        {
            msg.AddByte((byte)Type);

            msg.AddByte(Id);
            msg.AddUInt16(ItemId);
            msg.AddString(Name);
            msg.AddByte(Capacity);
            msg.AddByte(HasParent);
            msg.AddByte((byte)Items.Count);


            foreach (Objects.Item i in Items)
            {
                msg.AddItem(i);
            }
        }
        public static void Add
        (
            NetworkMessage message,
            byte containerId,
            ushort containerSpriteId,
            string containerName,
            byte volume,
            bool hasParent,
            IEnumerable <Item> items
        )
        {
            message.AddByte((byte)ServerPacketType.ContainerOpen);

            message.AddByte(containerId);
            message.AddUInt16(containerSpriteId);
            message.AddString(containerName);
            message.AddByte(volume);
            message.AddByte(Convert.ToByte(hasParent));
            message.AddByte((byte)items.Count());
            foreach (Item item in items)
            {
                message.AddItem(item);
            }
        }
Exemple #16
0
 public static void Add(NetworkMessage message, SlotType slot, Item item)
 {
     message.AddByte((byte)ServerPacketType.InventorySetSlot);
     message.AddByte((byte)slot);
     message.AddItem(item);
 }