Esempio n. 1
0
        private static void WriteStairTiles(StreamWriter w, DungeonParser dat)
        {
            var lst = new List <string>();

            for (int i = 0; i < dat.Data.Maps.Count; i++)
            {
                for (int x = 0; x < dat.Data.Maps[i].Width; x++)
                {
                    for (int y = 0; y < dat.Data.Maps[i].Height; y++)
                    {
                        var tile = dat.Data.Maps[i][dat.Data.Maps[i].OffsetX + x, dat.Data.Maps[i].OffsetY + y];
                        if (tile?.GetType() == typeof(StairsTileData))
                        {
                            lst.Add($"AbsolutePositon: {x + dat.Data.Maps[i].OffsetX} {y + dat.Data.Maps[i].OffsetY}; Level: {i};  orientation: {(tile as StairsTileData).Orientation}; vertical : {(tile as StairsTileData).Direction};");
                        }
                    }
                }
            }

            lst.Sort();

            foreach (var s in lst)
            {
                w.WriteLine(s);
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var dat = new DungeonParser();
            dat.Parse();

            a(dat.Data.Maps[1], dat.Data);

            using (var w = new StreamWriter("output.txt"))
            {

                //var stairTiles = (from i in dat.Data.Maps.SelectMany(x => x.Tiles) where i.GetType() == typeof(StairsTile) select i).SelectMany(x => x.GetItems(dat.Data));


                //var q = from j in stairTiles

                //        where j.GetType() == typeof(Actuator) //&& (j as Actuator).AcutorType == 5/*stair actuator*/
                //        select new { Action = ((Actuator)j).Action, Position = ((Actuator)j).ActionType.ToString() };

                //foreach (var k in from i in dat.Data.ObjectIDs
                //                  where i.Category == ObjectCategory.Actuators && ((Actuator)i.GetObject(dat.Data)).AcutorType == 5
                //                  select ((RmtTrg)((Actuator)i.GetObject(dat.Data)).ActionType).Position.ToString() + " " +
                //                  dat.Data.Actuators.IndexOf((Actuator)i.GetObject(dat.Data)))

                //    w.WriteLine(k);


                //var stairAcutorsIDs = (from i in new int[] { 55, 166, 402, 166, 127 }
                //                       select ((((0 ^ (int)TilePosition.North_TopLeft) << 4) ^ (int)ObjectCategory.Actuators) << 10) ^ i).ToArray();
                WriteActuators(w, dat);
                WriteStairTiles(w, dat);
                WriteMapsTiles(w, dat);
            }
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            var dat = new DungeonParser();

            dat.Parse();

            a(dat.Data.Maps[1], dat.Data);

            using (var w = new StreamWriter("output.txt"))
            {
                //var stairTiles = (from i in dat.Data.Maps.SelectMany(x => x.Tiles) where i.GetType() == typeof(StairsTile) select i).SelectMany(x => x.GetItems(dat.Data));


                //var q = from j in stairTiles

                //        where j.GetType() == typeof(Actuator) //&& (j as Actuator).AcutorType == 5/*stair actuator*/
                //        select new { Action = ((Actuator)j).Action, Position = ((Actuator)j).ActionType.ToString() };

                //foreach (var k in from i in dat.Data.ObjectIDs
                //                  where i.Category == ObjectCategory.Actuators && ((Actuator)i.GetObject(dat.Data)).AcutorType == 5
                //                  select ((RmtTrg)((Actuator)i.GetObject(dat.Data)).ActionType).Position.ToString() + " " +
                //                  dat.Data.Actuators.IndexOf((Actuator)i.GetObject(dat.Data)))

                //    w.WriteLine(k);


                //var stairAcutorsIDs = (from i in new int[] { 55, 166, 402, 166, 127 }
                //                       select ((((0 ^ (int)TilePosition.North_TopLeft) << 4) ^ (int)ObjectCategory.Actuators) << 10) ^ i).ToArray();
                WriteActuators(w, dat);
                WriteStairTiles(w, dat);
                WriteMapsTiles(w, dat);
            }
        }
Esempio n. 4
0
        private static void WriteMapsTiles(StreamWriter w, DungeonParser dat)
        {
            int mc = 0;

            foreach (var m in dat.Data.Maps)
            {
                w.WriteLine(mc++);
                w.WriteLine($"{m.OffsetY} {m.OffsetX}");
                for (int i = 0; i < m.Tiles.Count; i++)
                {
                    if (i % m.Height == 0)
                    {
                        w.WriteLine();
                        for (int s = 0; s < m.OffsetY; s++)
                        {
                            w.Write(" ");
                        }
                    }



                    var letter = m.Tiles[i].GetType().ToString().Split(new char[] { '.' })[1].Substring(0, 1);

                    switch (letter)
                    {
                    case "F":
                        w.Write(" ");

                        break;

                    case "W":
                        w.Write("■");
                        break;

                    default:
                        w.Write(letter);
                        break;
                    }
                }

                w.WriteLine();
            }
        }
Esempio n. 5
0
        private static void WriteActuators(StreamWriter w, DungeonParser dat)
        {
            bool line = false;

            for (int i = 0; i < dat.Data.Maps.Count; i++)
            {
                for (int x = 0; x < dat.Data.Maps[i].Width; x++)
                {
                    for (int y = 0; y < dat.Data.Maps[i].Height; y++)
                    {
                        var tile = dat.Data.Maps[i][dat.Data.Maps[i].OffsetX + x, dat.Data.Maps[i].OffsetY + y];

                        if (line)
                        {
                            w.WriteLine("0000000000000000000000000000000000000000000000000000000000");
                            line = false;
                        }

                        //var door = tile as DoorTileData;
                        //if (door != null)
                        //{
                        //    w.WriteLine($"state:{door.State} {x + dat.Data.Maps[i].OffsetX} {y + dat.Data.Maps[i].OffsetY}; Level: {i}");
                        //}

                        foreach (ActuatorItemData a in tile.GetItems(dat.Data).OfType <ActuatorItemData>().Where(xz => /*xz.Action == ActionType.Hold &&*/ !xz.IsLocal &&
                                                                                                                 dat.Data.Maps[i][dat.Data.Maps[i].OffsetX + ((RemoteTarget)xz.ActionLocation).Position.Position.X, dat.Data.Maps[i].OffsetY + ((RemoteTarget)xz.ActionLocation).Position.Position.Y] is PitTileData))
                        {
                            //if (tile.GetType() != typeof(WallTile) || !(a.AcutorType == 5 || a.AcutorType == 6 ) )
                            //    continue;

                            w.WriteLine($"AbsolutePositon: {x + dat.Data.Maps[i].OffsetX} {y + dat.Data.Maps[i].OffsetY}; Level: {i}; is wall {tile is WallTileData} ");
                            ObjectDumper.Write(a, 2, w);
                            w.WriteLine();
                            line = true;
                        }
                    }
                }
            }
        }
Esempio n. 6
0
        private static void WriteActuators(StreamWriter w, DungeonParser dat)
        {
            bool line = false;
            for (int i = 0; i < dat.Data.Maps.Count; i++)
            {
                for (int x = 0; x < dat.Data.Maps[i].Width; x++)
                {
                    for (int y = 0; y < dat.Data.Maps[i].Height; y++)
                    {
                        var tile = dat.Data.Maps[i][dat.Data.Maps[i].OffsetX + x, dat.Data.Maps[i].OffsetY + y];

                        if (line)
                        {
                            w.WriteLine("0000000000000000000000000000000000000000000000000000000000");
                            line = false;
                        }

                        //var door = tile as DoorTileData;
                        //if (door != null)
                        //{
                        //    w.WriteLine($"state:{door.State} {x + dat.Data.Maps[i].OffsetX} {y + dat.Data.Maps[i].OffsetY}; Level: {i}");
                        //}

                        foreach (ActuatorItemData a in tile.GetItems(dat.Data).OfType<ActuatorItemData>().Where(xz => /*xz.Action == ActionType.Hold &&*/ !xz.IsLocal &&
                       dat.Data.Maps[i][dat.Data.Maps[i].OffsetX + ((RemoteTarget)xz.ActionLocation).Position.Position.X, dat.Data.Maps[i].OffsetY + ((RemoteTarget)xz.ActionLocation).Position.Position.Y] is PitTileData))
                        {
                            //if (tile.GetType() != typeof(WallTile) || !(a.AcutorType == 5 || a.AcutorType == 6 ) )
                            //    continue;

                            w.WriteLine($"AbsolutePositon: {x + dat.Data.Maps[i].OffsetX} {y + dat.Data.Maps[i].OffsetY}; Level: {i}; is wall {tile is WallTileData} ");
                            ObjectDumper.Write(a, 2, w);
                            w.WriteLine();
                            line = true;
                        }
                    }
                }
            }
        }
Esempio n. 7
0
        private static void WriteMapsTiles(StreamWriter w, DungeonParser dat)
        {
            int mc = 0;
            foreach (var m in dat.Data.Maps)
            {
                w.WriteLine(mc++);
                w.WriteLine($"{m.OffsetY} {m.OffsetX}");
                for (int i = 0; i < m.Tiles.Count; i++)
                {

                    if (i % m.Height == 0)
                    {
                        w.WriteLine();
                        for (int s = 0; s < m.OffsetY; s++)
                            w.Write(" ");

                    }



                    var letter = m.Tiles[i].GetType().ToString().Split(new char[] { '.' })[1].Substring(0, 1);

                    switch (letter)
                    {
                        case "F":
                            w.Write(" ");

                            break;
                        case "W":
                            w.Write("■");
                            break;
                        default:
                            w.Write(letter);
                            break;
                    }
                }

                w.WriteLine();
            }

        }
Esempio n. 8
0
        private static void WriteStairTiles(StreamWriter w, DungeonParser dat)
        {
            var lst = new List<string>();

            for (int i = 0; i < dat.Data.Maps.Count; i++)
            {
                for (int x = 0; x < dat.Data.Maps[i].Width; x++)
                {
                    for (int y = 0; y < dat.Data.Maps[i].Height; y++)
                    {
                        var tile = dat.Data.Maps[i][dat.Data.Maps[i].OffsetX + x, dat.Data.Maps[i].OffsetY + y];
                        if (tile?.GetType() == typeof(StairsTileData))
                        {
                            lst.Add($"AbsolutePositon: {x + dat.Data.Maps[i].OffsetX} {y + dat.Data.Maps[i].OffsetY}; Level: {i};  orientation: {(tile as StairsTileData).Orientation}; vertical : {(tile as StairsTileData).Direction};");
                        }

                    }
                }
            }

            lst.Sort();

            foreach (var s in lst)
                w.WriteLine(s);

        }
Esempio n. 9
0
        public LegacyMapBuilder()
        {
            var parser = new DungeonParser();
            parser.Parse();
            Data = parser.Data;

            ItemCreator = new LegacyItemCreator(this);

            WeaponFactories = Data.WeaponDescriptors
                .Select(wd =>
                {
                    var itemDescriptor = Data.GetItemDescriptor(ObjectCategory.Weapon, wd.Identifer);
                    return new WeaponItemFactory(wd.Name, wd.Weight, GetAttackFactories(itemDescriptor),
                        ItemCreator.GetStorageTypes(itemDescriptor.CarryLocation),
                        wd.DeltaEnergy, (WeaponClass)wd.Class, wd.KineticEnergy, wd.ShootDamage, wd.Strength);
                })
                .ToArray();

            ClothFactories = Data.ArmorDescriptors
               .Select(wd =>
               {
                   var itemDescriptor = Data.GetItemDescriptor(ObjectCategory.Clothe, wd.Identifer);
                   return new ClothItemFactory(wd.Name, wd.Weight, GetAttackFactories(itemDescriptor)
                       , ItemCreator.GetStorageTypes(itemDescriptor.CarryLocation));
               })
               .ToArray(); ;

            ContainerFactories = Data.ContainerDescriptors
               .Select(wd =>
               {
                   var itemDescriptor = Data.GetItemDescriptor(ObjectCategory.Container, wd.Identifer);
                   return new ContainerItemFactory(wd.Name, wd.Weight, GetAttackFactories(itemDescriptor)
                       , ItemCreator.GetStorageTypes(itemDescriptor.CarryLocation));
               })
               .ToArray();

            ScrollFactories = Data.ScrollDescriptors
               .Select(wd =>
               {
                   var itemDescriptor = Data.GetItemDescriptor(ObjectCategory.Scroll, wd.Identifer);
                   return new ScrollItemFactory(wd.Name, wd.Weight, GetAttackFactories(itemDescriptor)
                       , ItemCreator.GetStorageTypes(itemDescriptor.CarryLocation));
               })
               .ToArray();


            MiscFactories = Data.MiscDescriptors
                .Select(wd =>
                {
                    var itemDescriptor = Data.GetItemDescriptor(ObjectCategory.Miscellenaous, wd.Identifer);
                    return new MiscItemFactory(wd.Name, wd.Weight, GetAttackFactories(itemDescriptor)
                        , ItemCreator.GetStorageTypes(itemDescriptor.CarryLocation));
                })
                .ToArray();

            PotionFactories = Data.PotionDescriptors
                .Select(p =>
                {
                    var itemDescriptor = Data.GetItemDescriptor(ObjectCategory.Potion, p.Identifer);
                    return new PotionItemFactory(p.Name, p.Weight, GetAttackFactories(itemDescriptor)
                        , ItemCreator.GetStorageTypes(itemDescriptor.CarryLocation));
                })
                .ToArray();

        }