示例#1
0
文件: Hues.cs 项目: Bryweyh/OpenUO-1
        public Hues(InstallLocation install)
        {
            string path = install.GetPath("hues.mul");
            int index = 0;

            _hues = new Hue[3000];

            if (path != null)
            {
                using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    BinaryReader bin = new BinaryReader(fs);

                    int blockCount = (int)fs.Length / 708;

                    if (blockCount > 375)
                        blockCount = 375;

                    for (int i = 0; i < blockCount; ++i)
                    {
                        bin.ReadInt32();

                        for (int j = 0; j < 8; ++j, ++index)
                            _hues[index] = new Hue(index, bin);
                    }
                }
            }

            for (; index < 3000; ++index)
                _hues[index] = new Hue(index);
        }
示例#2
0
        protected AdapterFactoryBase(InstallLocation install, IContainer container)
        {
            Guard.AssertIsNotNull(install, "install");
            Guard.AssertIsNotNull(container, "container");

            _container = container;
            _install   = install;
        }
示例#3
0
        public TileData(InstallLocation install)
        {
            var filePath = install.GetPath("tiledata.mul");

            if (!string.IsNullOrEmpty(filePath))
            {
                using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    var x64 = fs.Length >= 3188736;
                    var bin = new BinaryReader(fs);

                    m_LandData = new LandData[0x4000];

                    for (var i = 0; i < 0x4000; ++i)
                    {
                        if ((i & 0x1F) == 0)
                        {
                            bin.ReadInt32(); // header
                        }

                        var flags = x64 ? (TileFlag)bin.ReadInt64() : (TileFlag)bin.ReadInt32();
                        bin.ReadInt16(); // skip 2 bytes -- textureID

                        m_LandData[i] = new LandData(ReadNameString(bin), flags);
                    }

                    m_ItemData    = new ItemData[0x4000];
                    m_HeightTable = new int[0x4000];

                    for (var i = 0; i < 0x4000; ++i)
                    {
                        if ((i & 0x1F) == 0)
                        {
                            bin.ReadInt32(); // header
                        }

                        var flags   = x64 ? (TileFlag)bin.ReadInt64() : (TileFlag)bin.ReadInt32();
                        int weight  = bin.ReadByte();
                        int quality = bin.ReadByte();
                        bin.ReadInt16();
                        bin.ReadByte();
                        int quantity = bin.ReadByte();
                        int anim     = bin.ReadInt16();
                        bin.ReadInt16();
                        bin.ReadByte();
                        int value  = bin.ReadByte();
                        int height = bin.ReadByte();

                        m_ItemData[i]    = new ItemData(ReadNameString(bin), flags, weight, quality, quantity, value, height, anim);
                        m_HeightTable[i] = height;
                    }
                }
            }
            else
            {
                throw new FileNotFoundException();
            }
        }
示例#4
0
        public TileData(InstallLocation install)
        {
            string filePath = install.GetPath("tiledata.mul");

            if (!string.IsNullOrEmpty(filePath))
            {
                using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    BinaryReader bin = new BinaryReader(fs);

                    m_LandData = new LandData[0x4000];

                    for (int i = 0; i < 0x4000; ++i)
                    {
                        if ((i & 0x1F) == 0)
                        {
                            bin.ReadInt32(); // header
                        }

                        TileFlag flags = (TileFlag)bin.ReadInt32();
                        bin.ReadInt16(); // skip 2 bytes -- textureID

                        m_LandData[i] = new LandData(ReadNameString(bin), flags);
                    }

                    m_ItemData = new ItemData[0x4000];
                    m_HeightTable = new int[0x4000];

                    for (int i = 0; i < 0x4000; ++i)
                    {
                        if ((i & 0x1F) == 0)
                        {
                            bin.ReadInt32(); // header
                        }

                        TileFlag flags = (TileFlag)bin.ReadInt32();
                        int weight = bin.ReadByte();
                        int quality = bin.ReadByte();
                        bin.ReadInt16();
                        bin.ReadByte();
                        int quantity = bin.ReadByte();
                        int anim = bin.ReadInt16();
                        bin.ReadInt16();
                        bin.ReadByte();
                        int value = bin.ReadByte();
                        int height = bin.ReadByte();

                        m_ItemData[i] = new ItemData(ReadNameString(bin), flags, weight, quality, quantity, value, height, anim);
                        m_HeightTable[i] = height;
                    }
                }
            }
            else
            {
                throw new FileNotFoundException();
            }
        }
