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); }
protected AdapterFactoryBase(InstallLocation install, IContainer container) { Guard.AssertIsNotNull(install, "install"); Guard.AssertIsNotNull(container, "container"); _container = container; _install = install; }
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(); } }
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(); } }
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]; }
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; }
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 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(); }
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); }
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>(); }
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); } }
public RadarColors(InstallLocation install) { _install = install; Load(); }
public SkillsFactory(InstallLocation install, IContainer container) : base(install, container) { }
public Factory(InstallLocation location) { Install = location; _categories = new List<TileCategory>(); }
public GumpFactory(InstallLocation install, IContainer container) : base(install, container) { }
public SoundFactory(InstallLocation install, IoCContainer container) : base(install, container) { }
public Teleprts(InstallLocation location) : base(location) { }
public Walls(InstallLocation location) : base(location) { }
public SuppInfo(InstallLocation location) { _location = location; Positions = new Dictionary<int, PositionTiles>(); }
public Misc(InstallLocation location) : base(location) { }
public TexmapFactory(InstallLocation install, IoCContainer container) : base(install, container) { }
public Tile256(InstallLocation location) : base(location) { }
public Roofs(InstallLocation location) : base(location) { }
public ASCIIFontFactory(InstallLocation install, IContainer container) : base(install, container) { }
public ClilocFactory(InstallLocation install, IoCContainer container) : base(install, container) { }
public Doors(InstallLocation location) : base(location) { }
public Facet(InstallLocation install, World world, int fileIndex, int mapID, int width, int height) { _world = world; _map = new Map(install, fileIndex, mapID, width, height); }
public AnimationDataFactory(InstallLocation install, IContainer container) : base(install, container) { }
public ArtworkFactory(InstallLocation install, IContainer container) : base(install, container) { }
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) { } } }
public Tile1024(InstallLocation location) : base(location) { }
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)); }