Exemplo n.º 1
0
        public static IDictionary <string, object> Serialize(Area area)
        {
            var data = EntitySerializer.Serialize(area);

            data.Add("Rooms", area.Rooms.Select(RoomManager.Serialize));
            return(data);
        }
Exemplo n.º 2
0
        public static IDictionary <string, object> Serialize(Room room)
        {
            var data = EntitySerializer.Serialize(room);

            data.Add("Description", room.Description);
            data.Add("Exits", ExitSet.Serialize(room._exits));
            if (room.Resets != null)
            {
                data.Add("Resets", RoomReset.Serialize(room.Resets));
            }

            return(data);
        }
Exemplo n.º 3
0
        public static IDictionary <string, object> Serialize(Character character)
        {
            var data = EntitySerializer.Serialize(character)
                       .AddIf("Inventory", character.Inventory, character.Inventory.Count > 0)
                       .AddIf("Equipment", character.Eq, character.Eq.Count > 0)

                       .AddIf("LoginAt", character.RoomId, character.RoomId != null)
                       .AddIf("RespawnAt", character.RespawnAtId, character.RespawnAtId != null)

                       .AddIf("Data", character.Data, character.Data != null && character.Data.Keys.Count > 0);

            data.Add("Stats", character.Stats.Serialize());

            return(data);
        }
Exemplo n.º 4
0
        public static IDictionary <string, object> Serialize(Item item)
        {
            var data = EntitySerializer.Serialize(item)
                       .AddEx("WearLoc", item.WearLoc)
                       .AddEx("Flags", item.Flags)
                       .AddIf("Stack", item.Stack, item.Stack != null)
                       .AddEx("Cost", item.Cost);

            if (item.Stats != null)
            {
                data.Add("Stats", item.Stats.Serialize());
            }
            if (item.Weapon != null)
            {
                data.Add("Weapon", item.Weapon.Serialize());
            }
            return(data);
        }