示例#5
0
        public TileMatrix(InstallLocation install, int fileIndex, int mapID, int width, int height)
        {
            _width       = width;
            _height      = height;
            _blockWidth  = width >> 3;
            _blockHeight = height >> 3;

            if (fileIndex != 0x7F)
            {
                var mapPath = install.GetPath("map{0}.mul", fileIndex);

                if (File.Exists(mapPath))
                {
                    _map = new FileStream(mapPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                }
                else
                {
                    mapPath = install.GetPath("map{0}LegacyMUL.uop", fileIndex);

                    if (File.Exists(mapPath))
                    {
                        _map      = new FileStream(mapPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                        _mapIndex = new UOPIndex(_map);
                    }
                }

                var indexPath = install.GetPath("staidx{0}.mul", fileIndex);

                if (File.Exists(indexPath))
                {
                    _fileIndex = new FileStream(indexPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                    _reader    = new BinaryReader(_fileIndex);
                }

                var staticsPath = install.GetPath("statics{0}.mul", fileIndex);

                if (File.Exists(staticsPath))
                {
                    _staticsStream = new FileStream(staticsPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                }
            }

            _emptyStaticBlock = new HuedTile[8][][];

            for (var i = 0; i < 8; ++i)
            {
                _emptyStaticBlock[i] = new HuedTile[8][];

                for (var j = 0; j < 8; ++j)
                {
                    _emptyStaticBlock[i][j] = new HuedTile[0];
                }
            }

            _invalidLandBlock = new Tile[196];
        }
示例#6
0
        public World(IoCContainer container)
        {
            IConfiguration config = container.Resolve<IConfiguration>();

            _container = container;
            _install = config.GetValue<InstallLocation>(ConfigSections.Client, ConfigKeys.InstallLocation);

            _camera = new Camera2D();
            _facets = new List<Facet>();
        }
 public MainWindow()
 {
     InitializeComponent();
     Container = new IoCContainer();
     InstallLocation = InstallationLocator.Locate().First();
     SDK = new TilesCategorySDKModule(InstallLocation);
     Container.RegisterModule<UltimaSDKCoreModule>();
     Container.RegisterModule<OpenUO.Ultima.PresentationFramework.UltimaSDKImageSourceModule>();
     FactoryArt = new ArtworkFactory(InstallLocation, Container);
     FactoryTex = new TexmapFactory(InstallLocation,Container);
     DataContext = SDK;
 }
示例#8
0
        public TileMatrix(InstallLocation install, int fileIndex, int mapID, int width, int height)
        {
            _install     = install;
            _width       = width;
            _height      = height;
            _blockWidth  = width >> 3;
            _blockHeight = height >> 3;

            if (fileIndex != 0x7F)
            {
                string mapPath     = install.GetPath("map{0}.mul", fileIndex);
                string indexPath   = install.GetPath("staidx{0}.mul", fileIndex);
                string staticsPath = install.GetPath("statics{0}.mul", fileIndex);

                if (!File.Exists(mapPath))
                {
                    mapPath = install.GetPath("map{0}LegacyMUL.uop", fileIndex);
                }

                _map           = new FileStream(mapPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                _fileIndex     = new FileStream(indexPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                _staticsStream = new FileStream(staticsPath, FileMode.Open, FileAccess.Read, FileShare.Read);

                _reader = new BinaryReader(_fileIndex);
            }

            _emptyStaticBlock = new HuedTile[8][][];

            for (int i = 0; i < 8; ++i)
            {
                _emptyStaticBlock[i] = new HuedTile[8][];

                for (int j = 0; j < 8; ++j)
                {
                    _emptyStaticBlock[i][j] = new HuedTile[0];
                }
            }

            _invalidLandBlock = new Tile[196];

            _landTiles   = new Tile[_blockWidth][][];
            _staticTiles = new HuedTile[_blockWidth][][][][];

            _patch = new TileMatrixPatch(this, install, mapID);

            /*for ( int i = 0; i < m_BlockWidth; ++i )
             * {
             *  m_LandTiles[i] = new Tile[m_BlockHeight][];
             *  m_StaticTiles[i] = new Tile[m_BlockHeight][][][];
             * }*/
        }
示例#9
0
        public static void Init()
        {
            Container = new IoCContainer();
            if (InstallLocation == null)
                InstallLocation = InstallationLocator.Locate().FirstOrDefault();
            if (InstallLocation != null)
            {
                SdkTiles = new TilesCategorySDKModule(InstallLocation);
                SdkTiles.Populate();
            }
            if (!innerInit)
                InnerInit();

        }
示例#10
0
        public TileMatrix(InstallLocation install, int fileIndex, int mapID, int width, int height)
        {
            _install = install;
            _width = width;
            _height = height;
            _blockWidth = width >> 3;
            _blockHeight = height >> 3;

            if (fileIndex != 0x7F)
            {
                string mapPath = install.GetPath("map{0}.mul", fileIndex);
                string indexPath = install.GetPath("staidx{0}.mul", fileIndex);
                string staticsPath = install.GetPath("statics{0}.mul", fileIndex);   

                if (!File.Exists(mapPath))
                    mapPath = install.GetPath("map{0}LegacyMUL.uop", fileIndex);
                    
                _map = new FileStream(mapPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                _fileIndex = new FileStream(indexPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                _staticsStream = new FileStream(staticsPath, FileMode.Open, FileAccess.Read, FileShare.Read); 

                _reader = new BinaryReader(_fileIndex);   
            }

            _emptyStaticBlock = new HuedTile[8][][];

            for (int i = 0; i < 8; ++i)
            {
                _emptyStaticBlock[i] = new HuedTile[8][];

                for (int j = 0; j < 8; ++j)
                {
                    _emptyStaticBlock[i][j] = new HuedTile[0];
                }
            }

            _invalidLandBlock = new Tile[196];

            _landTiles = new Tile[_blockWidth][][];
            _staticTiles = new HuedTile[_blockWidth][][][][];

            _patch = new TileMatrixPatch(this, install, mapID);

            /*for ( int i = 0; i < m_BlockWidth; ++i )
            {
                m_LandTiles[i] = new Tile[m_BlockHeight][];
                m_StaticTiles[i] = new Tile[m_BlockHeight][][][];
            }*/
        }
        public TileMatrixPatch(TileMatrix matrix, InstallLocation install, int index)
        {
            string mapDataPath = install.GetPath("mapdif{0}.mul", index);
            string mapIndexPath = install.GetPath("mapdifl{0}.mul", index);

            if (File.Exists(mapDataPath) && File.Exists(mapIndexPath))
                _landBlocks = PatchLand(matrix, mapDataPath, mapIndexPath);

            string staDataPath = install.GetPath("stadif{0}.mul", index);
            string staIndexPath = install.GetPath("stadifl{0}.mul", index);
            string staLookupPath = install.GetPath("stadifi{0}.mul", index);

            if (File.Exists(staDataPath) && File.Exists(staIndexPath) && File.Exists(staLookupPath))
                _staticBlocks = PatchStatics(matrix, staDataPath, staIndexPath, staLookupPath);
        }
示例#12
0
        public TileMatrixPatch(TileMatrix matrix, InstallLocation install, int index)
        {
            string mapDataPath  = install.GetPath("mapdif{0}.mul", index);
            string mapIndexPath = install.GetPath("mapdifl{0}.mul", index);

            if (File.Exists(mapDataPath) && File.Exists(mapIndexPath))
            {
                _landBlocks = PatchLand(matrix, mapDataPath, mapIndexPath);
            }

            string staDataPath   = install.GetPath("stadif{0}.mul", index);
            string staIndexPath  = install.GetPath("stadifl{0}.mul", index);
            string staLookupPath = install.GetPath("stadifi{0}.mul", index);

            if (File.Exists(staDataPath) && File.Exists(staIndexPath) && File.Exists(staLookupPath))
            {
                _staticBlocks = PatchStatics(matrix, staDataPath, staIndexPath, staLookupPath);
            }
        }
        public TilesCategorySDKModule(InstallLocation install)
        {
            
            Install = install;
            Factories = new List<Factory>();
            Supp = new SuppInfo(install);
            Supp.Populate();
            Walls = new Walls(install);
            Misc = new Misc(install);
            Roofs = new Roofs(install);
            Floors = new Floors(install);
            Factories.Add(Walls);
            Factories.Add(Misc);
            Factories.Add(Roofs);
            Factories.Add(Floors);
            Categories = new List<IList<TileCategory>>();
            TileData = new TileData(install);
            CheckFromTxt = true;
            TmpStyleList = new List<TileStyle>();
            TmpTileList = new List<Tile>();


        }
示例#14
0
文件: Hues.cs 项目: NaphalAXT/OpenUO
        public Hues(InstallLocation install)
        {
            string path  = install.GetPath("hues.mul");
            int    index = 0;

            _hues = new Hue[3000];

            if (path != null)
            {
                using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    BinaryReader bin = new BinaryReader(fs);

                    int blockCount = (int)fs.Length / 708;

                    if (blockCount > 375)
                    {
                        blockCount = 375;
                    }

                    for (int i = 0; i < blockCount; ++i)
                    {
                        bin.ReadInt32();

                        for (int j = 0; j < 8; ++j, ++index)
                        {
                            _hues[index] = new Hue(index, bin);
                        }
                    }
                }
            }

            for (; index < 3000; ++index)
            {
                _hues[index] = new Hue(index);
            }
        }
示例#15
0
 public RadarColors(InstallLocation install)
 {
     _install = install;
     Load();
 }
示例#16
0
 public SkillsFactory(InstallLocation install, IContainer container)
     : base(install, container)
 {
 }
示例#17
0
 public Factory(InstallLocation location)
 {
     Install = location;
     _categories = new List<TileCategory>();
 }
示例#18
0
 public GumpFactory(InstallLocation install, IContainer container)
     : base(install, container)
 {
 }
示例#19
0
 public SoundFactory(InstallLocation install, IoCContainer container)
     : base(install, container)
 {
 }
示例#20
0
 public Teleprts(InstallLocation location) : base(location)
 {
 }
示例#21
0
 public RadarColors(InstallLocation install)
 {
     _install = install;
     Load();
 }
示例#22
0
 public Walls(InstallLocation location) : base(location)
 {
 }
示例#23
0
 public SuppInfo(InstallLocation location)
 {
     _location = location;
     Positions = new Dictionary<int, PositionTiles>();
 }
示例#24
0
 public Misc(InstallLocation location) : base(location)
 {
 }
示例#25
0
 public TexmapFactory(InstallLocation install, IoCContainer container)
     : base(install, container)
 {
 }
示例#26
0
 public Tile256(InstallLocation location) : base(location)
 {
 }
示例#27
0
 public Roofs(InstallLocation location) : base(location)
 {
 }
示例#28
0
 public ASCIIFontFactory(InstallLocation install, IContainer container)
     : base(install, container)
 {
 }
示例#29
0
 public ClilocFactory(InstallLocation install, IoCContainer container)
     : base(install, container)
 {
 }
示例#30
0
 public Doors(InstallLocation location) : base(location)
 {
 }
示例#31
0
 public Facet(InstallLocation install, World world, int fileIndex, int mapID, int width, int height)
 {
     _world = world;
     _map = new Map(install, fileIndex, mapID, width, height);
 }
示例#32
0
 public AnimationDataFactory(InstallLocation install, IContainer container)
     : base(install, container)
 {
 }
示例#33
0
 public ArtworkFactory(InstallLocation install, IContainer container)
     : base(install, container)
 {
 }
示例#34
0
 public UnicodeFontFactory(InstallLocation install, IContainer container)
     : base(install, container)
 {
 }
        private void buttonLoadFolder_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(textBoxFolder.Text))
            {
                try
                {
                    InstallLocation = new InstallLocation(textBoxFolder.Text);
                    SDK = new TilesCategorySDKModule(InstallLocation);
                    Container = new IoCContainer();
                    Container.RegisterModule<UltimaSDKCoreModule>();
                    Container.RegisterModule<OpenUO.Ultima.PresentationFramework.UltimaSDKImageSourceModule>();
                    FactoryArt = new ArtworkFactory(InstallLocation, Container);
                    FactoryTex = new TexmapFactory(InstallLocation,Container);
                }
                catch (Exception)
                {

                }

            }
        }
示例#36
0
 public Tile1024(InstallLocation location) : base(location)
 {
 }
示例#37
0
        public override void Start()
        {
            base.Start();

            var dataDirectory = Settings.UltimaOnline.DataDirectory;

            if (string.IsNullOrEmpty(dataDirectory) || !Directory.Exists(dataDirectory))
            {
                using (var form = new SelectInstallForm("CoreAdapterTests"))
                {
                    if (form.ShowDialog() == DialogResult.Cancel)
                    {
                        //TODO: End game
                    }

                    var version = form.SelectedInstall.Version;

                    Settings.UltimaOnline.DataDirectory = dataDirectory = form.SelectedInstall.Directory;
                    Settings.UltimaOnline.ClientVersion = version.ToString();
                }
            }

            var install = new InstallLocation(dataDirectory);

            _spriteBatch = new SpriteBatch(GraphicsDevice) {VirtualResolution = new Vector3(_virtualResolution, 1)};

            _artworkFactory = new ArtworkFactory(install, _container);
            _texmapFactory = new TexmapFactory(install, _container);
            _animationFactory = new AnimationFactory(install, _container);
            _gumpFactory = new GumpFactory(install, _container);
            _asciiFontFactory = new ASCIIFontFactory(install, _container);
            _unicodeFontFactory = new UnicodeFontFactory(install, _container);

            // register the renderer in the pipeline
            var scene = SceneSystem.SceneInstance.Scene;
            var compositor = ((SceneGraphicsCompositorLayers) scene.Settings.GraphicsCompositor);

            compositor.Master.Renderers.Add(new ClearRenderFrameRenderer());
            compositor.Master.Renderers.Add(new SceneDelegateRenderer(RenderQuad));
        }