├── .gitignore ├── .travis.yml ├── AUTHORS ├── Directory.Build.props ├── LICENSE ├── README.md ├── content └── libwarcraft.svg ├── libwarcraft.Tests ├── Content │ ├── .gitignore │ └── README.md ├── Integration │ └── DBC │ │ ├── BurningCrusade │ │ └── BurningCrusadeDefinitionTests.cs │ │ ├── DBCTestHelper.cs │ │ ├── FieldOrdererTests.cs │ │ ├── IO │ │ └── RecordDeserializationTests.cs │ │ ├── RecordDefinitionTests.cs │ │ ├── Vanilla │ │ └── VanillaDefinitionTests.cs │ │ └── Wrath │ │ └── WrathDefinitionTests.cs ├── Unit │ └── Reflection │ │ └── DBC │ │ ├── DBCDeserializerTests.cs │ │ ├── DBCInspectorTests.cs │ │ ├── FieldOrdererTests.cs │ │ └── TestData │ │ ├── FieldNameLists.cs │ │ ├── MovingFields.cs │ │ ├── RecordValues.cs │ │ ├── TestDBCRecord.cs │ │ ├── TestDBCRecordInvalidFields.cs │ │ ├── TestDBCRecordWithArray.cs │ │ ├── TestDBCRecordWithInvalidArray.cs │ │ └── TestDBCRecordWithVersionedArray.cs ├── libwarcraft.Tests.csproj └── libwarcraft.Tests.csproj.DotSettings ├── libwarcraft.sln ├── libwarcraft.sln.DotSettings ├── libwarcraft ├── ADT │ ├── Chunks │ │ ├── DepthOnlyVertexData.cs │ │ ├── HeightDepthUVVertexData.cs │ │ ├── HeightDepthVertexData.cs │ │ ├── HeightUVVertexData.cs │ │ ├── LiquidVertexData.cs │ │ ├── MapChunkOffsetEntry.cs │ │ ├── ModelPlacementEntry.cs │ │ ├── ModelPlacementFlags.cs │ │ ├── Subchunks │ │ │ ├── DatabaseSoundEmitter.cs │ │ │ ├── LiquidFlags.cs │ │ │ ├── LiquidVertex.cs │ │ │ ├── MapChunkAlphaMaps.cs │ │ │ ├── MapChunkBakedShadows.cs │ │ │ ├── MapChunkFlags.cs │ │ │ ├── MapChunkHeader.cs │ │ │ ├── MapChunkHeightmap.cs │ │ │ ├── MapChunkLiquids.cs │ │ │ ├── MapChunkModelReferences.cs │ │ │ ├── MapChunkSoundEmitters.cs │ │ │ ├── MapChunkTextureLayers.cs │ │ │ ├── MapChunkVertexLighting.cs │ │ │ ├── MapChunkVertexNormals.cs │ │ │ ├── MapChunkVertexShading.cs │ │ │ ├── PlainSoundEmitter.cs │ │ │ ├── SoundEmitter.cs │ │ │ ├── TextureLayerEntry.cs │ │ │ └── TextureLayerFlags.cs │ │ ├── TerrainBoundingBox.cs │ │ ├── TerrainHeader.cs │ │ ├── TerrainHeaderFlags.cs │ │ ├── TerrainLiquid.cs │ │ ├── TerrainLiquidAttributes.cs │ │ ├── TerrainLiquidChunk.cs │ │ ├── TerrainLiquidInstance.cs │ │ ├── TerrainMapChunk.cs │ │ ├── TerrainMapChunkOffsets.cs │ │ ├── TerrainModelIndices.cs │ │ ├── TerrainModelPlacementInfo.cs │ │ ├── TerrainModels.cs │ │ ├── TerrainTextureFlag.cs │ │ ├── TerrainTextureFlags.cs │ │ ├── TerrainTextures.cs │ │ ├── TerrainVersion.cs │ │ ├── TerrainWorldModelObjectIndices.cs │ │ ├── TerrainWorldModelObjectPlacementInfo.cs │ │ ├── TerrainWorldModelObjects.cs │ │ ├── WorldModelObjectFlags.cs │ │ └── WorldModelObjectPlacementEntry.cs │ └── TerrainTile.cs ├── BLP │ ├── BLP.cs │ ├── BLPFormat.cs │ ├── BLPHeader.cs │ ├── BLPPixelFormat.cs │ └── TextureCompressionType.cs ├── BLS │ ├── BLS.cs │ ├── BLSHeader.cs │ ├── ShaderBlock.cs │ ├── ShaderContainerType.cs │ ├── ShaderFlags1.cs │ └── ShaderFlags2.cs ├── Core │ ├── Compression │ │ ├── ADPCM │ │ │ ├── ADPCM.cs │ │ │ └── BitStream.cs │ │ ├── Blast │ │ │ ├── Blast.cs │ │ │ ├── BlastException.cs │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ └── reference-code │ │ │ │ ├── blast.c │ │ │ │ └── blast.h │ │ ├── Compression.cs │ │ ├── CompressionAlgorithms.cs │ │ ├── Huffman │ │ │ ├── LinkedNode.cs │ │ │ └── MpqHuffman.cs │ │ └── Squish │ │ │ ├── Alpha.cs │ │ │ ├── ClusterFit.cs │ │ │ ├── ColourBlock.cs │ │ │ ├── ColourFit.cs │ │ │ ├── ColourSet.cs │ │ │ ├── README │ │ │ ├── SingleColourFit.cs │ │ │ ├── SingleColourFitLookupTables.cs │ │ │ ├── SingleColourLookup.cs │ │ │ ├── SourceBlock.cs │ │ │ ├── SquishCompression.cs │ │ │ ├── SquishOptions.cs │ │ │ ├── SquishOptionsExtensions.cs │ │ │ └── Sym3x3.cs │ ├── DatabaseRecordAttribute.cs │ ├── Exceptions │ │ ├── FileDeletedException.cs │ │ ├── IncompatibleRecordArrayTypeException.cs │ │ ├── InvalidChunkSignatureException.cs │ │ ├── InvalidFieldAttributeException.cs │ │ └── InvalidFileSectorTableException.cs │ ├── Extensions │ │ ├── ExtendedData.cs │ │ ├── ExtendedGraphics.cs │ │ ├── ExtendedIO.cs │ │ ├── ExtendedMath.cs │ │ └── ExtendedModelIO.cs │ ├── FileInfoUtilities.cs │ ├── Hashing │ │ └── Adler32.cs │ ├── Interfaces │ │ ├── IBinarySerializable.cs │ │ ├── IDeferredDeserialize.cs │ │ ├── IFlattenableData.cs │ │ ├── IIFFChunk.cs │ │ ├── IPostLoad.cs │ │ └── IVersionedClass.cs │ ├── Interpolation │ │ ├── IInterpolatable.cs │ │ ├── Interpolation.cs │ │ └── InterpolationType.cs │ ├── Locale │ │ └── LocaleID.cs │ ├── Reflection │ │ └── DBC │ │ │ ├── DBCDeserializer.cs │ │ │ ├── DBCInspector.cs │ │ │ ├── FieldOrderer.cs │ │ │ ├── ForeignKeyInfoAttribute.cs │ │ │ ├── InheritanceChainComparer.cs │ │ │ ├── RecordFieldArrayAttribute.cs │ │ │ ├── RecordFieldAttribute.cs │ │ │ ├── RecordFieldInformation.cs │ │ │ ├── RecordFieldOrderAttribute.cs │ │ │ ├── RecordInformationCache.cs │ │ │ └── RecordInformationIdentifier.cs │ ├── Shading │ │ ├── Blending │ │ │ ├── AlphaDestination.cs │ │ │ ├── AlphaSource.cs │ │ │ ├── BlendingMode.cs │ │ │ ├── BlendingState.cs │ │ │ ├── ColourDestination.cs │ │ │ └── ColourSource.cs │ │ ├── MDX │ │ │ ├── MDXControlShaderType.cs │ │ │ ├── MDXEvaluationShaderType.cs │ │ │ ├── MDXFragmentShaderType.cs │ │ │ ├── MDXShaderGroup.cs │ │ │ ├── MDXShaderHelper.cs │ │ │ └── MDXVertexShaderType.cs │ │ └── WMOFragmentShaderType.cs │ ├── Structures │ │ ├── ARGB.cs │ │ ├── AxisConfiguration.cs │ │ ├── BGRA.cs │ │ ├── Box.cs │ │ ├── IntegerRange.cs │ │ ├── RGB.cs │ │ ├── RGBA.cs │ │ ├── Range.cs │ │ ├── Resolution.cs │ │ ├── Rotator.cs │ │ ├── ShortBox.cs │ │ ├── ShortPlane.cs │ │ ├── Sphere.cs │ │ ├── SplineKey.cs │ │ └── Vector3s.cs │ ├── WarcraftFileType.cs │ └── WarcraftVersion.cs ├── DBC │ ├── DBC.cs │ ├── DBCEnumerator.cs │ ├── DBCHeader.cs │ ├── DatabaseName.cs │ ├── Definitions │ │ ├── AnimationDataRecord.cs │ │ ├── CharHairGeosetsRecord.cs │ │ ├── CharSectionAvailability.cs │ │ ├── CharSectionType.cs │ │ ├── CharSectionsRecord.cs │ │ ├── CreatureDisplayInfoExtraRecord.cs │ │ ├── CreatureDisplayInfoRecord.cs │ │ ├── CreatureModelDataRecord.cs │ │ ├── DBCRecord.cs │ │ ├── LiquidObjectRecord.cs │ │ ├── LiquidType.cs │ │ ├── LiquidTypeRecord.cs │ │ ├── MapRecord.cs │ │ ├── SoundAmbianceRecord.cs │ │ ├── SoundEntriesRecord.cs │ │ ├── SoundProviderPreferencesRecord.cs │ │ ├── SoundType.cs │ │ ├── SpellAttributeA.cs │ │ ├── SpellAttributeB.cs │ │ ├── SpellAttributeC.cs │ │ ├── SpellAttributeD.cs │ │ ├── SpellAttributeE.cs │ │ ├── SpellAttributeF.cs │ │ ├── SpellAttributeG.cs │ │ ├── SpellAttributeH.cs │ │ ├── SpellRecord.cs │ │ ├── WMOAreaTableRecord.cs │ │ ├── WeaponAnimationFlags.cs │ │ ├── ZoneIntroMusicTableRecord.cs │ │ └── ZoneMusicRecord.cs │ ├── IDBC.cs │ ├── IDBCRecord.cs │ └── SpecialFields │ │ ├── ForeignKey.cs │ │ ├── LocalizedStringReference.cs │ │ └── StringReference.cs ├── MDX │ ├── Animation │ │ ├── MDXAnimationEvent.cs │ │ ├── MDXAnimationSequence.cs │ │ ├── MDXAnimationSequenceFlags.cs │ │ ├── MDXBone.cs │ │ ├── MDXBoneFlag.cs │ │ ├── MDXBoneSocket.cs │ │ ├── MDXColourAnimation.cs │ │ ├── MDXPlayableAnimationFlags.cs │ │ ├── MDXPlayableAnimationLookupTableEntry.cs │ │ ├── MDXTextureTransform.cs │ │ ├── MDXTextureWeight.cs │ │ └── MDXTrack.cs │ ├── Data │ │ └── MDXArray.cs │ ├── Gameplay │ │ ├── MDXAttachment.cs │ │ ├── MDXAttachmentType.cs │ │ ├── MDXCamera.cs │ │ └── MDXCameraType.cs │ ├── Geometry │ │ ├── MDXVertex.cs │ │ ├── MDXVertexProperty.cs │ │ └── Skin │ │ │ ├── BaseSkinSectionIdentifier.cs │ │ │ ├── MDXSkin.cs │ │ │ └── MDXSkinSection.cs │ ├── MDX.cs │ ├── ModelObjectFlags.cs │ └── Visual │ │ ├── FX │ │ ├── MDXParticleEmitter.cs │ │ └── MDXRibbonEmitter.cs │ │ ├── MDXLight.cs │ │ ├── MDXLightType.cs │ │ ├── MDXMaterial.cs │ │ ├── MDXRenderBatch.cs │ │ ├── MDXRenderBatchFlags.cs │ │ ├── MDXRenderFlag.cs │ │ ├── MDXTexture.cs │ │ ├── MDXTextureFlags.cs │ │ ├── MDXTextureMappingType.cs │ │ └── MDXTextureType.cs ├── MPQ │ ├── Attributes │ │ ├── AttributeTypes.cs │ │ ├── ExtendedAttributes.cs │ │ └── FileAttributes.cs │ ├── Crypto │ │ ├── HashType.cs │ │ ├── MPQCrypt.cs │ │ ├── SigningStrength.cs │ │ └── WeakPackageSignature.cs │ ├── FileInfo │ │ └── MPQFileInfo.cs │ ├── IPackage.cs │ ├── MPQ.cs │ ├── MPQFormat.cs │ ├── MPQHeader.cs │ ├── MPQShunt.cs │ └── Tables │ │ ├── Block │ │ ├── BlockFlags.cs │ │ ├── BlockTable.cs │ │ └── BlockTableEntry.cs │ │ └── Hash │ │ ├── HashTable.cs │ │ └── HashTableEntry.cs ├── TRS │ └── TRS.cs ├── WDL │ ├── Chunks │ │ ├── WorldLODMapArea.cs │ │ ├── WorldLODMapAreaHoles.cs │ │ └── WorldLODMapAreaOffsets.cs │ └── WorldLOD.cs ├── WDT │ ├── Chunks │ │ ├── AreaInfoEntry.cs │ │ ├── AreaInfoFlags.cs │ │ ├── WorldTableAreaInfo.cs │ │ ├── WorldTableFlags.cs │ │ └── WorldTableHeader.cs │ └── WorldTable.cs ├── WMO │ ├── GroupFile │ │ ├── Chunks │ │ │ ├── BSPNode.cs │ │ │ ├── BSPPlaneType.cs │ │ │ ├── ModelBSPFaceIndices.cs │ │ │ ├── ModelBSPNodes.cs │ │ │ ├── ModelDoodadReferences.cs │ │ │ ├── ModelLightReferences.cs │ │ │ ├── ModelLiquids.cs │ │ │ ├── ModelNormals.cs │ │ │ ├── ModelPolygonMaterials.cs │ │ │ ├── ModelRenderBatches.cs │ │ │ ├── ModelTextureCoordinates.cs │ │ │ ├── ModelVertexColours.cs │ │ │ ├── ModelVertexIndices.cs │ │ │ ├── ModelVertices.cs │ │ │ ├── PolygonMaterial.cs │ │ │ ├── PolygonMaterialFlags.cs │ │ │ └── RenderBatch.cs │ │ ├── GroupFlags.cs │ │ ├── ModelGroup.cs │ │ └── ModelGroupData.cs │ ├── RootFile │ │ ├── Chunks │ │ │ ├── DoodadInstance.cs │ │ │ ├── DoodadInstanceFlags.cs │ │ │ ├── DoodadSet.cs │ │ │ ├── FogDefinition.cs │ │ │ ├── FogFlags.cs │ │ │ ├── FogInstance.cs │ │ │ ├── GroupInformation.cs │ │ │ ├── LightType.cs │ │ │ ├── MaterialFlags.cs │ │ │ ├── ModelConvexPlanes.cs │ │ │ ├── ModelDoodadInstances.cs │ │ │ ├── ModelDoodadPaths.cs │ │ │ ├── ModelDoodadSets.cs │ │ │ ├── ModelFog.cs │ │ │ ├── ModelGroupInformation.cs │ │ │ ├── ModelGroupNames.cs │ │ │ ├── ModelMaterial.cs │ │ │ ├── ModelMaterials.cs │ │ │ ├── ModelPortalReferences.cs │ │ │ ├── ModelPortalVertices.cs │ │ │ ├── ModelPortals.cs │ │ │ ├── ModelSkybox.cs │ │ │ ├── ModelStaticLighting.cs │ │ │ ├── ModelTextures.cs │ │ │ ├── ModelVisibleBlocks.cs │ │ │ ├── ModelVisibleVertices.cs │ │ │ ├── Portal.cs │ │ │ ├── PortalReference.cs │ │ │ ├── StaticLight.cs │ │ │ └── VisibleBlock.cs │ │ ├── ModelRoot.cs │ │ ├── ModelRootHeader.cs │ │ └── RootFlags.cs │ └── WMO.cs ├── libwarcraft.csproj └── libwarcraft.csproj.DotSettings ├── stylecop.json └── stylecop.ruleset /.travis.yml: -------------------------------------------------------------------------------- 1 | language: csharp 2 | solution: libwarcraft.sln 3 | sudo: required 4 | dist: trusty 5 | before_install: 6 | - sudo add-apt-repository -y ppa:jarl-gullberg/blizzard-dev-tools 7 | - sudo apt-get update -q 8 | script: 9 | - msbuild /p:Configuration=Release libwarcraft.sln 10 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Jarl Gullberg 2 | -------------------------------------------------------------------------------- /libwarcraft.Tests/Content/.gitignore: -------------------------------------------------------------------------------- 1 | *.* 2 | !*.md 3 | !.gitignore -------------------------------------------------------------------------------- /libwarcraft.Tests/Content/README.md: -------------------------------------------------------------------------------- 1 | This directory shall contain actual data files that are used to test the compliance of the library. 2 | No files are included, and must be extracted from a legitimately owned and licensed copy of World of Warcraft. 3 | 4 | Each directory in this directory shall map to a member of the `WarcraftVersion` enum. -------------------------------------------------------------------------------- /libwarcraft.Tests/Integration/DBC/BurningCrusade/BurningCrusadeDefinitionTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // BurningCrusadeDefinitionTests.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using NUnit.Framework; 24 | using Warcraft.Core; 25 | 26 | #pragma warning disable 1591, SA1600 27 | 28 | namespace Warcraft.Integration.DBC.BurningCrusade 29 | { 30 | [TestFixture] 31 | public class BurningCrusadeDefinitionTests : RecordDefinitionTests 32 | { 33 | [SetUp] 34 | public override void Setup() 35 | { 36 | Version = WarcraftVersion.BurningCrusade; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /libwarcraft.Tests/Integration/DBC/Vanilla/VanillaDefinitionTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // VanillaDefinitionTests.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using NUnit.Framework; 24 | using Warcraft.Core; 25 | 26 | #pragma warning disable 1591, SA1600 27 | 28 | namespace Warcraft.Integration.DBC.Vanilla 29 | { 30 | [TestFixture] 31 | public class VanillaDefinitionTests : RecordDefinitionTests 32 | { 33 | [SetUp] 34 | public override void Setup() 35 | { 36 | Version = WarcraftVersion.Classic; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /libwarcraft.Tests/Integration/DBC/Wrath/WrathDefinitionTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // WrathDefinitionTests.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using NUnit.Framework; 24 | using Warcraft.Core; 25 | 26 | #pragma warning disable 1591, SA1600 27 | 28 | namespace Warcraft.Integration.DBC.Wrath 29 | { 30 | [TestFixture] 31 | public class WrathDefinitionTests : RecordDefinitionTests 32 | { 33 | [SetUp] 34 | public override void Setup() 35 | { 36 | Version = WarcraftVersion.Wrath; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /libwarcraft.Tests/Unit/Reflection/DBC/TestData/RecordValues.cs: -------------------------------------------------------------------------------- 1 | // 2 | // RecordValues.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | using System.Linq; 25 | 26 | #pragma warning disable 1591, SA1600, SA1649, SA1402 27 | 28 | namespace Warcraft.Unit.Reflection.DBC.TestData 29 | { 30 | public class RecordValues 31 | { 32 | public static readonly byte[] MultiMoveClassicBytes = new[] { 1, 2, 4, 8, 16, 32 }.SelectMany(BitConverter.GetBytes).ToArray(); 33 | public static readonly byte[] MultiMoveBCBytes = new[] { 1, 8, 2, 32, 4, 16 }.SelectMany(BitConverter.GetBytes).ToArray(); 34 | public static readonly byte[] MultiMoveWrathBytes = new[] { 1, 16, 8, 2, 32, 4 }.SelectMany(BitConverter.GetBytes).ToArray(); 35 | 36 | public static readonly byte[] SimpleClassicBytes = new[] { 1, 2, 4, 8 }.SelectMany(BitConverter.GetBytes).ToArray(); 37 | public static readonly byte[] SimpleWrathBytes = new[] { 1, 2, 4, 8, 16 }.SelectMany(BitConverter.GetBytes).ToArray(); 38 | public static readonly byte[] SimpleCataBytes = new[] { 1, 2, 8, 16 }.SelectMany(BitConverter.GetBytes).ToArray(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /libwarcraft.Tests/Unit/Reflection/DBC/TestData/TestDBCRecord.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TestDBCRecord.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using Warcraft.Core; 24 | using Warcraft.Core.Reflection.DBC; 25 | using Warcraft.DBC; 26 | using Warcraft.DBC.Definitions; 27 | using Warcraft.DBC.SpecialFields; 28 | 29 | #pragma warning disable 1591, SA1600, SA1649, SA1402 30 | 31 | namespace Warcraft.Unit.Reflection.DBC.TestData 32 | { 33 | [DatabaseRecord] 34 | public class TestDBCRecord : DBCRecord 35 | { 36 | public uint TestNotRecordField { get; } 37 | 38 | [RecordField(WarcraftVersion.Classic)] 39 | public uint TestSimpleField { get; set; } 40 | 41 | [RecordField(WarcraftVersion.Classic, RemovedIn = WarcraftVersion.Cataclysm)] 42 | public uint TestAddedAndRemovedField { get; set; } 43 | 44 | [RecordField(WarcraftVersion.Classic)] 45 | [ForeignKeyInfo(DatabaseName.AnimationData, nameof(ID))] 46 | public ForeignKey TestForeignKeyField { get; set; } = null!; 47 | 48 | [RecordField(WarcraftVersion.Wrath)] 49 | public StringReference TestNewFieldInWrath { get; set; } = null!; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /libwarcraft.Tests/Unit/Reflection/DBC/TestData/TestDBCRecordInvalidFields.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TestDBCRecordInvalidFields.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using Warcraft.Core; 24 | using Warcraft.Core.Reflection.DBC; 25 | using Warcraft.DBC.Definitions; 26 | using Warcraft.DBC.SpecialFields; 27 | 28 | #pragma warning disable 1591, SA1600, SA1649, SA1402 29 | 30 | namespace Warcraft.Unit.Reflection.DBC.TestData 31 | { 32 | [DatabaseRecord] 33 | public class TestDBCRecordInvalidForeignKeyField : DBCRecord 34 | { 35 | [RecordField(WarcraftVersion.Classic)] 36 | public ForeignKey TestForeignKeyFieldMissingInfo { get; set; } = null!; 37 | 38 | [RecordField(WarcraftVersion.Classic)] 39 | public uint TestFieldWithoutSetter { get; } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /libwarcraft.Tests/Unit/Reflection/DBC/TestData/TestDBCRecordWithArray.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TestDBCRecordWithArray.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.Collections.Generic; 24 | using Warcraft.Core; 25 | using Warcraft.Core.Reflection.DBC; 26 | using Warcraft.DBC.Definitions; 27 | 28 | #pragma warning disable 1591, SA1600, SA1649, SA1402 29 | 30 | namespace Warcraft.Unit.Reflection.DBC.TestData 31 | { 32 | public class TestDBCRecordWithArray : DBCRecord 33 | { 34 | [RecordField(WarcraftVersion.Classic)] 35 | public uint SimpleField { get; set; } 36 | 37 | [RecordFieldArray(WarcraftVersion.Classic, Count = 4)] 38 | public List ArrayField { get; set; } = null!; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /libwarcraft.Tests/Unit/Reflection/DBC/TestData/TestDBCRecordWithInvalidArray.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TestDBCRecordWithInvalidArray.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.Collections.Generic; 24 | using Warcraft.Core; 25 | using Warcraft.Core.Reflection.DBC; 26 | using Warcraft.DBC.Definitions; 27 | 28 | #pragma warning disable 1591, SA1600, SA1649, SA1402 29 | 30 | namespace Warcraft.Unit.Reflection.DBC.TestData 31 | { 32 | public class TestDBCRecordWithInvalidArray : DBCRecord 33 | { 34 | [RecordField(WarcraftVersion.Classic)] 35 | public uint SimpleField { get; set; } 36 | 37 | [RecordFieldArray(WarcraftVersion.Classic, Count = 4)] 38 | public IEnumerable ArrayField { get; set; } = null!; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /libwarcraft.Tests/Unit/Reflection/DBC/TestData/TestDBCRecordWithVersionedArray.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TestDBCRecordWithVersionedArray.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using Warcraft.Core; 24 | using Warcraft.Core.Reflection.DBC; 25 | using Warcraft.DBC.Definitions; 26 | 27 | #pragma warning disable 1591, SA1600, SA1649, SA1402 28 | 29 | namespace Warcraft.Unit.Reflection.DBC.TestData 30 | { 31 | public class TestDBCRecordWithVersionedArray : DBCRecord 32 | { 33 | [RecordFieldArray(WarcraftVersion.Cataclysm, Count = 6)] 34 | [RecordFieldArray(WarcraftVersion.Classic, Count = 2)] 35 | [RecordFieldArray(WarcraftVersion.Wrath, Count = 4)] 36 | public uint[] VersionedArray { get; set; } = null!; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /libwarcraft.Tests/libwarcraft.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Warcraft 4 | netcoreapp3.1 5 | Exe 6 | 7 | 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | PreserveNewest 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /libwarcraft.Tests/libwarcraft.Tests.csproj.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | True 3 | -------------------------------------------------------------------------------- /libwarcraft/ADT/Chunks/LiquidVertexData.cs: -------------------------------------------------------------------------------- 1 | // 2 | // LiquidVertexData.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.ADT.Chunks 24 | { 25 | /// 26 | /// Abstract base class for liquid vertex data. 27 | /// 28 | public abstract class LiquidVertexData 29 | { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /libwarcraft/ADT/Chunks/MapChunkOffsetEntry.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MapChunkOffsetEntry.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.ADT.Chunks 24 | { 25 | /// 26 | /// A struct containing information about the referenced MCNK. 27 | /// 28 | public class MapChunkOffsetEntry 29 | { 30 | /// 31 | /// Gets or sets the absolute offset of the MCNK. 32 | /// 33 | public int MapChunkOffset { get; set; } 34 | 35 | /// 36 | /// Gets or sets the size of the MCNK. 37 | /// 38 | public int MapChunkSize { get; set; } 39 | 40 | /// 41 | /// Gets or sets the flags of the MCNK. This is only set on the client, and is as such always 0. 42 | /// 43 | public int Flags { get; set; } 44 | 45 | /// 46 | /// Gets or sets the loading ID of the MCNK. This is only set on the client, and is as such always 0. 47 | /// 48 | public int AsynchronousLoadingID { get; set; } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /libwarcraft/ADT/Chunks/ModelPlacementFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ModelPlacementFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.ADT.Chunks 26 | { 27 | /// 28 | /// Flags for the model. 29 | /// 30 | [Flags] 31 | public enum ModelPlacementFlags : ushort 32 | { 33 | /// 34 | /// Biodome. Perhaps a skybox? 35 | /// 36 | Biodome = 1, 37 | 38 | /// 39 | /// Possibly used for vegetation and grass. 40 | /// 41 | Shrubbery = 2, 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /libwarcraft/ADT/Chunks/Subchunks/DatabaseSoundEmitter.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DatabaseSoundEmitter.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | using System.Numerics; 25 | using Warcraft.Core.Interfaces; 26 | using Warcraft.DBC.SpecialFields; 27 | 28 | namespace Warcraft.ADT.Chunks.Subchunks 29 | { 30 | /// 31 | /// Represents a sound emitter that gets its data from a database entry. 32 | /// 33 | public class DatabaseSoundEmitter : SoundEmitter, IBinarySerializable 34 | { 35 | /// 36 | /// Gets or sets the ID of the sound entry in the database. 37 | /// 38 | public ForeignKey SoundEntryID { get; set; } = null!; 39 | 40 | /// 41 | /// Gets or sets the position of the emitter. 42 | /// 43 | public Vector3 Position { get; set; } 44 | 45 | /// 46 | /// Gets or sets the size of the emitter. 47 | /// 48 | public Vector3 Size { get; set; } 49 | 50 | /// 51 | public byte[] Serialize() 52 | { 53 | throw new NotImplementedException(); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /libwarcraft/ADT/Chunks/Subchunks/LiquidFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // LiquidFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.ADT.Chunks.Subchunks 26 | { 27 | /// 28 | /// Holds flags for the liquid chunk. 29 | /// 30 | [Flags] 31 | public enum LiquidFlags : byte 32 | { 33 | /// 34 | /// The liquid is present, but hidden. 35 | /// 36 | Hidden = 0x08, 37 | 38 | /// 39 | /// Unknown. 40 | /// 41 | Unknown1 = 0x10, 42 | 43 | /// 44 | /// Unknown. 45 | /// 46 | Unknown2 = 0x20, 47 | 48 | /// 49 | /// The liquid is fishable. 50 | /// 51 | Fishable = 0x40, 52 | 53 | /// 54 | /// The liquid is shared. 55 | /// 56 | Shared = 0x80 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /libwarcraft/ADT/Chunks/Subchunks/MapChunkFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MapChunkFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.ADT.Chunks.Subchunks 24 | { 25 | /// 26 | /// Flags available for a MCNK. 27 | /// 28 | public enum MapChunkFlags : uint 29 | { 30 | /// 31 | /// Flags the MCNK as containing a static shadow map 32 | /// 33 | HasBakedShadows = 1, 34 | 35 | /// 36 | /// Flags the MCNK as impassible 37 | /// 38 | Impassible = 2, 39 | 40 | /// 41 | /// Flags the MCNK as a river 42 | /// 43 | IsRiver = 4, 44 | 45 | /// 46 | /// Flags the MCNK as an ocean 47 | /// 48 | IsOcean = 8, 49 | 50 | /// 51 | /// Flags the MCNK as magma 52 | /// 53 | IsMagma = 16, 54 | 55 | /// 56 | /// Flags the MCNK as slime 57 | /// 58 | IsSlime = 32, 59 | 60 | /// 61 | /// Flags the MCNK as containing an MCCV chunk 62 | /// 63 | HasVertexShading = 64, 64 | 65 | /// 66 | /// Unknown flag, but occasionally set. 67 | /// 68 | Unknown = 128, 69 | 70 | // 7 unused bits 71 | 72 | /// 73 | /// Disables repair of the alpha maps in this chunk. 74 | /// 75 | DoNotRepairAlphaMaps = 32768, 76 | 77 | /// 78 | /// Flags the MCNK for high-resolution holes. Introduced in WoW 5.3 79 | /// 80 | UsesHighResHoles = 65536, 81 | 82 | // 15 unused bits 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /libwarcraft/ADT/Chunks/Subchunks/SoundEmitter.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SoundEmitter.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.ADT.Chunks.Subchunks 24 | { 25 | /// 26 | /// Base class for sound emitters. 27 | /// 28 | public abstract class SoundEmitter 29 | { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /libwarcraft/ADT/Chunks/TerrainHeaderFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TerrainHeaderFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.ADT.Chunks 26 | { 27 | /// 28 | /// Flags for the ADT. 29 | /// 30 | [Flags] 31 | public enum TerrainHeaderFlags 32 | { 33 | /// 34 | /// This terrain file contains a bounding box. 35 | /// 36 | HasBoundingBox = 1, 37 | 38 | /// 39 | /// Flag if the ADT is from Northrend. This flag is not always set. 40 | /// 41 | Northrend = 2, 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /libwarcraft/ADT/Chunks/TerrainLiquidAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TerrainLiquidAttributes.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.IO; 24 | 25 | namespace Warcraft.ADT.Chunks 26 | { 27 | /// 28 | /// Holds attributes for liquid tiles. 29 | /// 30 | public class TerrainLiquidAttributes 31 | { 32 | /// 33 | /// Gets or sets a boolean bitfield representing which liquid chunks are fishable. 34 | /// 35 | public ulong Fishable { get; set; } 36 | 37 | /// 38 | /// Gets or sets a boolean bitfield representing which liquid chunks are considered deep. 39 | /// 40 | public ulong Deep { get; set; } 41 | 42 | /// 43 | /// Initializes a new instance of the class. 44 | /// 45 | /// The binary data. 46 | public TerrainLiquidAttributes(byte[] data) 47 | { 48 | using var ms = new MemoryStream(data); 49 | using var br = new BinaryReader(ms); 50 | Fishable = br.ReadUInt64(); 51 | Deep = br.ReadUInt64(); 52 | } 53 | 54 | /// 55 | /// Initializes a new instance of the class. 56 | /// 57 | public TerrainLiquidAttributes() 58 | { 59 | Fishable = 0; 60 | Deep = 0; 61 | } 62 | 63 | /// 64 | /// Gets the serialized size of the attributes. 65 | /// 66 | /// The size in bytes. 67 | public static int GetSize() 68 | { 69 | return 16; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /libwarcraft/ADT/Chunks/TerrainModels.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TerrainModels.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.Collections.Generic; 24 | using System.IO; 25 | using Warcraft.Core.Extensions; 26 | using Warcraft.Core.Interfaces; 27 | 28 | namespace Warcraft.ADT.Chunks 29 | { 30 | /// 31 | /// MMDX Chunk - Contains a list of all referenced M2 models in this ADT. 32 | /// 33 | public class TerrainModels : IIFFChunk 34 | { 35 | /// 36 | /// Holds the binary chunk signature. 37 | /// 38 | public const string Signature = "MMDX"; 39 | 40 | /// 41 | /// Gets or sets a list of full paths to the M2 models referenced in this ADT. 42 | /// 43 | public List Filenames { get; set; } = new List(); 44 | 45 | /// 46 | /// Initializes a new instance of the class. 47 | /// 48 | public TerrainModels() 49 | { 50 | } 51 | 52 | /// 53 | /// Initializes a new instance of the class. 54 | /// 55 | /// ExtendedData. 56 | public TerrainModels(byte[] inData) 57 | { 58 | LoadBinaryData(inData); 59 | } 60 | 61 | /// 62 | public void LoadBinaryData(byte[] inData) 63 | { 64 | using var ms = new MemoryStream(inData); 65 | using var br = new BinaryReader(ms); 66 | Filenames.Add(br.ReadNullTerminatedString()); 67 | } 68 | 69 | /// 70 | public string GetSignature() 71 | { 72 | return Signature; 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /libwarcraft/ADT/Chunks/TerrainTextureFlag.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TerrainTextureFlag.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.ADT.Chunks 24 | { 25 | /// 26 | /// Texture flags for a terrain texture. 27 | /// 28 | public enum TerrainTextureFlag : uint 29 | { 30 | /// 31 | /// The texture is unshaded. 32 | /// 33 | FlatShading = 1, 34 | 35 | /// 36 | /// Unknown. 37 | /// 38 | Unknown = 3, 39 | 40 | /// 41 | /// The texture has a scaling factor. 42 | /// 43 | ScaledTexture = 4, 44 | 45 | /// 46 | /// Unknown. 47 | /// 48 | Unknown2 = 24 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /libwarcraft/ADT/Chunks/TerrainTextureFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TerrainTextureFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.Collections.Generic; 24 | using System.IO; 25 | 26 | using Warcraft.Core.Interfaces; 27 | 28 | namespace Warcraft.ADT.Chunks 29 | { 30 | /// 31 | /// Holds texture flags for a terrain tile. 32 | /// 33 | public class TerrainTextureFlags : IIFFChunk 34 | { 35 | /// 36 | /// Holds the binary chunk signature. 37 | /// 38 | public const string Signature = "MTXF"; 39 | 40 | /// 41 | /// Gets the texture flags. 42 | /// 43 | public List TextureFlags { get; } = new List(); 44 | 45 | /// 46 | /// Initializes a new instance of the class. 47 | /// 48 | /// ExtendedData. 49 | public TerrainTextureFlags(byte[] inData) 50 | { 51 | LoadBinaryData(inData); 52 | } 53 | 54 | /// 55 | public void LoadBinaryData(byte[] inData) 56 | { 57 | using var ms = new MemoryStream(inData); 58 | using var br = new BinaryReader(ms); 59 | var entryCount = br.BaseStream.Length / 4; 60 | 61 | for (var i = 0; i < entryCount; ++i) 62 | { 63 | TextureFlags.Add((TerrainTextureFlag)br.ReadUInt32()); 64 | } 65 | } 66 | 67 | /// 68 | public string GetSignature() 69 | { 70 | return Signature; 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /libwarcraft/ADT/Chunks/WorldModelObjectFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // WorldModelObjectFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.ADT.Chunks 26 | { 27 | /// 28 | /// Flags for the WMO. 29 | /// 30 | [Flags] 31 | public enum WorldModelObjectFlags : ushort 32 | { 33 | /// 34 | /// The WMO is a destructible. 35 | /// 36 | Destructible = 1, 37 | 38 | /// 39 | /// The WMO has LOD levels. 40 | /// 41 | UseLOD = 2, 42 | 43 | /// 44 | /// Unknown. 45 | /// 46 | Unknown = 4 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /libwarcraft/BLP/BLPFormat.cs: -------------------------------------------------------------------------------- 1 | // 2 | // BLPFormat.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.BLP 24 | { 25 | /// 26 | /// The format of a image file. 27 | /// 28 | public enum BLPFormat 29 | { 30 | /// 31 | /// BLP version 0. Can contain JPEG data. 32 | /// 33 | BLP0, 34 | 35 | /// 36 | /// BLP version 1. Usually palettized. 37 | /// 38 | BLP1, 39 | 40 | /// 41 | /// BLP version 2. Usually stores DXT compressed data.calls 42 | /// 43 | BLP2 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /libwarcraft/BLP/BLPPixelFormat.cs: -------------------------------------------------------------------------------- 1 | // 2 | // BLPPixelFormat.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.BLP 24 | { 25 | /// 26 | /// The format of the pixels stored in a file. 27 | /// 28 | public enum BLPPixelFormat : uint 29 | { 30 | /// 31 | /// DXT1 compressed pixels. 32 | /// 33 | DXT1 = 0, 34 | 35 | /// 36 | /// DXT3 compressed pixels. 37 | /// 38 | DXT3 = 1, 39 | 40 | /// 41 | /// ARGB8888 formatted pixels. 42 | /// 43 | ARGB8888 = 2, 44 | 45 | /// 46 | /// PAL ARGB1555 formatted pixels. 47 | /// 48 | PalARGB1555DitherFloydSteinberg = 3, 49 | 50 | /// 51 | /// PAL ARGB4444 formatted pixels. 52 | /// 53 | PalARGB4444DitherFloydSteinberg = 4, 54 | 55 | /// 56 | /// PAL ARGB565 formatted pixels. 57 | /// 58 | PalARGB565DitherFloydSteinberg = 5, 59 | 60 | /// 61 | /// DXT5 compressed pixels. 62 | /// 63 | DXT5 = 7, 64 | 65 | /// 66 | /// Palettized pixels, that is, the pixels are indices into the stored colour palette. 67 | /// 68 | Palettized = 8, 69 | 70 | /// 71 | /// PAL ARGB2565 formatted pixels. 72 | /// 73 | PalARGB2565DitherFloydSteinberg = 9 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /libwarcraft/BLP/TextureCompressionType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TextureCompressionType.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.BLP 24 | { 25 | /// 26 | /// The compression type used in the image. 27 | /// 28 | public enum TextureCompressionType : uint 29 | { 30 | /// 31 | /// The image is using JPEG compression. 32 | /// 33 | JPEG = 0, 34 | 35 | /// 36 | /// The image is using a colour palette. 37 | /// 38 | Palettized = 1, 39 | 40 | /// 41 | /// The image is compressed using the DXT algorithm. 42 | /// 43 | DXTC = 2, 44 | 45 | /// 46 | /// The image is not compressed. 47 | /// 48 | Uncompressed = 3, 49 | 50 | /// 51 | /// TODO: Unknown behaviour 52 | /// The image is not compressed. 53 | /// 54 | UncompressedAlternate = 4 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /libwarcraft/BLS/ShaderContainerType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ShaderContainerType.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.BLS 24 | { 25 | /// 26 | /// All the different container types there are of BLS files. 27 | /// 28 | public enum ShaderContainerType : byte 29 | { 30 | /// 31 | /// This BLS file is a vertex shader container. 32 | /// 33 | Vertex, 34 | 35 | /// 36 | /// This BLS file is a fragment shader container. 37 | /// 38 | Fragment 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /libwarcraft/BLS/ShaderFlags1.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ShaderFlags1.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.BLS 24 | { 25 | /// 26 | /// The first set of shader flags. 27 | /// 28 | public enum ShaderFlags1 : uint 29 | { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /libwarcraft/BLS/ShaderFlags2.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ShaderFlags2.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.BLS 24 | { 25 | /// 26 | /// The second set of shader flags. 27 | /// 28 | public enum ShaderFlags2 : uint 29 | { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /libwarcraft/Core/Compression/Blast/BlastException.cs: -------------------------------------------------------------------------------- 1 | // TODO: Break this out into a real library 2 | // 3 | // ReSharper disable All 4 | #pragma warning disable 5 | 6 | using System; 7 | 8 | namespace Warcraft.Core.Compression.Blast 9 | { 10 | public class BlastException : Exception 11 | { 12 | public const string OutOfInputMessage = "Ran out of input before completing decompression"; 13 | public const string OutputMessage = "Output error before completing decompression"; 14 | public const string LiteralFlagMessage = "Literal flag not zero or one"; 15 | public const string DictionarySizeMessage = "Dictionary size not in 4..6"; 16 | public const string DistanceMessage = "Distance is too far back"; 17 | 18 | public BlastException() 19 | : base() 20 | { 21 | } 22 | 23 | public BlastException(string message) 24 | : base(message) 25 | { 26 | } 27 | 28 | public BlastException(string message, Exception inner) 29 | : base(message, inner) 30 | { 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /libwarcraft/Core/Compression/Blast/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright 2012 James Telfer 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | 17 | ----- 18 | 19 | 20 | Any part of this implementation that is not covered by the original notice is Copyright © 2012 James Telfer, and is released under the Apache 2.0 license. 21 | 22 | It should be noted that this algorithm was originally implemented by PKWare. 23 | 24 | The C implementation (upon which this is based) is located within the ZLib source tree, with a copy residing as a reference within this source tree. 25 | 26 | See the original blast.h for the terms of the license under which the C implementation was released. -------------------------------------------------------------------------------- /libwarcraft/Core/Compression/Blast/README.md: -------------------------------------------------------------------------------- 1 | # Intro 2 | 3 | In various places, a PKWare library is used (often called implode.dll) 4 | that implements an uncommon, proprietary compression algorithm. 5 | 6 | This algorithm was reverse-engineered by Ben Rudiak-Gould back in 2001, and 7 | Mark Adler wrote a C implementation in 2003. 8 | 9 | This project is a translation into C# of the PKWare compression algorithm 10 | implemented in C by [Mark Adler](https://github.com/madler/). 11 | 12 | This implementation varies from the C original. 13 | 14 | # Variations 15 | 16 | I found that the files compressed in the legacy system I came into contact with 17 | contained multiple, separate, compressed streams. Each stream is delineated by 18 | an end of stream marker. Where the base implementation stops at the end of stream, 19 | this implementation checks for further data on the stream and will start 20 | decompressing again if it finds any. 21 | 22 | # Implementation 23 | 24 | This is probably the least elegant way of implementing a decompressor. It would 25 | be much better to implement Stream, for example. However, it does what it says 26 | on the tin; it decompresses the stream. If this was being used for something 27 | that was important, you might go to the trouble of making it work better. For 28 | me, though, this works faster than shelling out to an executable as the previous system did. 29 | 30 | # Usage 31 | 32 | new Utils.Blast(sourceStream, destinationStream).Decompress(); 33 | 34 | # Legal 35 | 36 | Any part of this implementation that is not covered by the original 37 | notice is Copyright © 2012 James Telfer, and is released under the 38 | [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0.html). 39 | 40 | It should be noted that this algorithm was originally implemented by 41 | PKWare. 42 | 43 | The C implementation (upon which this is based) is located 44 | within the [ZLib source tree](https://github.com/madler/zlib/blob/master/contrib/blast/), 45 | with a copy residing as a reference [within](https://github.com/jamestelfer/Blast/blob/master/Blast/reference-code/) this source tree. 46 | 47 | See the original [blast.h](https://github.com/madler/zlib/blob/master/contrib/blast/blast.h) 48 | for the terms of the license under which the C implementation was released. 49 | -------------------------------------------------------------------------------- /libwarcraft/Core/Compression/CompressionAlgorithms.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CompressionAlgorithms.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.Core.Compression 26 | { 27 | /// 28 | /// This enum contains all of the compression algorithms used in MPQ archives. They are sorted according to 29 | /// compression order, and must not be reordered. 30 | /// 31 | /// When compressing, the algorithms are applied from top to bottom. When decompressing, the inverse is true. 32 | /// 33 | [Flags] 34 | public enum CompressionAlgorithms : byte 35 | { 36 | /// 37 | /// LZMA compression. 38 | /// 39 | LZMA = 0x20, 40 | 41 | /// 42 | /// IMA ADPCM Mono Audio compression. 43 | /// 44 | ADPCMMono = 0x40, 45 | 46 | /// 47 | /// IMA ADPCM Stereo Audio compression. 48 | /// 49 | ADPCMStereo = 0x80, 50 | 51 | /// 52 | /// Huffman tree compression. 53 | /// 54 | Huffman = 0x01, 55 | 56 | /// 57 | /// ZLIB Deflate compression. 58 | /// 59 | Deflate = 0x02, 60 | 61 | /// 62 | /// PKWARE Implode compression. 63 | /// 64 | Implode = 0x08, 65 | 66 | /// 67 | /// BZip2 compression. 68 | /// 69 | BZip2 = 0x10 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /libwarcraft/Core/Compression/Squish/ColourFit.cs: -------------------------------------------------------------------------------- 1 | // TODO: Break this out into a real library 2 | // 3 | // ReSharper disable All 4 | // Note: this file is not actually auto-generated, but rather a straight source import from an external library. 5 | 6 | namespace Warcraft.Core.Compression.Squish 7 | { 8 | internal abstract class ColourFit 9 | { 10 | #region Fields 11 | 12 | protected ColourSet _Colours; 13 | private SquishOptions _Flags; 14 | 15 | #endregion 16 | 17 | #region Constructor 18 | 19 | protected ColourFit(ColourSet colours, SquishOptions flags) 20 | { 21 | _Colours = colours; 22 | _Flags = flags; 23 | } 24 | 25 | #endregion 26 | 27 | #region Public 28 | 29 | public void Compress(ref byte[] block) 30 | { 31 | if (_Flags.HasFlag(SquishOptions.DXT1)) 32 | { 33 | Compress3(block); 34 | if (!_Colours.IsTransparent) 35 | { 36 | Compress4(block); 37 | } 38 | } 39 | else 40 | { 41 | Compress4(block); 42 | } 43 | } 44 | 45 | #endregion 46 | 47 | #region Protected 48 | 49 | protected abstract void Compress3(byte[] block); 50 | 51 | protected abstract void Compress4(byte[] block); 52 | 53 | #endregion 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /libwarcraft/Core/Compression/Squish/README: -------------------------------------------------------------------------------- 1 | 2 | DotSquish is part of a library for extracting game assets from Final Fantasy XIV, created by Sam Hocevar. 3 | DotSquish is used in WarLib under the DO WHAT THE FUCK YOU WANT TO PUBLIC LICENCE, Version 2 (December 2004). 4 | 5 | ----- 6 | 7 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 8 | Version 2, December 2004 9 | 10 | Copyright (C) 2004 Sam Hocevar 11 | 12 | Everyone is permitted to copy and distribute verbatim or modified 13 | copies of this license document, and changing it is allowed as long 14 | as the name is changed. 15 | 16 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 17 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 18 | 19 | 0. You just DO WHAT THE FUCK YOU WANT TO. 20 | 21 | ----- 22 | 23 | The source for DotSquish (along with SaintConach, the FFXIV library), is available here under the original 24 | licence. 25 | 26 | https://github.com/Rogueadyn/SaintCoinach 27 | 28 | A great thank you to Sam Hocevar for both the code and the licence! -------------------------------------------------------------------------------- /libwarcraft/Core/Compression/Squish/SingleColourFit.cs: -------------------------------------------------------------------------------- 1 | // TODO: Break this out into a real library 2 | // 3 | // ReSharper disable All 4 | #pragma warning disable 5 | 6 | // Note: this file is not actually auto-generated, but rather a straight source import from an external library. 7 | 8 | using System; 9 | using System.Numerics; 10 | 11 | namespace Warcraft.Core.Compression.Squish 12 | { 13 | internal partial class SingleColourFit : ColourFit 14 | { 15 | private byte[] colour = new byte[3]; 16 | private Vector3 start; 17 | private Vector3 end; 18 | private byte index; 19 | private int error; 20 | private int bestError; 21 | 22 | private SingleColourFit(ColourSet colours, SquishOptions flags) 23 | : base(colours, flags) 24 | { 25 | var values = _Colours.Points[0]; 26 | 27 | colour[0] = (byte) FloatToInt(255.0f * values.X, 255); 28 | colour[1] = (byte) FloatToInt(255.0f * values.Y, 255); 29 | colour[2] = (byte) FloatToInt(255.0f * values.Z, 255); 30 | 31 | bestError = int.MaxValue; 32 | } 33 | 34 | private static int FloatToInt(float a, int limit) 35 | { 36 | var i = (int) (a + 0.5f); 37 | 38 | // clamp to limit 39 | if (i < 0) 40 | { 41 | i = 0; 42 | } 43 | else if (i > limit) 44 | { 45 | i = limit; 46 | } 47 | 48 | return i; 49 | } 50 | 51 | protected override void Compress3(byte[] block) 52 | { 53 | throw new NotImplementedException(); 54 | } 55 | 56 | protected override void Compress4(byte[] block) 57 | { 58 | throw new NotImplementedException(); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /libwarcraft/Core/Compression/Squish/SingleColourLookup.cs: -------------------------------------------------------------------------------- 1 | // TODO: Break this out into a real library 2 | // 3 | 4 | namespace Warcraft.Core.Compression.Squish 5 | { 6 | internal struct SingleColourLookup 7 | { 8 | public SourceBlock[] Sources; 9 | 10 | public SingleColourLookup(SourceBlock one, SourceBlock two) 11 | { 12 | Sources = new SourceBlock[2]; 13 | Sources[0] = one; 14 | Sources[1] = two; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /libwarcraft/Core/Compression/Squish/SourceBlock.cs: -------------------------------------------------------------------------------- 1 | // TODO: Break this out into a real library 2 | // 3 | // ReSharper disable All 4 | 5 | namespace Warcraft.Core.Compression.Squish 6 | { 7 | internal struct SourceBlock 8 | { 9 | public byte Start; 10 | public byte End; 11 | public byte Error; 12 | 13 | public SourceBlock(byte Start, byte End, byte Error) 14 | { 15 | this.Start = Start; 16 | this.End = End; 17 | this.Error = Error; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /libwarcraft/Core/Compression/Squish/SquishOptions.cs: -------------------------------------------------------------------------------- 1 | // TODO: Break this out into a real library 2 | // 3 | // ReSharper disable All 4 | #pragma warning disable 5 | 6 | using System; 7 | 8 | namespace Warcraft.Core.Compression.Squish 9 | { 10 | [Flags] 11 | public enum SquishOptions 12 | { 13 | /// 14 | /// Use DXT1 compression. 15 | /// 16 | DXT1 = (1 << 0), 17 | /// 18 | /// Use DXT3 compression. 19 | /// 20 | DXT3 = (1 << 1), 21 | /// 22 | /// Use DXT5 compression. 23 | /// 24 | DXT5 = (1 << 2), 25 | /// 26 | /// Use a very slow but very high quality colour compressor. 27 | /// 28 | ColourIterativeClusterFit = (1 << 3), 29 | /// 30 | /// Use a slow but high quality colour compressor (default). 31 | /// 32 | ColourClusterFit = (1 << 4), 33 | /// 34 | /// Use a fast but low quality colour compressor. 35 | /// 36 | ColourRangeFit = (1 << 5), 37 | /// 38 | /// Use a perceptual metric for colour error (default). 39 | /// 40 | ColourMetricPerceptual = (1 << 6), 41 | /// 42 | /// Use a uniform metric for colour error. 43 | /// 44 | ColourMetricUniform = (1 << 7), 45 | /// 46 | /// Weight the colour by alpha during cluster fit (off by default). 47 | /// 48 | WeightColourByAlpha = (1 << 8), 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /libwarcraft/Core/Compression/Squish/SquishOptionsExtensions.cs: -------------------------------------------------------------------------------- 1 | // TODO: Break this out into a real library 2 | // 3 | // ReSharper disable All 4 | #pragma warning disable 5 | // Note: this file is not actually auto-generated, but rather a straight source import from an external library. 6 | 7 | namespace Warcraft.Core.Compression.Squish { 8 | public static class SquishOptionsExtensions 9 | { 10 | public static SquishOptions GetMethod(this SquishOptions self) 11 | { 12 | return (self & (SquishOptions.DXT1 | SquishOptions.DXT3 | SquishOptions.DXT5)); 13 | } 14 | 15 | public static SquishOptions GetFit(this SquishOptions self) 16 | { 17 | return (self & (SquishOptions.ColourIterativeClusterFit | SquishOptions.ColourClusterFit | SquishOptions.ColourRangeFit)); 18 | } 19 | 20 | public static SquishOptions GetMetric(this SquishOptions self) 21 | { 22 | return (self & (SquishOptions.ColourMetricPerceptual | SquishOptions.ColourMetricUniform)); 23 | } 24 | 25 | public static SquishOptions GetExtra(this SquishOptions self) 26 | { 27 | return (self & (SquishOptions.WeightColourByAlpha)); 28 | } 29 | 30 | public static SquishOptions FixFlags(this SquishOptions flags) 31 | { 32 | // grab the flag bits 33 | var method = (int)(flags & (SquishOptions.DXT1 | SquishOptions.DXT3 | SquishOptions.DXT5)); 34 | var fit = (int) (flags & (SquishOptions.ColourIterativeClusterFit | SquishOptions.ColourClusterFit | SquishOptions.ColourRangeFit)); 35 | var extra = (int) (flags & SquishOptions.WeightColourByAlpha); 36 | 37 | // set defaults 38 | if (method != (int)SquishOptions.DXT3 && method != (int)SquishOptions.DXT5) 39 | { 40 | method = (int) SquishOptions.DXT5; 41 | } 42 | 43 | if (fit != (int) SquishOptions.ColourRangeFit && fit != (int)SquishOptions.ColourIterativeClusterFit) 44 | { 45 | fit = (int) SquishOptions.ColourClusterFit; 46 | } 47 | 48 | // done 49 | return (SquishOptions) (method | fit | extra); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /libwarcraft/Core/DatabaseRecordAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DatabaseRecordAttribute.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | using Warcraft.DBC; 25 | 26 | namespace Warcraft.Core 27 | { 28 | /// 29 | /// Tags a record as belonging to a specific database. 30 | /// 31 | public class DatabaseRecordAttribute : Attribute 32 | { 33 | /// 34 | /// Gets the database. 35 | /// 36 | public DatabaseName Database { get; } 37 | 38 | /// 39 | /// Initializes a new instance of the class. 40 | /// 41 | public DatabaseRecordAttribute() 42 | { 43 | } 44 | 45 | /// 46 | /// Initializes a new instance of the class. 47 | /// 48 | /// The name of the database. 49 | public DatabaseRecordAttribute(DatabaseName database) 50 | { 51 | Database = database; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /libwarcraft/Core/Exceptions/InvalidChunkSignatureException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // InvalidChunkSignatureException.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.Core 26 | { 27 | /// 28 | /// This exception thrown when an invalid or unknown chunk signature is found during parsing of binary data which 29 | /// is expected to be in valid RIFF format. 30 | /// 31 | public class InvalidChunkSignatureException : Exception 32 | { 33 | /// 34 | /// Initializes a new instance of the class, along with a specified 35 | /// message. 36 | /// 37 | /// The message included in the exception. 38 | public InvalidChunkSignatureException(string message) 39 | : base(message) 40 | { 41 | } 42 | 43 | /// 44 | /// Initializes a new instance of the class, along with a specified 45 | /// message and inner exception which caused this exception. 46 | /// 47 | /// The message included in the exception. 48 | /// The exception which caused this exception. 49 | public InvalidChunkSignatureException(string message, Exception innerException) 50 | : base(message, innerException) 51 | { 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /libwarcraft/Core/Exceptions/InvalidFieldAttributeException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // InvalidFieldAttributeException.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.Core 26 | { 27 | /// 28 | /// Represents an invalid state arising from an invalid field attribute. 29 | /// 30 | public class InvalidFieldAttributeException : Exception 31 | { 32 | /// 33 | /// Initializes a new instance of the class, along with a specified 34 | /// message. 35 | /// 36 | /// The message included in the exception. 37 | public InvalidFieldAttributeException(string message) 38 | : base(message) 39 | { 40 | } 41 | 42 | /// 43 | /// Initializes a new instance of the class, along with a specified 44 | /// message and inner exception which caused this exception. 45 | /// 46 | /// The message included in the exception. 47 | /// The exception which caused this exception. 48 | public InvalidFieldAttributeException(string message, Exception innerException) 49 | : base(message, innerException) 50 | { 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /libwarcraft/Core/Exceptions/InvalidFileSectorTableException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // InvalidFileSectorTableException.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.Core 26 | { 27 | /// 28 | /// This exception thrown when an invalid sector offset table is encountered during file extraction. Usually, 29 | /// it means the archive that the user is trying to extract the file from is invalid, corrupted, or has been 30 | /// maliciously zeroed at critical points. 31 | /// 32 | public class InvalidFileSectorTableException : Exception 33 | { 34 | /// 35 | /// Initializes a new instance of the class, along with a specified 36 | /// message. 37 | /// 38 | /// The message included in the exception. 39 | public InvalidFileSectorTableException(string message) 40 | : base(message) 41 | { 42 | } 43 | 44 | /// 45 | /// Initializes a new instance of the class, along with a specified 46 | /// message and inner exception which caused this exception. 47 | /// 48 | /// The message included in the exception. 49 | /// The exception which caused this exception. 50 | public InvalidFileSectorTableException(string message, Exception innerException) 51 | : base(message, innerException) 52 | { 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /libwarcraft/Core/Extensions/ExtendedGraphics.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ExtendedGraphics.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using SixLabors.ImageSharp; 24 | using SixLabors.ImageSharp.PixelFormats; 25 | 26 | namespace Warcraft.Core.Extensions 27 | { 28 | /// 29 | /// Extension methods used internally in the library for graphics classes. 30 | /// 31 | public static class ExtendedGraphics 32 | { 33 | /// 34 | /// Determines whether or not a given bitmap has any alpha values, and thus if it requires an alpha channel in 35 | /// other formats. 36 | /// 37 | /// The map to inspect. 38 | /// true if the bitmap has any alpha values; otherwise, false. 39 | public static bool HasAlpha(this Image map) 40 | { 41 | for (var y = 0; y < map.Height; ++y) 42 | { 43 | for (var x = 0; x < map.Width; ++x) 44 | { 45 | var pixel = map[x, y]; 46 | if (pixel.A != 255) 47 | { 48 | return true; 49 | } 50 | } 51 | } 52 | 53 | return false; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /libwarcraft/Core/Interfaces/IBinarySerializable.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IBinarySerializable.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.Core.Interfaces 24 | { 25 | /// 26 | /// Classes which implement this interface promise to be able to serialize themselves into a binary format, 27 | /// which can then be used to reconstruct the object fully by passing the same data as a byte array to its 28 | /// constructor. 29 | /// 30 | public interface IBinarySerializable 31 | { 32 | /// 33 | /// Serializes the current object into a byte array. 34 | /// 35 | /// The serialized object. 36 | byte[] Serialize(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /libwarcraft/Core/Interfaces/IDeferredDeserialize.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IDeferredDeserialize.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.IO; 24 | 25 | namespace Warcraft.Core.Interfaces 26 | { 27 | /// 28 | /// Classes implementing this interface support deferred deserialization. 29 | /// 30 | public interface IDeferredDeserialize 31 | { 32 | /// 33 | /// Deserializes the data of the object using the provided . 34 | /// 35 | /// The reader. 36 | void DeserializeSelf(BinaryReader reader); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /libwarcraft/Core/Interfaces/IFlattenableData.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IFlattenableData.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.Collections.Generic; 24 | 25 | namespace Warcraft.Core.Interfaces 26 | { 27 | /// 28 | /// Defines an interface which provides a way to flatten a data type into a collection of another data type. 29 | /// 30 | /// The data type to flatten to. 31 | public interface IFlattenableData 32 | { 33 | /// 34 | /// Flattens the object into a collection of . 35 | /// 36 | /// A read-only collection. 37 | IReadOnlyCollection Flatten(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /libwarcraft/Core/Interfaces/IIFFChunk.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IIFFChunk.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.Core.Interfaces 24 | { 25 | /// 26 | /// Contains common functionality for a binary IFF block. 27 | /// 28 | /// IFF blocks are stored in binary format as a signature, data length, and block data in the following layout: 29 | /// char[4] Signature; 30 | /// uint32 BlockSize; 31 | /// byte[BlockSize] BlockData. 32 | /// 33 | public interface IIFFChunk 34 | { 35 | /// 36 | /// Deserialzes the provided binary data of the object. This is the full data block which follows the data 37 | /// signature and data block length. 38 | /// 39 | /// The binary data containing the object. 40 | void LoadBinaryData(byte[] inData); 41 | 42 | /// 43 | /// Gets the static data signature of this data block type. 44 | /// 45 | /// A string representing the block signature. 46 | string GetSignature(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /libwarcraft/Core/Interfaces/IPostLoad.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IPostLoad.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.Core.Interfaces 24 | { 25 | /// 26 | /// This interface holds that the implementing class can load all of its serialized data after it has been 27 | /// constructed through the method. 28 | /// 29 | /// 30 | /// The loading parameters that the class takes. This is a class or structure which contains all required data 31 | /// to load the object. 32 | /// 33 | public interface IPostLoad 34 | { 35 | /// 36 | /// Determines whether or not this object has finished loading. 37 | /// 38 | /// true if the object has finished loading; otherwise, false. 39 | bool HasFinishedLoading(); 40 | 41 | /// 42 | /// Loads the object's data after construction, using the provided parameters. Typically, this is a byte 43 | /// array with serialized data. 44 | /// 45 | /// The parameters required to fully load the object. 46 | void PostLoad(T loadingParameters); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /libwarcraft/Core/Interfaces/IVersionedClass.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IVersionedClass.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.Core.Interfaces 24 | { 25 | /// 26 | /// The IVersionedClass interface does not require any specific functionality, but rather acts as a decorator to 27 | /// provide generic functions with the knowledge that the class which implements it has multiple deserialization 28 | /// paths depending on different versions of its own or its containing object's class. 29 | /// 30 | public interface IVersionedClass 31 | { 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /libwarcraft/Core/Interpolation/IInterpolatable.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IInterpolatable.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.Core.Interpolation 24 | { 25 | /// 26 | /// Specifies that the type which implements this interface can be interpolated between itself and a target point. 27 | /// 28 | /// The type to interpolate. 29 | public interface IInterpolatable 30 | { 31 | /// 32 | /// Interpolates the instance between itself and the object by an alpha factor, 33 | /// using the interpolation algorithm specified in . 34 | /// 35 | /// The target point. 36 | /// The alpha factor. 37 | /// The interpolation algorithm to use. 38 | /// An interpolated object. 39 | T Interpolate(T target, float alpha, InterpolationType interpolationType); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /libwarcraft/Core/Interpolation/InterpolationType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // InterpolationType.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.Core.Interpolation 24 | { 25 | /// 26 | /// The type of interpolation used. 27 | /// 28 | public enum InterpolationType : ushort 29 | { 30 | /// 31 | /// No interpolation. 32 | /// 33 | None = 0, 34 | 35 | /// 36 | /// Linear interpolation. 37 | /// 38 | Linear = 1, 39 | 40 | /// 41 | /// Hermite interpolation. 42 | /// 43 | Hermite = 2, 44 | 45 | /// 46 | /// Bezier interpolation. 47 | /// 48 | Bezier = 3 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /libwarcraft/Core/Reflection/DBC/ForeignKeyInfoAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ForeignKeyInfoAttribute.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | using Warcraft.DBC; 25 | 26 | namespace Warcraft.Core.Reflection.DBC 27 | { 28 | /// 29 | /// Applies information about a foreign key to a record property, such as the database name and the name of the 30 | /// field it points to. 31 | /// 32 | [AttributeUsage(AttributeTargets.Property)] 33 | public class ForeignKeyInfoAttribute : Attribute 34 | { 35 | /// 36 | /// Gets the database that the key points to. 37 | /// 38 | public DatabaseName Database { get; } 39 | 40 | /// 41 | /// Gets the name of the column that the key points to in the database. 42 | /// 43 | public string Field { get; } 44 | 45 | /// 46 | /// Initializes a new instance of the class. 47 | /// 48 | /// The name of the database the key points to. 49 | /// The name of the field that the key points to in the database. 50 | public ForeignKeyInfoAttribute(DatabaseName databaseName, string field) 51 | { 52 | Database = databaseName; 53 | Field = field; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /libwarcraft/Core/Reflection/DBC/InheritanceChainComparer.cs: -------------------------------------------------------------------------------- 1 | // 2 | // InheritanceChainComparer.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | 26 | namespace Warcraft.Core.Reflection.DBC 27 | { 28 | /// 29 | /// Compares types by their inheritance chain. A subclass is considered more (that is, more derived) than a parent 30 | /// class. 31 | /// 32 | public class InheritanceChainComparer : IComparer 33 | { 34 | /// 35 | public int Compare(Type? x, Type? y) 36 | { 37 | if (x == y) 38 | { 39 | return 0; 40 | } 41 | 42 | if (x is null) 43 | { 44 | return 1; 45 | } 46 | 47 | if (y is null) 48 | { 49 | return -1; 50 | } 51 | 52 | if (x.IsSubclassOf(y)) 53 | { 54 | return 1; 55 | } 56 | 57 | if (y.IsSubclassOf(x)) 58 | { 59 | return -1; 60 | } 61 | 62 | return 0; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /libwarcraft/Core/Reflection/DBC/RecordFieldArrayAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // RecordFieldArrayAttribute.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.Core.Reflection.DBC 26 | { 27 | /// 28 | /// Declares a property to be a record field property that is an array of elements. Multiple instances 29 | /// of this attribute can be applied to a property if the field count changes. 30 | /// 31 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = true)] 32 | public class RecordFieldArrayAttribute : RecordFieldAttribute 33 | { 34 | /// 35 | /// Gets or sets the number of elements in the array. 36 | /// 37 | public uint Count { get; set; } 38 | 39 | /// 40 | /// Initializes a new instance of the class. 41 | /// 42 | /// The version that the field was introduced in. 43 | public RecordFieldArrayAttribute(WarcraftVersion introducedIn) 44 | : base(introducedIn) 45 | { 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /libwarcraft/Core/Reflection/DBC/RecordFieldAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // RecordFieldAttribute.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.Core.Reflection.DBC 26 | { 27 | /// 28 | /// Declares a property to be a record field. 29 | /// 30 | [AttributeUsage(AttributeTargets.Property)] 31 | public class RecordFieldAttribute : Attribute 32 | { 33 | /// 34 | /// Gets the version that the field was introduced in. 35 | /// 36 | public WarcraftVersion IntroducedIn { get; } 37 | 38 | /// 39 | /// Gets or sets the version that the field was removed in. If the field has not been removed, then this will 40 | /// have a value of . 41 | /// 42 | public WarcraftVersion RemovedIn { get; set; } 43 | 44 | /// 45 | /// Initializes a new instance of the class. 46 | /// 47 | /// The version that the field was introduced in. 48 | public RecordFieldAttribute(WarcraftVersion introducedIn) 49 | { 50 | IntroducedIn = introducedIn; 51 | RemovedIn = WarcraftVersion.Unknown; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /libwarcraft/Core/Reflection/DBC/RecordFieldOrderAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // RecordFieldOrderAttribute.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.Core.Reflection.DBC 26 | { 27 | /// 28 | /// Represents an information tag, describing relative movement of a record field in a particular version. 29 | /// 30 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = true)] 31 | public class RecordFieldOrderAttribute : Attribute 32 | { 33 | /// 34 | /// Gets or sets the version that the associated field was moved in. 35 | /// 36 | public WarcraftVersion MovedIn { get; set; } 37 | 38 | /// 39 | /// Gets or sets the name of the previous field in the record, which the associated field should come after. 40 | /// 41 | public string? ComesAfter { get; set; } 42 | 43 | /// 44 | /// Initializes a new instance of the class. 45 | /// 46 | /// The version that the field moved in. 47 | public RecordFieldOrderAttribute(WarcraftVersion movedIn) 48 | { 49 | MovedIn = movedIn; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /libwarcraft/Core/Shading/Blending/AlphaDestination.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AlphaDestination.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.Core.Shading.Blending 24 | { 25 | /// 26 | /// Different algorithms to use for destination alpha blending factors. 27 | /// The given values are taken from OpenGL for ease of use. 28 | /// 29 | public enum AlphaDestination 30 | { 31 | /// 32 | /// A factor of zero. 33 | /// 34 | Zero = 0, 35 | 36 | /// 37 | /// A factor of one. 38 | /// 39 | One = 1, 40 | 41 | /// 42 | /// Use the source alpha as the blending factor. 43 | /// 44 | SourceAlpha = 770, 45 | 46 | /// 47 | /// Use one minus the source alpha as the blending factor. 48 | /// 49 | OneMinusSourceAlpha = 771, 50 | 51 | /// 52 | /// Use one minus the constant alpha value as the blending factor. 53 | /// 54 | OneMinusConstantAlpha = 32772 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /libwarcraft/Core/Shading/Blending/AlphaSource.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AlphaSource.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.Core.Shading.Blending 24 | { 25 | /// 26 | /// Different algorithms to use for source alpha blending factors. 27 | /// The given values are taken from OpenGL for ease of use. 28 | /// 29 | public enum AlphaSource 30 | { 31 | /// 32 | /// Use zero as the source factor. 33 | /// 34 | Zero = 0, 35 | 36 | /// 37 | /// Use one as the source factor. 38 | /// 39 | One = 1, 40 | 41 | /// 42 | /// Use the source alpha as the source factor. 43 | /// 44 | SourceAlpha = 770, 45 | 46 | /// 47 | /// Use one minus the source alpha as the source factor. 48 | /// 49 | OneMinusSourceAlpha = 771, 50 | 51 | /// 52 | /// Use the destination alpha as the source factor. 53 | /// 54 | DestinationAlpha = 772, 55 | 56 | /// 57 | /// Use a constant alpha value as the source factor. 58 | /// 59 | ConstantAlpha = 32771 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /libwarcraft/Core/Shading/Blending/ColourDestination.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ColourDestination.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.Core.Shading.Blending 24 | { 25 | /// 26 | /// Different algorithms to use for destination RGB blending factors. 27 | /// The given values are taken from OpenGL for ease of use. 28 | /// 29 | public enum ColourDestination 30 | { 31 | /// 32 | /// A factor of zero. 33 | /// 34 | Zero = 0, 35 | 36 | /// 37 | /// A factor of one. 38 | /// 39 | One = 1, 40 | 41 | /// 42 | /// The source colour is used as the factor. 43 | /// 44 | SourceColour = 768, 45 | 46 | /// 47 | /// One minus the source alpha is used as the factor. 48 | /// 49 | OneMinusSourceAlpha = 771, 50 | 51 | /// 52 | /// One minus a constant alpha value is used as the factor. 53 | /// 54 | OneMinusConstantAlpha = 32772 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /libwarcraft/Core/Shading/Blending/ColourSource.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ColourSource.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.Core.Shading.Blending 24 | { 25 | /// 26 | /// Different algorithms to use for source RGB blending factors. 27 | /// The given values are taken from OpenGL for ease of use. 28 | /// 29 | public enum ColourSource 30 | { 31 | /// 32 | /// A factor of one. 33 | /// 34 | One = 1, 35 | 36 | /// 37 | /// The source alpha is used as the factor. 38 | /// 39 | SourceAlpha = 770, 40 | 41 | /// 42 | /// One minus the source alpha is used as the factor. 43 | /// 44 | OneMinusSourceAlpha = 771, 45 | 46 | /// 47 | /// The destination colour is used as the factor. 48 | /// 49 | DestinationColour = 774, 50 | 51 | /// 52 | /// One minus the destination colour is used as the factor. 53 | /// 54 | OneMinusDestionationColour = 775, 55 | 56 | /// 57 | /// A constant alpha value is used as the factor. 58 | /// 59 | ConstantAlpha = 32771 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /libwarcraft/Core/Shading/MDX/MDXControlShaderType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXControlShaderType.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.Core.Shading.MDX 24 | { 25 | /// 26 | /// All of the tessellation control shaders (known in DX as hull shaders) in WoW. 27 | /// 28 | public enum MDXControlShaderType 29 | { 30 | /// 31 | /// Single-texture tessellation. 32 | /// 33 | T1, 34 | 35 | /// 36 | /// Dual-texture tessellation. 37 | /// 38 | T1T2, 39 | 40 | /// 41 | /// Triple-texture tessellation. 42 | /// 43 | T1T2T3, 44 | 45 | /// 46 | /// Quad-texture tessellation. 47 | /// 48 | T1T2T3T4 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /libwarcraft/Core/Shading/MDX/MDXEvaluationShaderType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXEvaluationShaderType.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.Core.Shading.MDX 24 | { 25 | /// 26 | /// All of the tessellation evaluation shaders (known in DX as domain shaders) in WoW. 27 | /// 28 | public enum MDXEvaluationShaderType 29 | { 30 | /// 31 | /// Single-texture tessellation. 32 | /// 33 | T1, 34 | 35 | /// 36 | /// Dual-texture tessellation. 37 | /// 38 | T1T2, 39 | 40 | /// 41 | /// Triple-texture tessellation. 42 | /// 43 | T1T2T3, 44 | 45 | /// 46 | /// Quad-texture tessellation. 47 | /// 48 | T1T2T3T4 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /libwarcraft/Core/Structures/AxisConfiguration.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AxisConfiguration.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.Core.Structures 24 | { 25 | /// 26 | /// An axis configuration, that is, how vector data should be interpreted. 27 | /// 28 | public enum AxisConfiguration 29 | { 30 | /// 31 | /// No assumptions should be made about the vector storage format, and should be read as XYZ. 32 | /// 33 | Native, 34 | 35 | /// 36 | /// Assume that the data is stored as Y-up. 37 | /// 38 | YUp, 39 | 40 | /// 41 | /// Assume that the data is stored as Z-up. 42 | /// 43 | ZUp 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /libwarcraft/Core/Structures/Resolution.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Resolution.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.Core.Structures 24 | { 25 | /// 26 | /// A structure representing a graphical resolution, consisting of two uint values. 27 | /// 28 | public struct Resolution 29 | { 30 | /// 31 | /// The horizontal resolution (or X resolution). 32 | /// 33 | public uint X; 34 | 35 | /// 36 | /// The vertical resolution (or Y resolution). 37 | /// 38 | public uint Y; 39 | 40 | /// 41 | /// Initializes a new instance of the struct from a height and a width. 42 | /// 43 | /// The input width component. 44 | /// The input height component. 45 | public Resolution(uint inX, uint inY) 46 | { 47 | X = inX; 48 | Y = inY; 49 | } 50 | 51 | /// 52 | /// Initializes a new instance of the struct from a single input uint, filling all components. 53 | /// 54 | /// The input component. 55 | public Resolution(uint all) 56 | : this(all, all) 57 | { 58 | } 59 | 60 | /// 61 | /// Creates a string representation of the current object. 62 | /// 63 | /// A string representation of the current object. 64 | public override readonly string ToString() 65 | { 66 | return $"{X}x{Y}"; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /libwarcraft/Core/Structures/ShortBox.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ShortBox.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.Collections.Generic; 24 | using System.Linq; 25 | using Warcraft.Core.Interfaces; 26 | 27 | namespace Warcraft.Core.Structures 28 | { 29 | /// 30 | /// A structure representing an axis-aligned bounding box, comprised of two objects 31 | /// defining the bottom and top corners of the box. 32 | /// 33 | public struct ShortBox : IFlattenableData 34 | { 35 | /// 36 | /// The bottom corner of the bounding box. 37 | /// 38 | public Vector3s BottomCorner; 39 | 40 | /// 41 | /// The top corner of the bounding box. 42 | /// 43 | public Vector3s TopCorner; 44 | 45 | /// 46 | /// Initializes a new instance of the struct from a top and bottom corner. 47 | /// 48 | /// The bottom corner of the box. 49 | /// The top corner of the box. 50 | /// A new object. 51 | public ShortBox(Vector3s inBottomCorner, Vector3s inTopCorner) 52 | { 53 | BottomCorner = inBottomCorner; 54 | TopCorner = inTopCorner; 55 | } 56 | 57 | /// 58 | public readonly IReadOnlyCollection Flatten() 59 | { 60 | return BottomCorner.Flatten().Concat(TopCorner.Flatten()).ToArray(); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /libwarcraft/Core/Structures/Sphere.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Sphere.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.Numerics; 24 | 25 | namespace Warcraft.Core.Structures 26 | { 27 | /// 28 | /// A structure representing an axis-aligned sphere, comprised of a position and a 29 | /// radius. 30 | /// 31 | public struct Sphere 32 | { 33 | /// 34 | /// The position of the sphere in model space. 35 | /// 36 | public Vector3 Position; 37 | 38 | /// 39 | /// The radius of the sphere. 40 | /// 41 | public float Radius; 42 | 43 | /// 44 | /// Initializes a new instance of the struct from a position and a radius. 45 | /// 46 | /// The sphere's position in model space. 47 | /// The sphere's radius. 48 | public Sphere(Vector3 inPosition, float inRadius) 49 | { 50 | Position = inPosition; 51 | Radius = inRadius; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /libwarcraft/Core/Structures/SplineKey.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SplineKey.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.IO; 24 | using Warcraft.Core.Extensions; 25 | 26 | namespace Warcraft.Core.Structures 27 | { 28 | /// 29 | /// Represents a key value in a spline. 30 | /// 31 | /// The type of the key. 32 | public struct SplineKey 33 | { 34 | /// 35 | /// Gets or sets the value of the key. 36 | /// 37 | public T Value { get; set; } 38 | 39 | /// 40 | /// Gets or sets the in tangent of the key. 41 | /// 42 | public T InTangent { get; set; } 43 | 44 | /// 45 | /// Gets or sets the out tangent of the key. 46 | /// 47 | public T OutTangent { get; set; } 48 | 49 | /// 50 | /// Initializes a new instance of the struct. 51 | /// 52 | /// The reader to use when reading the key. 53 | public SplineKey(BinaryReader br) 54 | { 55 | Value = br.Read(); 56 | InTangent = br.Read(); 57 | OutTangent = br.Read(); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /libwarcraft/Core/WarcraftVersion.cs: -------------------------------------------------------------------------------- 1 | // 2 | // WarcraftVersion.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.Core 24 | { 25 | /// 26 | /// World of Warcraft versions by expansion. 27 | /// 28 | public enum WarcraftVersion : uint 29 | { 30 | /// 31 | /// It's not known what version this is. 32 | /// 33 | Unknown = 0, 34 | 35 | /// 36 | /// Classic World of Warcraft, also referred to as "Vanilla". 37 | /// 38 | Classic = 1, 39 | 40 | /// 41 | /// World of Warcraft: The Burning Crusade 42 | /// 43 | BurningCrusade = 2, 44 | 45 | /// 46 | /// World of Warcraft: Wrath of the Lich King 47 | /// 48 | Wrath = 3, 49 | 50 | /// 51 | /// World of Warcraft: Cataclysm 52 | /// 53 | Cataclysm = 4, 54 | 55 | /// 56 | /// World of Warcraft: Mists of Pandaria 57 | /// 58 | Mists = 5, 59 | 60 | /// 61 | /// World of Warcraft: Warlords of Draenor 62 | /// 63 | Warlords = 6, 64 | 65 | /// 66 | /// World of Warcraft: Legion 67 | /// 68 | Legion = 7 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /libwarcraft/DBC/Definitions/CharHairGeosetsRecord.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CharHairGeosetsRecord.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using Warcraft.Core; 24 | using Warcraft.Core.Reflection.DBC; 25 | using Warcraft.DBC.SpecialFields; 26 | 27 | namespace Warcraft.DBC.Definitions 28 | { 29 | /// 30 | /// Represents information about a character's hair geoset. 31 | /// 32 | [DatabaseRecord(DatabaseName.CharHairGeosets)] 33 | public class CharHairGeosetsRecord : DBCRecord 34 | { 35 | /// 36 | /// Gets or sets the ID of the race that the geoset belongs to. 37 | /// 38 | [RecordField(WarcraftVersion.Classic), ForeignKeyInfo(DatabaseName.ChrRaces, nameof(ID))] 39 | public ForeignKey Race { get; set; } = null!; 40 | 41 | /// 42 | /// Gets or sets a value indicating whether the geoset belongs to a female character. 43 | /// 44 | [RecordField(WarcraftVersion.Classic)] 45 | public bool IsFemale { get; set; } 46 | 47 | /// 48 | /// Gets or sets the variation ID of the geoset. 49 | /// 50 | [RecordField(WarcraftVersion.Classic)] 51 | public uint VariationID { get; set; } 52 | 53 | /// 54 | /// Gets or sets the geoset ID. 55 | /// 56 | [RecordField(WarcraftVersion.Classic)] 57 | public uint GeosetID { get; set; } 58 | 59 | /// 60 | /// Gets or sets a value indicating whether the character's scalp should be shown. 61 | /// 62 | [RecordField(WarcraftVersion.Classic)] 63 | public bool ShowScalp { get; set; } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /libwarcraft/DBC/Definitions/CharSectionAvailability.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CharSectionAvailability.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.DBC.Definitions 26 | { 27 | /// 28 | /// Defines flag values for the section. 29 | /// 30 | [Flags] 31 | public enum CharSectionAvailability 32 | { 33 | /// 34 | /// Available during character creation. 35 | /// 36 | CharacterCreate = 0x1, 37 | 38 | /// 39 | /// Available in barber shops. 40 | /// 41 | BarberShop = 0x2, 42 | 43 | /// 44 | /// Available for death knights. 45 | /// 46 | DeathKnight = 0x4, 47 | 48 | /// 49 | /// Available for NPCs. 50 | /// 51 | NPC = 0x8, 52 | 53 | /// 54 | /// Unknown. 55 | /// 56 | Unknown = 0x10 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /libwarcraft/DBC/Definitions/DBCRecord.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DBCRecord.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.Collections.Generic; 24 | using Warcraft.Core; 25 | using Warcraft.Core.Reflection.DBC; 26 | using Warcraft.DBC.SpecialFields; 27 | 28 | namespace Warcraft.DBC.Definitions 29 | { 30 | /// 31 | /// A database record which holds some type of information. 32 | /// 33 | [DatabaseRecord] 34 | public abstract class DBCRecord : IDBCRecord 35 | { 36 | /// 37 | /// Gets or sets the record ID. This is the equivalent of a primary key in an SQL database, and is unique to the 38 | /// record. 39 | /// 40 | [RecordField(WarcraftVersion.Classic)] 41 | public uint ID 42 | { 43 | get; 44 | protected set; 45 | } 46 | 47 | /// 48 | /// Gets or sets the game version this record is valid for. 49 | /// 50 | /// The version. 51 | public WarcraftVersion Version 52 | { 53 | get; 54 | set; 55 | } 56 | 57 | /// 58 | /// Gets a list of any string references in the record. Used for resolving them after they have been loaded. 59 | /// 60 | /// The string references. 61 | public virtual IEnumerable GetStringReferences() 62 | { 63 | yield break; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /libwarcraft/DBC/Definitions/LiquidObjectRecord.cs: -------------------------------------------------------------------------------- 1 | // 2 | // LiquidObjectRecord.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using Warcraft.Core; 24 | using Warcraft.Core.Reflection.DBC; 25 | using Warcraft.DBC.SpecialFields; 26 | 27 | namespace Warcraft.DBC.Definitions 28 | { 29 | /// 30 | /// A database record defining how an in-world liquid behaves. 31 | /// 32 | [DatabaseRecord(DatabaseName.LiquidObject)] 33 | public class LiquidObjectRecord : DBCRecord 34 | { 35 | /// 36 | /// Gets or sets the direction in which the liquid flows. 37 | /// 38 | [RecordField(WarcraftVersion.Cataclysm)] 39 | public float FlowDirection { get; set; } 40 | 41 | /// 42 | /// Gets or sets the speed with which the liquid flows. 43 | /// 44 | [RecordField(WarcraftVersion.Cataclysm)] 45 | public float FlowSpeed { get; set; } 46 | 47 | /// 48 | /// Gets or sets the type of liquid. This is a foreign reference to another table. 49 | /// 50 | [RecordField(WarcraftVersion.Cataclysm), ForeignKeyInfo(DatabaseName.LiquidType, nameof(ID))] 51 | public ForeignKey LiquidType { get; set; } = null!; 52 | 53 | /// 54 | /// Gets or sets whether or not this liquid is fishable. 55 | /// 56 | [RecordField(WarcraftVersion.Cataclysm)] 57 | public uint Fishable { get; set; } 58 | 59 | /// 60 | /// Gets or sets the amount light this liquid reflects. 61 | /// TODO: Unconfirmed behaviour. 62 | /// 63 | [RecordField(WarcraftVersion.Cataclysm)] 64 | public uint Reflection { get; set; } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /libwarcraft/DBC/Definitions/LiquidType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // LiquidType.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.DBC.Definitions 24 | { 25 | /// 26 | /// Holds the various types of liquid. 27 | /// 28 | public enum LiquidType 29 | { 30 | /// 31 | /// Water. Originally, the value was 3. It is now 0. 32 | /// 33 | Water = 0, 34 | 35 | /// 36 | /// Ocean water. Originally, the value was 3. It is now 1. 37 | /// 38 | Ocean = 1, 39 | 40 | /// 41 | /// Magma. Originally, the value was 0. It is now 2. 42 | /// 43 | Magma = 2, 44 | 45 | /// 46 | /// Slime. Originally, the value was 2. It is now 3. 47 | /// 48 | Slime = 3 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /libwarcraft/DBC/Definitions/SoundAmbianceRecord.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SoundAmbianceRecord.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using Warcraft.Core; 24 | using Warcraft.Core.Reflection.DBC; 25 | using Warcraft.DBC.SpecialFields; 26 | 27 | namespace Warcraft.DBC.Definitions 28 | { 29 | /// 30 | /// Defines ambient sounds for a zone. 31 | /// 32 | [DatabaseRecord(DatabaseName.ZoneAmbience)] 33 | public class SoundAmbianceRecord : DBCRecord 34 | { 35 | /// 36 | /// Gets or sets the ambiance sound to play during the day. 37 | /// 38 | [RecordField(WarcraftVersion.Classic), ForeignKeyInfo(DatabaseName.SoundEntries, nameof(ID))] 39 | public ForeignKey AmbianceDay { get; set; } = null!; 40 | 41 | /// 42 | /// Gets or sets the ambiance sound to play during the night. 43 | /// 44 | [RecordField(WarcraftVersion.Classic), ForeignKeyInfo(DatabaseName.SoundEntries, nameof(ID))] 45 | public ForeignKey AmbianceNight { get; set; } = null!; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /libwarcraft/DBC/Definitions/WeaponAnimationFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // WeaponAnimationFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.DBC.Definitions 24 | { 25 | /// 26 | /// Weapon animation flags. 27 | /// 28 | public enum WeaponAnimationFlags : uint 29 | { 30 | /// 31 | /// Ignores the current state of the character's weapons. 32 | /// 33 | None = 0, 34 | 35 | /// 36 | /// Sheathes the weapons for the duration of the animation. 37 | /// 38 | Sheathe = 4, 39 | 40 | /// 41 | /// Sheathes the weapons for the duration of the animation. 42 | /// 43 | Sheathe2 = 16, 44 | 45 | /// 46 | /// Unsheathes the weapons for the duration of the animation. 47 | /// 48 | Unsheathe = 32 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /libwarcraft/DBC/Definitions/ZoneIntroMusicTableRecord.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ZoneIntroMusicTableRecord.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.Collections.Generic; 24 | using Warcraft.Core; 25 | using Warcraft.Core.Reflection.DBC; 26 | using Warcraft.DBC.SpecialFields; 27 | 28 | namespace Warcraft.DBC.Definitions 29 | { 30 | /// 31 | /// Defines the intro music of a zone. 32 | /// 33 | [DatabaseRecord(DatabaseName.ZoneIntroMusicTable)] 34 | public class ZoneIntroMusicTableRecord : DBCRecord 35 | { 36 | /// 37 | /// Gets or sets the name of the intro. 38 | /// 39 | [RecordField(WarcraftVersion.Classic)] 40 | public StringReference Name { get; set; } = null!; 41 | 42 | /// 43 | /// Gets or sets the sound track to use. 44 | /// 45 | [RecordField(WarcraftVersion.Classic)] 46 | [ForeignKeyInfo(DatabaseName.SoundEntries, nameof(ID))] 47 | public ForeignKey Sound { get; set; } = null!; 48 | 49 | /// 50 | /// Gets or sets the priority of the sound. 51 | /// 52 | [RecordField(WarcraftVersion.Classic)] 53 | public uint Priority { get; set; } 54 | 55 | /// 56 | /// Gets or sets the minimum delay in minutes before the sound plays. 57 | /// 58 | [RecordField(WarcraftVersion.Classic)] 59 | public uint MinDelayMinutes { get; set; } 60 | 61 | /// 62 | public override IEnumerable GetStringReferences() 63 | { 64 | yield return Name; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /libwarcraft/DBC/IDBC.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IDBC.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.DBC 24 | { 25 | /// 26 | /// Database file interface. Defines accessors to header values. 27 | /// 28 | public interface IDBC 29 | { 30 | /// 31 | /// Gets the number of held records. 32 | /// 33 | int RecordCount { get; } 34 | 35 | /// 36 | /// Gets the number of fields in each record. 37 | /// 38 | int FieldCount { get; } 39 | 40 | /// 41 | /// Gets the absolute size of each record. 42 | /// 43 | int RecordSize { get; } 44 | 45 | /// 46 | /// Gets the absolute size of the string block. 47 | /// 48 | int StringBlockSize { get; } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /libwarcraft/DBC/IDBCRecord.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IDBCRecord.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.Collections.Generic; 24 | using Warcraft.Core; 25 | using Warcraft.DBC.SpecialFields; 26 | 27 | namespace Warcraft.DBC 28 | { 29 | /// 30 | /// Database record interface. 31 | /// 32 | public interface IDBCRecord 33 | { 34 | /// 35 | /// Gets the ID of the record. 36 | /// 37 | uint ID { get; } 38 | 39 | /// 40 | /// Gets or sets the game version the record is valid for. 41 | /// 42 | WarcraftVersion Version { get; set; } 43 | 44 | /// 45 | /// Gets the string references (if any) in the record. 46 | /// 47 | /// The references. 48 | IEnumerable GetStringReferences(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /libwarcraft/DBC/SpecialFields/ForeignKey.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ForeignKey.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.DBC.SpecialFields 24 | { 25 | /// 26 | /// Represents a field that references a record in another database. 27 | /// 28 | /// The field's container type. 29 | public class ForeignKey 30 | { 31 | /// 32 | /// Gets or sets the database the key refers to. 33 | /// 34 | public DatabaseName Database 35 | { 36 | get; 37 | protected set; 38 | } 39 | 40 | /// 41 | /// Gets or sets the name of the field the key refers to. 42 | /// 43 | public string Field 44 | { 45 | get; 46 | protected set; 47 | } 48 | 49 | /// 50 | /// Gets or sets the value of the key. 51 | /// 52 | public T Key 53 | { 54 | get; 55 | protected set; 56 | } 57 | 58 | /// 59 | /// Initializes a new instance of the class. 60 | /// 61 | /// The database the key refers to. 62 | /// The name of the field the key refers to. 63 | /// The value of the key. 64 | public ForeignKey(DatabaseName inDatabase, string inField, T key) 65 | { 66 | Database = inDatabase; 67 | Field = inField; 68 | Key = key; 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /libwarcraft/DBC/SpecialFields/StringReference.cs: -------------------------------------------------------------------------------- 1 | // 2 | // StringReference.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.DBC.SpecialFields 24 | { 25 | /// 26 | /// Represents a reference to a string in the database. 27 | /// 28 | public class StringReference 29 | { 30 | /// 31 | /// Gets the relative offset into the database file's string block. 32 | /// 33 | public uint Offset 34 | { 35 | get; 36 | private set; 37 | } 38 | 39 | /// 40 | /// Gets or sets the actual string. 41 | /// 42 | public string? Value { get; set; } 43 | 44 | /// 45 | /// Initializes a new instance of the class. 46 | /// 47 | /// The relative offset into the database file's string block. 48 | public StringReference(uint inOffset) 49 | { 50 | Offset = inOffset; 51 | } 52 | 53 | /// 54 | public override string ToString() 55 | { 56 | return Value ?? "[Unresolved]"; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /libwarcraft/MDX/Animation/MDXAnimationSequenceFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXAnimationSequenceFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.MDX.Animation 26 | { 27 | /// 28 | /// Defines modifying flags for an animation sequence. 29 | /// 30 | [Flags] 31 | public enum MDXAnimationSequenceFlags : uint 32 | { 33 | /// 34 | /// The blend animation should be set. 35 | /// 36 | SetBlendAnimation = 0x01, 37 | 38 | /// 39 | /// Unknown. 40 | /// 41 | Unknown1 = 0x02, 42 | 43 | /// 44 | /// Unknown. 45 | /// 46 | Unknown2 = 0x04, 47 | 48 | /// 49 | /// Unknown. 50 | /// 51 | Unknown3 = 0x08, 52 | 53 | /// 54 | /// This animation was loaded as a low-priority sequence. 55 | /// 56 | LoadedAsLowPrioritySequence = 0x10, 57 | 58 | /// 59 | /// This animation is looping. 60 | /// 61 | Looping = 0x20, 62 | 63 | /// 64 | /// This animation is aliased, and has another animation that will follow it. 65 | /// 66 | IsAliasedAndHasFollowupAnimation = 0x40, 67 | 68 | /// 69 | /// This animation is blended. 70 | /// 71 | IsBlended = 0x80, 72 | 73 | /// 74 | /// The sequence is locally stored. 75 | /// 76 | LocallyStoredSequence = 0x100 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /libwarcraft/MDX/Animation/MDXBoneFlag.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXBoneFlag.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.MDX.Animation 24 | { 25 | /// 26 | /// Defines various bone flags. 27 | /// 28 | public enum MDXBoneFlag : uint 29 | { 30 | /// 31 | /// The bone is a spherical billboard. 32 | /// 33 | SphericalBillboard = 0x8, 34 | 35 | /// 36 | /// The bone is a cylindrical billboard, rotating around the X axis. 37 | /// 38 | CylindricalBillboardLockedX = 0x10, 39 | 40 | /// 41 | /// The bone is a cylindrical billboard, rotating around the Y axis. 42 | /// 43 | CylindricalBillboardLockedY = 0x20, 44 | 45 | /// 46 | /// The bone is a cylindrical billboard, rotating around the Z axis. 47 | /// 48 | CylindricalBillboardLockedZ = 0x40, 49 | 50 | /// 51 | /// The bone is transformed. 52 | /// 53 | Transformed = 0x200, 54 | 55 | /// 56 | /// The bone is a kinematic bone. 57 | /// 58 | KinematicBone = 0x400, 59 | 60 | /// 61 | /// The bone has scaled animation. 62 | /// 63 | ScaledAnimation = 0x1000 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /libwarcraft/MDX/Animation/MDXColourAnimation.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXColourAnimation.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.IO; 24 | using Warcraft.Core; 25 | using Warcraft.Core.Extensions; 26 | using Warcraft.Core.Interfaces; 27 | using Warcraft.Core.Structures; 28 | 29 | namespace Warcraft.MDX.Animation 30 | { 31 | /// 32 | /// Represents a colour animation. 33 | /// 34 | public class MDXColourAnimation : IVersionedClass 35 | { 36 | /// 37 | /// Gets or sets the colour track. 38 | /// 39 | public MDXTrack ColourTrack { get; set; } 40 | 41 | /// 42 | /// Gets or sets the opacity track. 43 | /// 44 | public MDXTrack OpacityTrack { get; set; } 45 | 46 | /// 47 | /// Initializes a new instance of the class. 48 | /// 49 | /// The reader to read the instance from. 50 | /// The version to read the instance in the context of. 51 | public MDXColourAnimation(BinaryReader br, WarcraftVersion version) 52 | { 53 | ColourTrack = br.ReadMDXTrack(version); 54 | OpacityTrack = br.ReadMDXTrack(version); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /libwarcraft/MDX/Animation/MDXPlayableAnimationFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXPlayableAnimationFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.MDX.Animation 26 | { 27 | /// 28 | /// Flags for how an animation should be played. 29 | /// 30 | [Flags] 31 | public enum MDXPlayableAnimationFlags : short 32 | { 33 | /// 34 | /// Normal playback. 35 | /// 36 | PlayNormally = 0, 37 | 38 | /// 39 | /// Reversed playback. 40 | /// 41 | PlayReversed = 1, 42 | 43 | /// 44 | /// The animation is frozen (typically at time index 0). 45 | /// 46 | Freeze = 3 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /libwarcraft/MDX/Animation/MDXPlayableAnimationLookupTableEntry.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXPlayableAnimationLookupTableEntry.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.MDX.Animation 24 | { 25 | /// 26 | /// An entry in the playable animation lookup table. 27 | /// 28 | public class MDXPlayableAnimationLookupTableEntry 29 | { 30 | /// 31 | /// Gets or sets the fallback animation ID. 32 | /// 33 | public short FallbackAnimationID { get; set; } 34 | 35 | /// 36 | /// Gets or sets the animation flags. 37 | /// 38 | public MDXPlayableAnimationFlags Flags { get; set; } 39 | 40 | /// 41 | /// Initializes a new instance of the class. 42 | /// 43 | /// The fallback animation. 44 | /// The flags. 45 | public MDXPlayableAnimationLookupTableEntry(short inFallbackAnimationID, MDXPlayableAnimationFlags inFlags) 46 | { 47 | FallbackAnimationID = inFallbackAnimationID; 48 | Flags = inFlags; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /libwarcraft/MDX/Animation/MDXTextureTransform.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXTextureTransform.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.IO; 24 | using System.Numerics; 25 | using Warcraft.Core; 26 | using Warcraft.Core.Extensions; 27 | using Warcraft.Core.Interfaces; 28 | 29 | namespace Warcraft.MDX.Animation 30 | { 31 | /// 32 | /// Defines a texture transformation animation. 33 | /// 34 | public class MDXTextureTransform : IVersionedClass 35 | { 36 | /// 37 | /// Gets or sets the texture translation. 38 | /// 39 | public MDXTrack Translation { get; set; } 40 | 41 | /// 42 | /// Gets or sets the texture rotation. 43 | /// 44 | public MDXTrack Rotation { get; set; } 45 | 46 | /// 47 | /// Gets or sets the texture scale. 48 | /// 49 | public MDXTrack Scale { get; set; } 50 | 51 | /// 52 | /// Initializes a new instance of the class. 53 | /// 54 | /// The reader to read the instance from. 55 | /// The version to read the instance in the context of. 56 | public MDXTextureTransform(BinaryReader br, WarcraftVersion version) 57 | { 58 | Translation = br.ReadMDXTrack(version); 59 | Rotation = br.ReadMDXTrack(version); 60 | Scale = br.ReadMDXTrack(version); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /libwarcraft/MDX/Animation/MDXTextureWeight.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXTextureWeight.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.IO; 24 | using Warcraft.Core; 25 | using Warcraft.Core.Extensions; 26 | using Warcraft.Core.Interfaces; 27 | 28 | namespace Warcraft.MDX.Animation 29 | { 30 | /// 31 | /// Defines a texture weight animation. 32 | /// 33 | public class MDXTextureWeight : IVersionedClass 34 | { 35 | /// 36 | /// Gets or sets the weight track. 37 | /// 38 | public MDXTrack Weight { get; set; } 39 | 40 | /// 41 | /// Initializes a new instance of the class. 42 | /// 43 | /// The reader to read the instance from. 44 | /// The version to read the instance in the context of. 45 | public MDXTextureWeight(BinaryReader br, WarcraftVersion version) 46 | { 47 | Weight = br.ReadMDXTrack(version); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /libwarcraft/MDX/Gameplay/MDXCameraType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXCameraType.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.MDX.Gameplay 24 | { 25 | /// 26 | /// Defines the various camera types. 27 | /// 28 | public enum MDXCameraType : short 29 | { 30 | /// 31 | /// A general camera - narration, character camera, etc. 32 | /// 33 | Other = -1, 34 | 35 | /// 36 | /// A portrait camera. 37 | /// 38 | Portrait = 0, 39 | 40 | /// 41 | /// A character info camera. 42 | /// 43 | CharacterInfo = 1, 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /libwarcraft/MDX/Geometry/MDXVertexProperty.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXVertexProperty.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.Collections.Generic; 24 | using JetBrains.Annotations; 25 | 26 | namespace Warcraft.MDX.Geometry 27 | { 28 | /// 29 | /// A quartet of bone indices into the , which are associated with a vertex. 30 | /// 31 | [PublicAPI] 32 | public class MDXVertexProperty 33 | { 34 | /// 35 | /// Gets a list of bone indices. 36 | /// 37 | public List BoneIndices { get; } = new List(); 38 | 39 | /// 40 | /// Initializes a new instance of the class. 41 | /// 42 | /// The first bone. 43 | /// The second bone. 44 | /// The third bone. 45 | /// The fourth bone. 46 | public MDXVertexProperty(byte inBoneA, byte inBoneB, byte inBoneC, byte inBoneD) 47 | { 48 | BoneIndices.Add(inBoneA); 49 | BoneIndices.Add(inBoneB); 50 | BoneIndices.Add(inBoneC); 51 | BoneIndices.Add(inBoneD); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /libwarcraft/MDX/ModelObjectFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ModelObjectFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | using System; 23 | 24 | namespace Warcraft.MDX 25 | { 26 | /// 27 | /// Defines various model flags. 28 | /// 29 | [Flags] 30 | public enum ModelObjectFlags : uint 31 | { 32 | /// 33 | /// The model is tilted on the X axis. 34 | /// 35 | TiltX = 0x1, 36 | 37 | /// 38 | /// The model is tilted on the Y axis. 39 | /// 40 | TiltY = 0x2, 41 | 42 | /// 43 | /// The model has blend mode overrides. 44 | /// 45 | HasBlendModeOverrides = 0x8, 46 | 47 | /// 48 | /// The model has physics data. 49 | /// 50 | HasPhysicsData = 0x20, 51 | 52 | /// 53 | /// The model has skin LODs. 54 | /// 55 | HasSkinLODs = 0x80, 56 | 57 | /// 58 | /// Unknown. Camera-related. 59 | /// 60 | UnknownCameraFlag = 0x100 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /libwarcraft/MDX/Visual/FX/MDXParticleEmitter.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXParticleEmitter.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.MDX.Visual.FX 24 | { 25 | /// 26 | /// Represents a particle emitter. 27 | /// 28 | public class MDXParticleEmitter 29 | { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /libwarcraft/MDX/Visual/MDXLightType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXLightType.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.MDX.Visual 24 | { 25 | /// 26 | /// Defines light types. 27 | /// 28 | public enum MDXLightType : ushort 29 | { 30 | /// 31 | /// A directional light, like a sun. 32 | /// 33 | Directional = 0, 34 | 35 | /// 36 | /// A point light, like a lightbulb. 37 | /// 38 | Point = 1 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /libwarcraft/MDX/Visual/MDXRenderBatchFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXRenderBatchFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.MDX.Visual 26 | { 27 | /// 28 | /// Defines the render flags of a batch. 29 | /// 30 | [Flags] 31 | public enum MDXRenderBatchFlags : byte 32 | { 33 | /// 34 | /// The batch is animated. 35 | /// 36 | Animated = 0x0, 37 | 38 | /// 39 | /// The materials are inverted somehow. 40 | /// 41 | Invert = 0x1, 42 | 43 | /// 44 | /// The batch has some sort of transformation. 45 | /// 46 | Transform = 0x2, 47 | 48 | /// 49 | /// The batch is projected somehow. 50 | /// 51 | Projected = 0x4, 52 | 53 | /// 54 | /// Unknown, something batch compatible. 55 | /// 56 | Static = 0x10, 57 | 58 | /// 59 | /// Unknown, something to do with projected textures. 60 | /// 61 | Projected2 = 0x20, 62 | 63 | /// 64 | /// Uses texture weights somehow. 65 | /// 66 | Weighted = 0x40 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /libwarcraft/MDX/Visual/MDXRenderFlag.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXRenderFlag.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.MDX.Visual 26 | { 27 | /// 28 | /// Render flags for the whole model, or for a section of it. 29 | /// 30 | [Flags] 31 | public enum MDXRenderFlag : ushort 32 | { 33 | /// 34 | /// The model is unlit. 35 | /// 36 | Unlit = 0x1, 37 | 38 | /// 39 | /// The model is unaffected by fog. 40 | /// 41 | NoFog = 0x2, 42 | 43 | /// 44 | /// The model's textures are two-sided. 45 | /// 46 | TwoSided = 0x4, 47 | 48 | /// 49 | /// Unknown. 50 | /// 51 | Unknown = 0x8, 52 | 53 | /// 54 | /// The model's Z buffer is disabled. 55 | /// 56 | DisableZBuffering = 0x10 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /libwarcraft/MDX/Visual/MDXTexture.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXTexture.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.IO; 24 | using System.Linq; 25 | using Warcraft.Core.Extensions; 26 | 27 | namespace Warcraft.MDX.Visual 28 | { 29 | /// 30 | /// Represents a texture in a model. 31 | /// 32 | public class MDXTexture 33 | { 34 | /// 35 | /// Gets or sets the texture type. 36 | /// 37 | public MDXTextureType TextureType { get; set; } 38 | 39 | /// 40 | /// Gets or sets the flags. 41 | /// 42 | public MDXTextureFlags Flags { get; set; } 43 | 44 | /// 45 | /// Gets or sets the path to the texture. 46 | /// 47 | public string Filename { get; set; } 48 | 49 | /// 50 | /// Initializes a new instance of the class. 51 | /// 52 | /// The reader to read the instance from. 53 | public MDXTexture(BinaryReader br) 54 | { 55 | TextureType = (MDXTextureType)br.ReadUInt32(); 56 | Flags = (MDXTextureFlags)br.ReadUInt32(); 57 | 58 | // This points off to a null-terminated string, so we'll pop off the null byte when deserializing it 59 | Filename = new string(br.ReadMDXArray().ToArray()).TrimEnd('\0'); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /libwarcraft/MDX/Visual/MDXTextureFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXTextureFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.MDX.Visual 24 | { 25 | /// 26 | /// Flags for model textures. 27 | /// 28 | public enum MDXTextureFlags : uint 29 | { 30 | /// 31 | /// The texture should wrap around the X axis. 32 | /// 33 | TextureWrapX = 1, 34 | 35 | /// 36 | /// The texture should wrap around the Y axis. 37 | /// 38 | TextureWrapY = 2 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /libwarcraft/MDX/Visual/MDXTextureMappingType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MDXTextureMappingType.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.MDX.Visual 24 | { 25 | /// 26 | /// Texture mapping types. 27 | /// 28 | public enum MDXTextureMappingType : short 29 | { 30 | /// 31 | /// Uses the first texture slot. 32 | /// 33 | T1 = 0, 34 | 35 | /// 36 | /// Uses the second texture slot. 37 | /// 38 | T2 = 1, 39 | 40 | /// 41 | /// Uses the environment mapping texture slot. 42 | /// 43 | Environment = -1 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /libwarcraft/MPQ/Attributes/AttributeTypes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AttributeTypes.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | using JetBrains.Annotations; 25 | 26 | namespace Warcraft.MPQ.Attributes 27 | { 28 | /// 29 | /// The types of attributes which a file might have. 30 | /// 31 | [PublicAPI, Flags] 32 | public enum AttributeTypes : uint 33 | { 34 | /// 35 | /// The file has a CRC32 hash. 36 | /// 37 | CRC32 = 0x00000001, 38 | 39 | /// 40 | /// The file has a timestamp. 41 | /// 42 | Timestamp = 0x00000002, 43 | 44 | /// 45 | /// This file has an MD5 hash. 46 | /// 47 | MD5 = 0x00000004 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /libwarcraft/MPQ/Attributes/FileAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // FileAttributes.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.MPQ.Attributes 24 | { 25 | /// 26 | /// A set of file attributes for a file in an MPQ archive. 27 | /// 28 | public class FileAttributes 29 | { 30 | /// 31 | /// Gets or sets the CRC32 hash of the file. 32 | /// 33 | public uint CRC32 { get; set; } 34 | 35 | /// 36 | /// Gets or sets the last modified timestamp of the file. 37 | /// 38 | public ulong Timestamp { get; set; } 39 | 40 | /// 41 | /// Gets or sets the MD5 hash of the file. 42 | /// 43 | public string MD5 { get; set; } 44 | 45 | /// 46 | /// Initializes a new instance of the class. 47 | /// 48 | /// The CRC32 hash of the file. 49 | /// The last modified timestamp of the file. 50 | /// The MD5 hash of the file. 51 | public FileAttributes(uint crc32, ulong timestamp, string md5) 52 | { 53 | CRC32 = crc32; 54 | Timestamp = timestamp; 55 | MD5 = md5; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /libwarcraft/MPQ/Crypto/HashType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // HashType.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using JetBrains.Annotations; 24 | 25 | namespace Warcraft.MPQ.Crypto 26 | { 27 | /// 28 | /// Different types of hashes that can be produced by the hashing function. 29 | /// 30 | [PublicAPI] 31 | public enum HashType : uint 32 | { 33 | /// 34 | /// The hash algorithm used for determining the home entry of a file in the hash table. 35 | /// 36 | FileHashTableOffset = 0, 37 | 38 | /// 39 | /// One of the two algorithms used to generate hashes for filenames. 40 | /// 41 | FilePathA = 1, 42 | 43 | /// 44 | /// One of the two algorithms used to generate hashes for filenames. 45 | /// 46 | FilePathB = 2, 47 | 48 | /// 49 | /// The hash algorithm used for generating encryption keys. 50 | /// 51 | FileKey = 3 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /libwarcraft/MPQ/Crypto/SigningStrength.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SigningStrength.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using JetBrains.Annotations; 24 | 25 | namespace Warcraft.MPQ.Crypto 26 | { 27 | /// 28 | /// The strength of the signing algorithm. 29 | /// 30 | [PublicAPI] 31 | public enum SigningStrength : byte 32 | { 33 | /// 34 | /// Weak signing. 35 | /// 36 | Weak, 37 | 38 | /// 39 | /// Strong signing. 40 | /// 41 | Strong 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /libwarcraft/MPQ/Crypto/WeakPackageSignature.cs: -------------------------------------------------------------------------------- 1 | // 2 | // WeakPackageSignature.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.IO; 24 | using JetBrains.Annotations; 25 | 26 | namespace Warcraft.MPQ.Crypto 27 | { 28 | /// 29 | /// Represents a weak archive signature. 30 | /// 31 | [PublicAPI] 32 | public class WeakPackageSignature 33 | { 34 | /// 35 | /// Holds the internal filename of the signature file. 36 | /// 37 | [PublicAPI, NotNull] 38 | public const string InternalFilename = "(signature)"; 39 | 40 | /// 41 | /// Gets the package signature. 42 | /// 43 | [PublicAPI, NotNull] 44 | public byte[] PackageSignature { get; } 45 | 46 | /// 47 | /// Initializes a new instance of the class. 48 | /// 49 | /// The binary data. 50 | [PublicAPI] 51 | public WeakPackageSignature([NotNull] byte[] data) 52 | { 53 | if (data.Length != 72) 54 | { 55 | throw new InvalidDataException("The provided data had an invalid length."); 56 | } 57 | 58 | using var ms = new MemoryStream(data); 59 | using var br = new BinaryReader(ms); 60 | var identifier = br.ReadInt64(); 61 | 62 | if (identifier != 0) 63 | { 64 | throw new InvalidDataException("The signature did not begin with 0."); 65 | } 66 | 67 | PackageSignature = br.ReadBytes(64); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /libwarcraft/MPQ/MPQFormat.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MPQFormat.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using JetBrains.Annotations; 24 | 25 | namespace Warcraft.MPQ 26 | { 27 | /// 28 | /// This enum contains all known versions of the MPQ archive format. 29 | /// 30 | [PublicAPI] 31 | public enum MPQFormat : ushort 32 | { 33 | /// 34 | /// The basic archive format. Used in games prior to and including Classic World of Warcraft. 35 | /// 36 | Basic = 0, 37 | 38 | /// 39 | /// The extended v1 archive format. Used in games after and including World of Warcraft: The Burning Crusade. 40 | /// 41 | ExtendedV1 = 1 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /libwarcraft/TRS/TRS.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TRS.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.Collections.Generic; 24 | using System.IO; 25 | 26 | namespace Warcraft.TRS 27 | { 28 | /// 29 | /// Represents a hash translation table file. 30 | /// 31 | public class TRS 32 | { 33 | /// 34 | /// Gets the mapping table. 35 | /// 36 | public Dictionary HashMappings { get; } = new Dictionary(); 37 | 38 | /// 39 | /// Initializes a new instance of the class. 40 | /// 41 | /// The binary data. 42 | public TRS(byte[] data) 43 | { 44 | using var ms = new MemoryStream(data); 45 | using TextReader tr = new StreamReader(ms); 46 | while (ms.Position != ms.Length) 47 | { 48 | var mappingLine = tr.ReadLine(); 49 | if (mappingLine is null) 50 | { 51 | continue; 52 | } 53 | 54 | if (mappingLine.StartsWith("dir:")) 55 | { 56 | continue; 57 | } 58 | 59 | var lineParts = mappingLine.Split('\t'); 60 | HashMappings.Add(lineParts[0], lineParts[1]); 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /libwarcraft/WDT/Chunks/AreaInfoFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AreaInfoFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.WDT.Chunks 24 | { 25 | /// 26 | /// Defines various area information flags. 27 | /// 28 | public enum AreaInfoFlags : uint 29 | { 30 | /// 31 | /// This tile has terrain in it. 32 | /// 33 | HasTerrainData = 1, 34 | 35 | /// 36 | /// This tile is loaded. This flag is never set in serialized files, and is only a runtime construct. 37 | /// 38 | IsLoaded = 2, 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /libwarcraft/WDT/Chunks/WorldTableFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // WorldTableFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.WDT.Chunks 26 | { 27 | /// 28 | /// Defines a set of world table flags. 29 | /// 30 | [Flags] 31 | public enum WorldTableFlags : uint 32 | { 33 | /// 34 | /// This world uses global models. 35 | /// 36 | UsesGlobalModels = 0x01, 37 | 38 | /// 39 | /// This world uses vertex shading. 40 | /// 41 | UsesVertexShading = 0x02, 42 | 43 | /// 44 | /// This world uses environment mapping. 45 | /// 46 | UsesEnvironmentMapping = 0x04, 47 | 48 | /// 49 | /// This world disables some unknown rendering flag. 50 | /// 51 | DisableUnknownRenderingFlag = 0x08, 52 | 53 | /// 54 | /// This world uses vertex lighting. 55 | /// 56 | UsesVertexLighting = 0x10, 57 | 58 | /// 59 | /// Ground normals should be flipped in this world. 60 | /// 61 | FlipGroundNormals = 0x20, 62 | 63 | /// 64 | /// An unknown flag. 65 | /// 66 | Unknown = 0x40, 67 | 68 | /// 69 | /// This world uses hard alpha falloff. 70 | /// 71 | UsesHardAlphaFalloff = 0x80, 72 | 73 | /// 74 | /// Unknown. Alpha related. 75 | /// 76 | UnknownHardAlphaRelated = 0x100, 77 | 78 | /// 79 | /// Unknown. 80 | /// 81 | UnknownContinentRelated = 0x8000 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /libwarcraft/WMO/GroupFile/Chunks/BSPPlaneType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // BSPPlaneType.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.WMO.GroupFile.Chunks 24 | { 25 | /// 26 | /// Gets the plane type of a BSP node. 27 | /// 28 | public enum BSPPlaneType : ushort 29 | { 30 | /// 31 | /// Divides in the YZ direction. 32 | /// 33 | YZ = 0, 34 | 35 | /// 36 | /// Divides in the XZ direction. 37 | /// 38 | XZ = 1, 39 | 40 | /// 41 | /// Divides in the XY direction. 42 | /// 43 | XY = 2, 44 | 45 | /// 46 | /// A leaf node. 47 | /// 48 | Leaf = 4 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /libwarcraft/WMO/GroupFile/Chunks/PolygonMaterialFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // PolygonMaterialFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.WMO.GroupFile.Chunks 24 | { 25 | /// 26 | /// Gets the material flags of the polygon. 27 | /// 28 | public enum PolygonMaterialFlags : byte 29 | { 30 | /// 31 | /// An unknown value. 32 | /// 33 | Unknown1 = 0x01, 34 | 35 | /// 36 | /// Collision is disabled between this polygon and the camera. 37 | /// 38 | NoCameraCollide = 0x02, 39 | 40 | /// 41 | /// This polygon is a small detail. 42 | /// 43 | Detail = 0x04, 44 | 45 | /// 46 | /// This polygon has detail. 47 | /// 48 | HasCollision = 0x08, 49 | 50 | /// 51 | /// This polygon serves as hinting information for something. 52 | /// 53 | Hint = 0x10, 54 | 55 | /// 56 | /// This polygon should be rendered. 57 | /// 58 | Render = 0x20, 59 | 60 | /// 61 | /// An unknown value. 62 | /// 63 | Unknown2 = 0x40, 64 | 65 | /// 66 | /// This polygon has collision. 67 | /// 68 | CollideHit = 0x80 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /libwarcraft/WMO/RootFile/Chunks/DoodadInstanceFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DoodadInstanceFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.WMO.RootFile.Chunks 26 | { 27 | /// 28 | /// A set of flags which can affect the way a doodad instance is rendered. 29 | /// 30 | [Flags] 31 | public enum DoodadInstanceFlags : byte 32 | { 33 | /// 34 | /// Accepts a projected texture. 35 | /// 36 | AcceptProjectedTexture = 0x1, 37 | 38 | /// 39 | /// Unknown. Related to lighting. 40 | /// 41 | Unknown1 = 0x2, 42 | 43 | /// 44 | /// Unknown. 45 | /// 46 | Unknown2 = 0x4, 47 | 48 | /// 49 | /// Unknown. 50 | /// 51 | Unknown3 = 0x8 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /libwarcraft/WMO/RootFile/Chunks/FogFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // FogFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.WMO.RootFile.Chunks 26 | { 27 | /// 28 | /// Defines a set of fog flags. 29 | /// 30 | [Flags] 31 | public enum FogFlags : uint 32 | { 33 | /// 34 | /// The fog has an infinite radius. 35 | /// 36 | InfiniteRadius = 0x01, 37 | 38 | /// 39 | /// An unused value. 40 | /// 41 | Unused1 = 0x02, 42 | 43 | /// 44 | /// An unused value. 45 | /// 46 | Unused2 = 0x04, 47 | 48 | /// 49 | /// An unknown value. 50 | /// 51 | Unknown1 = 0x10, 52 | 53 | // Followed by 27 unused values 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /libwarcraft/WMO/RootFile/Chunks/LightType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // LightType.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | namespace Warcraft.WMO.RootFile.Chunks 24 | { 25 | /// 26 | /// Defines a set of light types. 27 | /// 28 | public enum LightType : byte 29 | { 30 | /// 31 | /// A point light source, like a lightbulb. 32 | /// 33 | Point = 0, 34 | 35 | /// 36 | /// A directional spotlight, like a, well, spotlight. 37 | /// 38 | Spot = 1, 39 | 40 | /// 41 | /// A directional global light, like the sun. 42 | /// 43 | Directional = 2, 44 | 45 | /// 46 | /// A general ambient light level. 47 | /// 48 | Ambient = 3 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /libwarcraft/WMO/RootFile/Chunks/MaterialFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MaterialFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.WMO.RootFile.Chunks 26 | { 27 | /// 28 | /// Defines a set of model material flags. 29 | /// 30 | [Flags] 31 | public enum MaterialFlags : uint 32 | { 33 | /// 34 | /// The material is unlit. 35 | /// 36 | Unlit = 0x1, 37 | 38 | /// 39 | /// The material ignores fog. 40 | /// 41 | Unfogged = 0x2, 42 | 43 | /// 44 | /// The material is two-sided. 45 | /// 46 | TwoSided = 0x4, 47 | 48 | /// 49 | /// The material should only use exterior lighting. 50 | /// 51 | ExteriorLighting = 0x8, 52 | 53 | /// 54 | /// Disables lighting and shading during night. Used for windows and lamps which glow at night. 55 | /// 56 | UnlitDuringNight = 0x10, 57 | 58 | /// 59 | /// The material is a window. 60 | /// 61 | Window = 0x20, 62 | 63 | /// 64 | /// The textures should wrap with clamping on the S axis. 65 | /// 66 | TextureWrappingClampS = 0x40, 67 | 68 | /// 69 | /// The textures should wrap with clamping on the T axis. 70 | /// 71 | TextureWrappingClampT = 0x80, 72 | 73 | /// 74 | /// An unknwon value. 75 | /// 76 | Unknown = 0x100 77 | 78 | // Followed by 23 unused flags 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /libwarcraft/WMO/RootFile/Chunks/VisibleBlock.cs: -------------------------------------------------------------------------------- 1 | // 2 | // VisibleBlock.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System.IO; 24 | using Warcraft.Core.Interfaces; 25 | 26 | namespace Warcraft.WMO.RootFile.Chunks 27 | { 28 | /// 29 | /// Represents a visible block. 30 | /// 31 | public class VisibleBlock : IBinarySerializable 32 | { 33 | /// 34 | /// Gets or sets the first vertex index. 35 | /// 36 | public ushort FirstVertexIndex { get; set; } 37 | 38 | /// 39 | /// Gets or sets the vertex count. 40 | /// 41 | public ushort VertexCount { get; set; } 42 | 43 | /// 44 | /// Initializes a new instance of the class. 45 | /// 46 | /// The binary data. 47 | public VisibleBlock(byte[] inData) 48 | { 49 | using var ms = new MemoryStream(inData); 50 | using var br = new BinaryReader(ms); 51 | FirstVertexIndex = br.ReadUInt16(); 52 | VertexCount = br.ReadUInt16(); 53 | } 54 | 55 | /// 56 | /// Gets the serialized size of the instance. 57 | /// 58 | /// The size. 59 | public static int GetSize() 60 | { 61 | return 4; 62 | } 63 | 64 | /// 65 | public byte[] Serialize() 66 | { 67 | using var ms = new MemoryStream(); 68 | using (var bw = new BinaryWriter(ms)) 69 | { 70 | bw.Write(FirstVertexIndex); 71 | bw.Write(VertexCount); 72 | } 73 | 74 | return ms.ToArray(); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /libwarcraft/WMO/RootFile/RootFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // RootFlags.cs 3 | // 4 | // Author: 5 | // Jarl Gullberg 6 | // 7 | // Copyright (c) 2017 Jarl Gullberg 8 | // 9 | // This program is free software: you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 3 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program. If not, see . 21 | // 22 | 23 | using System; 24 | 25 | namespace Warcraft.WMO.RootFile 26 | { 27 | /// 28 | /// Defines a set of flags for the root model file. 29 | /// 30 | [Flags] 31 | public enum RootFlags : uint 32 | { 33 | /// 34 | /// Vertexes should not be attenuated based on portal distance. 35 | /// 36 | DoNotAttenuateVerticesBasedOnPortalDistance = 0x01, 37 | 38 | /// 39 | /// The new rendering path should be used for this model. 40 | /// 41 | UseUnifiedRenderingPath = 0x02, 42 | 43 | /// 44 | /// Use the real liquid type from the database instead of the local one. 45 | /// 46 | UseDatabaseLiquid = 0x04, 47 | 48 | /// 49 | /// The model has outdoor groups. 50 | /// 51 | HasOutdoorGroups = 0x08, 52 | 53 | // Followed by 28 unused flags 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /libwarcraft/libwarcraft.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Warcraft 4 | libwarcraft 5 | netcoreapp3.1;netstandard2.0 6 | true 7 | true 8 | 9 | 10 | 11 | $(AssemblyName) 12 | Jarl Gullberg 13 | Jarl Gullberg 2020 14 | 3.0.0-alpha6 15 | An open-source World of Warcraft file format library. 16 | 17 | 18 | 19 | libwarcraft 20 | GPL-3.0-or-later 21 | true 22 | https://github.com/WowDevTools/libwarcraft 23 | https://github.com/WowDevTools/libwarcraft 24 | Modernization and tooling updates. 25 | warcraft;cross-platform;file-format 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /libwarcraft/libwarcraft.csproj.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | 3 | True 4 | --------------------------------------------------------------------------------