├── .circleci └── config.yml ├── .editorconfig ├── .gitattributes ├── .gitignore ├── .travis.yml ├── README.md ├── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jitpack.yml ├── license.txt ├── licenses ├── antlr4.txt ├── java.txt └── jmpq-v3.txt ├── settings.gradle ├── src ├── main │ ├── antlr │ │ ├── FDF.g4 │ │ ├── Jass.g4 │ │ ├── LightJass.g4 │ │ └── SLK.g4 │ └── java │ │ ├── archive │ │ ├── Enum.java │ │ └── meta.txt │ │ └── net │ │ └── moonlightflower │ │ └── wc3libs │ │ ├── app │ │ ├── Env.java │ │ ├── Imports.java │ │ ├── Minimap.java │ │ ├── ObjDefs.java │ │ ├── ObjMerger.java │ │ ├── Options.java │ │ ├── Placements.java │ │ ├── ProfileCleaner.java │ │ ├── SLKCleaner.java │ │ ├── Skin.java │ │ ├── Splats.java │ │ └── Trigs.java │ │ ├── bin │ │ ├── Bin.java │ │ ├── BinInputStream.java │ │ ├── BinOutputStream.java │ │ ├── BinState.java │ │ ├── BinStream.java │ │ ├── Format.java │ │ ├── GameExe.java │ │ ├── MetaState.java │ │ ├── ObjMod.java │ │ ├── Packed.java │ │ ├── Reader.java │ │ ├── StdBinInputStream.java │ │ ├── StreamHandler.java │ │ ├── Wc3BinInputStream.java │ │ ├── Wc3BinOutputStream.java │ │ ├── Writer.java │ │ ├── ZCompression.java │ │ └── app │ │ │ ├── DOO.java │ │ │ ├── DOO_UNITS.java │ │ │ ├── IMP.java │ │ │ ├── IMP_0x1.java │ │ │ ├── MMP.java │ │ │ ├── MapFlag.java │ │ │ ├── MapFooter.java │ │ │ ├── MapHeader.java │ │ │ ├── SHD.java │ │ │ ├── W3C.java │ │ │ ├── W3E.java │ │ │ ├── W3F.java │ │ │ ├── W3I.java │ │ │ ├── W3R.java │ │ │ ├── W3S.java │ │ │ ├── W3V.java │ │ │ ├── W3VUncompressed.java │ │ │ ├── WCT.java │ │ │ ├── WPM.java │ │ │ ├── WTG.java │ │ │ └── objMod │ │ │ ├── W3A.java │ │ │ ├── W3B.java │ │ │ ├── W3D.java │ │ │ ├── W3H.java │ │ │ ├── W3Q.java │ │ │ ├── W3T.java │ │ │ └── W3U.java │ │ ├── dataTypes │ │ ├── DataList.java │ │ ├── DataType.java │ │ ├── DataTypeInfo.java │ │ ├── FileType.java │ │ ├── Serializable.java │ │ ├── Stringable.java │ │ ├── War3Num.java │ │ └── app │ │ │ ├── AIPlaceType.java │ │ │ ├── AbilCode.java │ │ │ ├── AbilId.java │ │ │ ├── AlphaMode.java │ │ │ ├── ArmorSound.java │ │ │ ├── AttackBits.java │ │ │ ├── AttackTable.java │ │ │ ├── AttackType.java │ │ │ ├── AttributeType.java │ │ │ ├── BlendMode.java │ │ │ ├── Bounds.java │ │ │ ├── BuffCode.java │ │ │ ├── BuffId.java │ │ │ ├── CliffClass.java │ │ │ ├── CliffId.java │ │ │ ├── Color.java │ │ │ ├── ColorARGB.java │ │ │ ├── CombatSound.java │ │ │ ├── CombatTarget.java │ │ │ ├── Controller.java │ │ │ ├── Coords2DF.java │ │ │ ├── Coords2DI.java │ │ │ ├── Coords3DF.java │ │ │ ├── Coords3DI.java │ │ │ ├── Coords4DF.java │ │ │ ├── DeathType.java │ │ │ ├── DefType.java │ │ │ ├── DefenseTable.java │ │ │ ├── DestructableClass.java │ │ │ ├── DestructableId.java │ │ │ ├── DoodId.java │ │ │ ├── DoodadClass.java │ │ │ ├── Effect.java │ │ │ ├── EffectList.java │ │ │ ├── FlagsInt.java │ │ │ ├── Icon.java │ │ │ ├── ItemClass.java │ │ │ ├── ItemId.java │ │ │ ├── ItemList.java │ │ │ ├── LightningId.java │ │ │ ├── LightningList.java │ │ │ ├── LoadingScreenBackground.java │ │ │ ├── Model.java │ │ │ ├── MoveType.java │ │ │ ├── MusicFile.java │ │ │ ├── OrderString.java │ │ │ ├── PathingFlag.java │ │ │ ├── PathingPrevent.java │ │ │ ├── PathingRequire.java │ │ │ ├── PathingTex.java │ │ │ ├── PlayerColor.java │ │ │ ├── RegenType.java │ │ │ ├── Req.java │ │ │ ├── RequireList.java │ │ │ ├── ShadowImage.java │ │ │ ├── ShadowTex.java │ │ │ ├── SoundLabel.java │ │ │ ├── SpawnId.java │ │ │ ├── SpellDetail.java │ │ │ ├── SplatId.java │ │ │ ├── StringList.java │ │ │ ├── TargetList.java │ │ │ ├── TeamColor.java │ │ │ ├── TechId.java │ │ │ ├── TechList.java │ │ │ ├── TerrainFog.java │ │ │ ├── TerrainFogType.java │ │ │ ├── Tex.java │ │ │ ├── TileId.java │ │ │ ├── TileIdList.java │ │ │ ├── Tileset.java │ │ │ ├── UberSplatId.java │ │ │ ├── UnitClass.java │ │ │ ├── UnitId.java │ │ │ ├── UnitList.java │ │ │ ├── UnitRace.java │ │ │ ├── UnitSound.java │ │ │ ├── UpgradeClass.java │ │ │ ├── UpgradeEffect.java │ │ │ ├── UpgradeId.java │ │ │ ├── VersionFlags.java │ │ │ ├── War3Bool.java │ │ │ ├── War3Char.java │ │ │ ├── War3Int.java │ │ │ ├── War3Real.java │ │ │ ├── War3String.java │ │ │ ├── WaterCode.java │ │ │ ├── WaterId.java │ │ │ ├── WeaponType.java │ │ │ └── WeatherId.java │ │ ├── misc │ │ ├── AsyncTask.java │ │ ├── Boundable.java │ │ ├── ColorCodeTransformer.java │ │ ├── FieldId.java │ │ ├── Flag.java │ │ ├── GamePrefetch.java │ │ ├── Id.java │ │ ├── IsNum.java │ │ ├── Math.java │ │ ├── Mergeable.java │ │ ├── MetaFieldId.java │ │ ├── ObjId.java │ │ ├── ObservableArrayList.java │ │ ├── ObservableArrayListView.java │ │ ├── ObservableLinkedHashSet.java │ │ ├── ObservableLinkedHashSetView.java │ │ ├── PathMap.java │ │ ├── Printable.java │ │ ├── Printer.java │ │ ├── ProcCaller.java │ │ ├── Raster.java │ │ ├── ShadowMap.java │ │ ├── Size.java │ │ ├── State.java │ │ ├── StringHash.java │ │ ├── Translator.java │ │ ├── TypeInfo.java │ │ ├── TypeInfoed.java │ │ ├── UnsupportedFormatException.java │ │ ├── WinRegistryHandler.java │ │ ├── audio │ │ │ └── WAV.java │ │ ├── exeversion │ │ │ ├── CallableInputStreamProcessor.java │ │ │ ├── ExeVersion.java │ │ │ ├── ExeVersionPe.java │ │ │ ├── ExeVersionWmic.java │ │ │ └── VersionExtractionException.java │ │ ├── image │ │ │ ├── BLP.java │ │ │ ├── FxImg.java │ │ │ ├── JPG.java │ │ │ ├── TGA.java │ │ │ ├── TGADecoder.java │ │ │ ├── TGAReader.txt │ │ │ ├── Wc3Img.java │ │ │ └── Wc3RasterImg.java │ │ └── model │ │ │ ├── MDX.java │ │ │ └── mdx │ │ │ ├── Attachment.java │ │ │ ├── AttachmentChunk.java │ │ │ ├── Bone.java │ │ │ ├── BoneChunk.java │ │ │ ├── Camera.java │ │ │ ├── CameraChunk.java │ │ │ ├── Chunk.java │ │ │ ├── CollisionShape.java │ │ │ ├── CollisionShapeChunk.java │ │ │ ├── EventObject.java │ │ │ ├── EventObjectChunk.java │ │ │ ├── EventObjectTrack.java │ │ │ ├── EventObjectTrackChunk.java │ │ │ ├── Extent.java │ │ │ ├── Face.java │ │ │ ├── FaceChunk.java │ │ │ ├── FaceGroupChunk.java │ │ │ ├── FaceTypeGroup.java │ │ │ ├── FaceTypeGroupChunk.java │ │ │ ├── Geoset.java │ │ │ ├── GeosetAnim.java │ │ │ ├── GeosetAnimChunk.java │ │ │ ├── GeosetChunk.java │ │ │ ├── GlobalSequence.java │ │ │ ├── GlobalSequenceChunk.java │ │ │ ├── Helper.java │ │ │ ├── HelperChunk.java │ │ │ ├── IndexReference.java │ │ │ ├── Layer.java │ │ │ ├── Light.java │ │ │ ├── LightChunk.java │ │ │ ├── MDX.txt │ │ │ ├── MDXObject.java │ │ │ ├── Material.java │ │ │ ├── MaterialChunk.java │ │ │ ├── MatrixGroupChunk.java │ │ │ ├── MatrixIndexChunk.java │ │ │ ├── ModelInfoChunk.java │ │ │ ├── Node.java │ │ │ ├── ParticleEmitter.java │ │ │ ├── ParticleEmitter2.java │ │ │ ├── ParticleEmitter2Chunk.java │ │ │ ├── ParticleEmitterChunk.java │ │ │ ├── PivotPoint.java │ │ │ ├── PivotPointChunk.java │ │ │ ├── RibbonEmitter.java │ │ │ ├── RibbonEmitterChunk.java │ │ │ ├── Sequence.java │ │ │ ├── SequenceChunk.java │ │ │ ├── Sound.java │ │ │ ├── SoundChunk.java │ │ │ ├── TexAnim.java │ │ │ ├── TexAnimChunk.java │ │ │ ├── TexCoord.java │ │ │ ├── TexCoordSet.java │ │ │ ├── TexCoordSetChunk.java │ │ │ ├── Texture.java │ │ │ ├── TextureChunk.java │ │ │ ├── Track.java │ │ │ ├── TrackChunk.java │ │ │ ├── VersionChunk.java │ │ │ ├── Vertex.java │ │ │ ├── VertexChunk.java │ │ │ ├── VertexGroup.java │ │ │ ├── VertexGroupChunk.java │ │ │ ├── VertexNormalChunk.java │ │ │ ├── VisibilityTrack.java │ │ │ └── links.txt │ │ ├── port │ │ ├── AlreadyTriedException.java │ │ ├── Context.java │ │ ├── EditorExeFinder.java │ │ ├── Finder.java │ │ ├── GameDirFinder.java │ │ ├── GameExeFinder.java │ │ ├── GameVersion.java │ │ ├── GameVersionFinder.java │ │ ├── JMpqPort.java │ │ ├── MapsDirFinder.java │ │ ├── MpqPort.java │ │ ├── NotFoundException.java │ │ ├── Orient.java │ │ ├── StdGameDirFinder.java │ │ ├── StdGameExeFinder.java │ │ ├── StdGameVersionFinder.java │ │ ├── UnsupportedPlatformException.java │ │ ├── War3MPQs.java │ │ ├── mac │ │ │ ├── MacGameDirFinder.java │ │ │ ├── MacGameExeFinder.java │ │ │ ├── MacGameVersionFinder.java │ │ │ ├── MacMapsDirFinder.java │ │ │ └── PListGameVersionParser.java │ │ └── win │ │ │ ├── WinDefaultGameDirFinder.java │ │ │ ├── WinGameDirFinder.java │ │ │ ├── WinGameExeFinder.java │ │ │ ├── WinGameVersionFinder.java │ │ │ ├── WinMapsDirFinder.java │ │ │ ├── WinTelemetryGameVersionFinder.java │ │ │ └── registry │ │ │ ├── WinRegistryGameDirFinder.java │ │ │ ├── WinRegistryGameExeFinder.java │ │ │ └── WinRegistryGameVersionFinder.java │ │ ├── slk │ │ ├── MetaSLK.java │ │ ├── ObjSLK.java │ │ ├── RawMetaSLK.java │ │ ├── RawSLK.java │ │ ├── SLK.java │ │ ├── SLKState.java │ │ └── app │ │ │ ├── doodads │ │ │ └── DoodSLK.java │ │ │ ├── meta │ │ │ ├── AbilityBuffMetaSLK.java │ │ │ ├── AbilityMetaSLK.java │ │ │ ├── CommonMetaSLK.java │ │ │ ├── DestructableMetaSLK.java │ │ │ ├── DoodadsMetaSLK.java │ │ │ ├── UnitMetaSLK.java │ │ │ ├── UpgradeEffectMetaSLK.java │ │ │ └── UpgradeMetaSLK.java │ │ │ ├── objs │ │ │ ├── AbilSLK.java │ │ │ ├── BuffSLK.java │ │ │ ├── DestructableSLK.java │ │ │ ├── ItemSLK.java │ │ │ ├── UnitAbilsSLK.java │ │ │ ├── UnitBalanceSLK.java │ │ │ ├── UnitDataSLK.java │ │ │ ├── UnitUISLK.java │ │ │ ├── UnitWeaponsSLK.java │ │ │ └── UpgradeSLK.java │ │ │ ├── splats │ │ │ ├── LightningSLK.java │ │ │ ├── SpawnSLK.java │ │ │ ├── SplatSLK.java │ │ │ └── UberSplatSLK.java │ │ │ └── terrainArts │ │ │ ├── CliffSLK.java │ │ │ ├── TerrainSLK.java │ │ │ ├── WaterSLK.java │ │ │ └── WeatherSLK.java │ │ └── txt │ │ ├── FDF.java │ │ ├── PLD.java │ │ ├── Profile.java │ │ ├── TXT.java │ │ ├── TXTSectionId.java │ │ ├── TXTState.java │ │ ├── UTF8.java │ │ ├── WTS.java │ │ └── app │ │ ├── ExtraTXT.java │ │ ├── MiscTXT.java │ │ ├── SkinTXT.java │ │ ├── Telemetry.java │ │ ├── jass │ │ ├── Condition.java │ │ ├── Decl.java │ │ ├── FuncDecl.java │ │ ├── FuncImpl.java │ │ ├── GlobalVarDecl.java │ │ ├── Jass.java │ │ ├── JassScript.java │ │ ├── LightJass.java │ │ ├── LocalVarDecl.java │ │ ├── Param.java │ │ ├── TypeDecl.java │ │ ├── VarDecl.java │ │ ├── expr │ │ │ ├── AnyTypeExpr.java │ │ │ ├── ArrayRead.java │ │ │ ├── Expr.java │ │ │ ├── LightExpr.java │ │ │ ├── Literal.java │ │ │ ├── NullExpr.java │ │ │ ├── Op.java │ │ │ ├── StringConcat.java │ │ │ ├── StringExpr.java │ │ │ ├── VarRef.java │ │ │ ├── bool │ │ │ │ ├── BoolExpr.java │ │ │ │ ├── BoolLiteral.java │ │ │ │ ├── BoolRelation.java │ │ │ │ ├── CodeRelation.java │ │ │ │ ├── Connective.java │ │ │ │ ├── HandleRelation.java │ │ │ │ ├── NullRelation.java │ │ │ │ ├── NumRelation.java │ │ │ │ ├── Relation.java │ │ │ │ ├── StringRelation.java │ │ │ │ └── UnaryBoolExpr.java │ │ │ ├── misc_literal │ │ │ │ ├── CodeLiteral.java │ │ │ │ ├── FuncCall.java │ │ │ │ ├── NullLiteral.java │ │ │ │ └── StringLiteral.java │ │ │ └── num │ │ │ │ ├── CodeExpr.java │ │ │ │ ├── HandleExpr.java │ │ │ │ ├── IntExpr.java │ │ │ │ ├── IntLiteral.java │ │ │ │ ├── IntProd.java │ │ │ │ ├── IntSum.java │ │ │ │ ├── IntUnary.java │ │ │ │ ├── NumExpr.java │ │ │ │ ├── NumLiteral.java │ │ │ │ ├── Prod.java │ │ │ │ ├── RealExpr.java │ │ │ │ ├── RealLiteral.java │ │ │ │ ├── RealProd.java │ │ │ │ ├── RealSum.java │ │ │ │ ├── RealUnary.java │ │ │ │ ├── Sum.java │ │ │ │ └── UnaryNumExpr.java │ │ └── statement │ │ │ ├── CallStatement.java │ │ │ ├── ExitwhenStatement.java │ │ │ ├── LoopStatement.java │ │ │ ├── ReturnStatement.java │ │ │ ├── SelectionStatement.java │ │ │ ├── SetVarStatement.java │ │ │ └── Statement.java │ │ ├── profile │ │ ├── CampaignAbilityFunc.java │ │ ├── CampaignAbilityStrings.java │ │ ├── CampaignUnitFunc.java │ │ ├── CampaignUnitStrings.java │ │ ├── CampaignUpgradeFunc.java │ │ ├── CampaignUpgradeStrings.java │ │ ├── CommandFunc.java │ │ ├── CommandStrings.java │ │ ├── CommonAbilityFunc.java │ │ ├── CommonAbilityStrings.java │ │ ├── HumanAbilityFunc.java │ │ ├── HumanAbilityStrings.java │ │ ├── HumanUnitFunc.java │ │ ├── HumanUnitStrings.java │ │ ├── HumanUpgradeFunc.java │ │ ├── HumanUpgradeStrings.java │ │ ├── ItemAbilityFunc.java │ │ ├── ItemAbilityStrings.java │ │ ├── ItemFunc.java │ │ ├── ItemStrings.java │ │ ├── MiscData.java │ │ ├── MiscGame.java │ │ ├── NeutralAbilityFunc.java │ │ ├── NeutralAbilityStrings.java │ │ ├── NeutralUnitFunc.java │ │ ├── NeutralUnitStrings.java │ │ ├── NeutralUpgradeFunc.java │ │ ├── NeutralUpgradeStrings.java │ │ ├── NightElfAbilityFunc.java │ │ ├── NightElfAbilityStrings.java │ │ ├── NightElfUnitFunc.java │ │ ├── NightElfUnitStrings.java │ │ ├── NightElfUpgradeFunc.java │ │ ├── NightElfUpgradeStrings.java │ │ ├── OrcAbilityFunc.java │ │ ├── OrcAbilityStrings.java │ │ ├── OrcUnitFunc.java │ │ ├── OrcUnitStrings.java │ │ ├── OrcUpgradeFunc.java │ │ ├── OrcUpgradeStrings.java │ │ ├── UndeadAbilityFunc.java │ │ ├── UndeadAbilityStrings.java │ │ ├── UndeadUnitFunc.java │ │ ├── UndeadUnitStrings.java │ │ ├── UndeadUpgradeFunc.java │ │ └── UndeadUpgradeStrings.java │ │ └── ui │ │ ├── MiscDataTXT.java │ │ └── TriggerDataTXT.java └── test │ ├── java │ ├── misc │ │ ├── MapTest.java │ │ └── RegistryTest.java │ └── wc3libs │ │ ├── bin │ │ ├── GameExeTest.java │ │ └── app │ │ │ ├── DOOTest.java │ │ │ ├── DOO_UNITSTest.java │ │ │ ├── IMPTest.java │ │ │ ├── MMPTest.java │ │ │ ├── MapFooterTest.java │ │ │ ├── MapHeaderTest.java │ │ │ ├── SHDTest.java │ │ │ ├── W3ATest.java │ │ │ ├── W3BTest.java │ │ │ ├── W3CTest.java │ │ │ ├── W3DTest.java │ │ │ ├── W3ETest.java │ │ │ ├── W3HTest.java │ │ │ ├── W3ITest.java │ │ │ ├── W3QTest.java │ │ │ ├── W3RTest.java │ │ │ ├── W3STest.java │ │ │ ├── W3TTest.java │ │ │ ├── W3UTest.java │ │ │ ├── WCTTest.java │ │ │ ├── WPMTest.java │ │ │ └── WTGTest.java │ │ ├── dataTypes │ │ └── app │ │ │ ├── AIPlaceTypeTest.java │ │ │ ├── ArmorSoundTest.java │ │ │ ├── AttackBitsTest.java │ │ │ ├── AttackTypeTest.java │ │ │ ├── AttributeTypeTest.java │ │ │ ├── CombatSoundTest.java │ │ │ ├── CombatTargetTest.java │ │ │ ├── ControllerTest.java │ │ │ ├── DeathTypeTest.java │ │ │ ├── DefTypeTest.java │ │ │ ├── DestructableClassTest.java │ │ │ ├── DoodadClassTest.java │ │ │ ├── ItemClassTest.java │ │ │ ├── MoveTypeTest.java │ │ │ ├── PathingFlagTest.java │ │ │ ├── RegenTypeTest.java │ │ │ ├── SpellDetailTest.java │ │ │ ├── TerrainFogTypeTest.java │ │ │ ├── TilesetTest.java │ │ │ ├── UnitClassTest.java │ │ │ ├── UnitRaceTest.java │ │ │ ├── UpgradeClassTest.java │ │ │ ├── UpgradeEffectTest.java │ │ │ ├── VersionFlagsTest.java │ │ │ └── WeaponTypeTest.java │ │ ├── misc │ │ ├── AsyncTaskTest.java │ │ ├── BLPTest.java │ │ ├── ColorCodeTransformerTest.java │ │ ├── ExeVersionTest.java │ │ ├── JPGTest.java │ │ ├── MathTest.java │ │ ├── ObjMergerTest.java │ │ ├── ObservableArrayListTest.java │ │ ├── SizeTest.java │ │ ├── StateTest.java │ │ ├── StringHashTest.java │ │ ├── TGATest.java │ │ ├── WAVTest.java │ │ ├── Wc3LibTest.java │ │ └── model │ │ │ └── MDXTest.java │ │ ├── port │ │ ├── GameExeFinderTest.java │ │ └── mac │ │ │ └── MacGameVersionFinderTest.java │ │ ├── slk │ │ ├── AbilSLKTest.java │ │ ├── BuffSLKTest.java │ │ ├── CleanSLKTest.java │ │ ├── DestructableSLKTest.java │ │ ├── DoodSLKTest.java │ │ ├── ItemSLKTest.java │ │ ├── SLKTest.java │ │ ├── UnitAbilitiesSLKTest.java │ │ ├── UnitBalanceSLKTest.java │ │ ├── UnitDataSLKTest.java │ │ ├── UnitUISLKTest.java │ │ ├── UnitWeaponsSLKTest.java │ │ └── UpgradeSLKTest.java │ │ ├── txt │ │ ├── FDFTest.java │ │ ├── JassTest.java │ │ ├── PLDTest.java │ │ ├── ProfileCleanTest.java │ │ ├── SLKTest.java │ │ ├── TxtsTest.java │ │ └── WTSTest.java │ │ └── util │ │ └── MurmurHash.java │ └── resources │ ├── fdfs │ └── GlobalStrings.fdf │ ├── images │ ├── test.blp │ ├── test.jpg │ └── test.tga │ ├── in.w3x │ ├── jass │ ├── compiled.j │ ├── compiled2.j │ ├── compiled3.j │ ├── compiled4.j │ └── dwc.j │ ├── pefile │ └── dotnet-pe-version.dll │ ├── slks │ ├── AbilityBuffData.slk │ ├── AbilityBuffMetaData.slk │ ├── AbilityData.slk │ ├── AbilityDataSmall.slk │ ├── DestructableData.slk │ ├── Doodads.slk │ ├── ItemData.slk │ ├── UnitAbilities.slk │ ├── UnitBalance.slk │ ├── UnitData.slk │ ├── UnitMetaData.slk │ ├── UnitUI.slk │ ├── UnitWeapons.slk │ ├── UpgradeData.slk │ ├── UpgradeMetaData.slk │ └── reduce │ │ ├── UnitWeapons.slk │ │ └── UnitWeaponsReduced.slk │ ├── test.wav │ ├── txts │ ├── MiscData.txt │ ├── UnitStrings.txt │ └── generic │ │ ├── CampaignAbilityFunc.txt │ │ └── CampaignAbilityStrings.txt │ └── wc3data │ ├── DOO │ ├── war3map.doo │ └── war3map_with_skin.doo │ ├── DOO_UNITS │ └── war3mapUnits.doo │ ├── Doodads │ ├── DoodadMetaData.slk │ └── Doodads.slk │ ├── Infos │ ├── war3map.w3i │ ├── war3map2.w3i │ ├── war3map3.w3i │ ├── war3map31_HD.w3i │ ├── war3map31_HD2.w3i │ ├── war3map31_SD.w3i │ ├── war3map31_SD_HD.w3i │ ├── war3map31_SD_Jass.w3i │ ├── war3map31_SD_Lua.w3i │ ├── war3map_1F.w3i │ └── war3map_ga.w3i │ ├── J │ └── war3map.j │ ├── MMP │ └── war3map.mmp │ ├── Map │ ├── Forest_Defense_0.18w.w3x │ └── Forest_Defense_0.18w_sign.w3x │ ├── Models │ └── PackHorse.mdx │ ├── SHD │ └── war3map.shd │ ├── UI │ └── TriggerData.txt │ ├── Units │ ├── AbilityBuffData.slk │ ├── AbilityBuffMetaData.slk │ ├── AbilityData.slk │ ├── AbilityMetaData.slk │ ├── CampaignAbilityFunc.txt │ ├── CampaignAbilityStrings.txt │ ├── CampaignUnitFunc.txt │ ├── CampaignUnitStrings.txt │ ├── CampaignUpgradeStrings.txt │ ├── CommandFunc.txt │ ├── CommandStrings.txt │ ├── CommonAbilityFunc.txt │ ├── CommonAbilityStrings.txt │ ├── DestructableData.slk │ ├── DestructableMetaData.slk │ ├── HumanAbilityFunc.txt │ ├── HumanAbilityStrings.txt │ ├── HumanUnitFunc.txt │ ├── HumanUnitStrings.txt │ ├── HumanUpgradeFunc.txt │ ├── HumanUpgradeStrings.txt │ ├── ItemAbilityFunc.txt │ ├── ItemAbilityStrings.txt │ ├── ItemData.slk │ ├── ItemFunc.txt │ ├── ItemStrings.txt │ ├── NeutralAbilityFunc.txt │ ├── NeutralAbilityStrings.txt │ ├── NeutralUnitFunc.txt │ ├── NeutralUnitStrings.txt │ ├── NeutralUpgradeFunc.txt │ ├── NightElfAbilityFunc.txt │ ├── NightElfAbilityStrings.txt │ ├── NightElfUnitFunc.txt │ ├── NightElfUnitStrings.txt │ ├── NightElfUpgradeFunc.txt │ ├── NightElfUpgradeStrings.txt │ ├── OrcAbilityFunc.txt │ ├── OrcAbilityStrings.txt │ ├── OrcUnitFunc.txt │ ├── OrcUnitStrings.txt │ ├── OrcUpgradeFunc.txt │ ├── OrcUpgradeStrings.txt │ ├── UndeadAbilityFunc.txt │ ├── UndeadAbilityStrings.txt │ ├── UndeadUnitFunc.txt │ ├── UndeadUnitStrings.txt │ ├── UndeadUpgradeFunc.txt │ ├── UndeadUpgradeStrings.txt │ ├── UnitAbilities.slk │ ├── UnitBalance.slk │ ├── UnitData.slk │ ├── UnitMetaData.slk │ ├── UnitWeapons.slk │ ├── UpgradeData.slk │ ├── UpgradeMetaData.slk │ └── unitUI.slk │ ├── W3A │ ├── threeLetterId.w3a │ ├── war3map.w3a │ └── war3map_format3.w3a │ ├── W3B │ └── war3map.w3b │ ├── W3C │ └── war3map.w3c │ ├── W3D │ └── war3map.w3d │ ├── W3E │ └── war3map.w3e │ ├── W3H │ └── war3map.w3h │ ├── W3I │ └── war3map.w3i │ ├── W3Q │ └── war3map.w3q │ ├── W3R │ └── war3map.w3r │ ├── W3S │ └── war3map.w3s │ ├── W3T │ └── war3map.w3t │ ├── W3U │ ├── war3map.w3u │ ├── war3mapBorked.w3u │ └── war3mapReforged.w3u │ ├── WCT │ └── war3map.wct │ ├── WPM │ └── war3map.wpm │ ├── WTG │ └── war3map.wtg │ ├── WTS │ └── war3map.wts │ ├── context │ └── Info.plist │ └── war3map.imp └── wc3libs_doc └── src └── specs └── bin ├── DOO ├── SHD ├── W3E ├── WPM ├── links ├── mapFooter └── mapHeader /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | docker: 5 | - image: cimg/openjdk:11.0 6 | 7 | working_directory: ~/repo 8 | 9 | environment: 10 | # Customize the JVM maximum heap limit 11 | JVM_OPTS: -Xmx3200m 12 | TERM: dumb 13 | 14 | steps: 15 | - checkout 16 | 17 | - restore_cache: 18 | keys: 19 | - v1-dependencies-{{ checksum "build.gradle" }} 20 | - v1-dependencies- 21 | 22 | - run: ./gradlew dependencies 23 | 24 | - save_cache: 25 | paths: 26 | - ~/.gradle 27 | key: v1-dependencies-{{ checksum "build.gradle" }} 28 | 29 | - run: ./gradlew clean check jar 30 | 31 | - run: ./gradlew test 32 | 33 | - run: ./gradlew jacocoTestReport 34 | 35 | - run: bash <(curl -s https://codecov.io/bash) 36 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | indent_size = 4 3 | end_of_line = lf 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.java text=auto 2 | *.java text eol=lf 3 | *.j linguist-vendored=true 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build/ 3 | gradle.properties 4 | .idea/ 5 | 6 | # Ignore Gradle GUI config 7 | gradle-wc3libs.app.setting 8 | 9 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 10 | !gradle-wrapper.jar 11 | 12 | # Cache of project 13 | .gradletasknamecache 14 | 15 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 16 | # gradle/wrapper/gradle-wrapper.properties 17 | src/test/resources/mpqs/war3.w3x 18 | src/test/resources/war3.w3x 19 | 20 | out/ 21 | src/test/resources/mpqs/War3x.w3x 22 | src/test/resources/War3x.w3x 23 | *.iml 24 | *.classpath 25 | /bin/ 26 | /.project 27 | src/main/java/net/moonlightflower/wc3libs/antlr 28 | .settings/ 29 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | branches: 2 | except: 3 | - travis 4 | 5 | language: java 6 | jdk: 7 | - openjdk10 8 | 9 | before_install: 10 | - chmod +x gradlew 11 | 12 | cache: 13 | directories: 14 | - $HOME/.gradle/wrapper 15 | - $HOME/.gradle/caches/modules-2/files-2.1 16 | 17 | script: 18 | - ./gradlew clean check jar --info 19 | - ./gradlew test --info 20 | 21 | after_success: 22 | - ./gradlew jacocoTestReport 23 | - bash <(curl -s https://codecov.io/bash) 24 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /jitpack.yml: -------------------------------------------------------------------------------- 1 | jdk: 2 | - openjdk11 -------------------------------------------------------------------------------- /licenses/java.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/licenses/java.txt -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This settings file was auto generated by the Gradle buildInit task 3 | * by 'Crigges' at '13.03.16 17:44' with Gradle 2.6 4 | * 5 | * The settings file is used to specify which projects to include in your build. 6 | * In a single project build this file can be empty or even removed. 7 | * 8 | * Detailed information about configuring a multi-project build in Gradle can be found 9 | * in the user guide at https://docs.gradle.org/2.6/userguide/multi_project_builds.html 10 | */ 11 | 12 | /* 13 | // To declare projects as part of a multi-project build use the 'include' method 14 | include 'shared' 15 | include 'api' 16 | include 'services:webservice' 17 | */ 18 | 19 | rootProject.name = 'wc3libs' 20 | -------------------------------------------------------------------------------- /src/main/antlr/FDF.g4: -------------------------------------------------------------------------------- 1 | // Define a grammar called FDF 2 | grammar FDF; 3 | 4 | options { 5 | language = Java; 6 | } 7 | 8 | @header { 9 | package net.moonlightflower.wc3libs.antlr; 10 | } 11 | 12 | CURLY_L : '{' ; 13 | CURLY_R : '}' ; 14 | COMMA : ',' ; 15 | WS : (' ' | '\t' | '\r' | '\n') ; 16 | 17 | ID : ID_START (ID_TAIL)* ; 18 | fragment ID_START : [A-Za-z] ; 19 | fragment ID_TAIL : [A-Z] | [a-z] | [0-9] | '_' ; 20 | 21 | STRING_LITERAL : '"' (~('"' | '\\' | '\r' | '\n') | '\\' ('"' | '\\'))* '"'; 22 | 23 | root : (WS | stringList)* ; 24 | 25 | stringList : 'StringList' (WS)* CURLY_L (WS)* stringListContent (WS)* CURLY_R ; 26 | 27 | stringListContent : (stringAssign (WS)*) (COMMA (WS)* stringAssign (WS)*)* COMMA? ; 28 | 29 | stringAssign : id=ID (WS)+ val=STRING_LITERAL ; 30 | 31 | 32 | 33 | 34 | 35 | 36 | //STRING_ASSIGN : STRING_LITERAL (WS)+ STRING_LITERAL ; 37 | //STRING_LITERAL : '"' (~('"' | '\\' | '\r' | '\n') | '\\' ('"' | '\\''))* '"'; -------------------------------------------------------------------------------- /src/main/antlr/SLK.g4: -------------------------------------------------------------------------------- 1 | // Define a grammar called SLK 2 | grammar SLK; 3 | 4 | options { 5 | language = Java; 6 | } 7 | 8 | @header { 9 | package net.moonlightflower.wc3libs.antlr; 10 | } 11 | 12 | RECORD_PART: 13 | (STRING_UNQUOTED STRING_QUOTED?) | STRING_QUOTED; 14 | 15 | fragment STRING_UNQUOTED: 16 | ( EscapeSequence | ~('"'|'\r'|'\n'|';') )+; 17 | 18 | fragment STRING_QUOTED: 19 | '"' ( EscapeSequence | ~('"'|'\r'|'\n') | NEW_LINE )* '"'; 20 | 21 | fragment EscapeSequence: '\\' [abfnrtvz"'\\]; 22 | 23 | SEP: 24 | ';'; 25 | NEW_LINE: 26 | ('\r\n' | '\n' | '\r')+ ; 27 | WS: 28 | (' ' | '\t')+ -> skip ; 29 | 30 | root: 31 | records+=record (NEW_LINE+ records+=record)* 32 | NEW_LINE* 33 | ; 34 | 35 | record: 36 | type=RECORD_PART (SEP recordPart?)*; 37 | 38 | recordPart: 39 | RECORD_PART; -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/app/Imports.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.app; 2 | 3 | public class Imports { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/app/Minimap.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.app; 2 | 3 | import java.io.File; 4 | 5 | import net.moonlightflower.wc3libs.bin.app.MMP; 6 | 7 | public class Minimap { 8 | public final static File BACKGROUND_BLP_GAME_PATH = new File("war3mapMap.blp"); 9 | public final static File BACKGROUND_TGA_GAME_PATH = new File("war3mapMap.tga"); 10 | 11 | public final static File PREVIEW_BLP_GAME_PATH = new File("war3mapPreview.blp"); 12 | public final static File PREVIEW_TGA_GAME_PATH = new File("war3mapPreview.tga"); 13 | 14 | private MMP _mmp; 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/app/ObjDefs.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.app.objMod.W3A; 4 | import net.moonlightflower.wc3libs.bin.app.objMod.W3B; 5 | import net.moonlightflower.wc3libs.bin.app.objMod.W3D; 6 | import net.moonlightflower.wc3libs.bin.app.objMod.W3H; 7 | import net.moonlightflower.wc3libs.bin.app.objMod.W3T; 8 | import net.moonlightflower.wc3libs.bin.app.objMod.W3U; 9 | 10 | public class ObjDefs { 11 | private W3A _w3a; 12 | private W3B _w3b; 13 | private W3D _w3d; 14 | private W3H _w3h; 15 | private W3T _w3t; 16 | private W3U _w3u; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/app/Options.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.app; 2 | 3 | import java.io.File; 4 | 5 | import net.moonlightflower.wc3libs.bin.app.W3I; 6 | import net.moonlightflower.wc3libs.txt.app.MiscTXT; 7 | 8 | import javax.annotation.Nonnull; 9 | 10 | public class Options { 11 | public final static File PREVIEW_PIC_GAME_PATH = new File("war3mapPreview.tga"); 12 | 13 | private MiscTXT _misc; 14 | private W3I _w3i; 15 | 16 | public Options(@Nonnull W3I w3i, @Nonnull MiscTXT misc) { 17 | _w3i = w3i; 18 | _misc = misc; 19 | } 20 | 21 | public Options() { 22 | this(new W3I(), new MiscTXT()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/app/ProfileCleaner.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.app; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import static net.moonlightflower.wc3libs.txt.Profile.UnitState.EDITOR_NAME; 6 | import static net.moonlightflower.wc3libs.txt.Profile.UnitState.EDITOR_SUFFIX; 7 | 8 | public class ProfileCleaner { 9 | 10 | public static void clean(Profile txt) { 11 | txt.getObjs().entrySet().forEach(entry -> { 12 | if (entry.getValue().containsField(EDITOR_SUFFIX.getFieldId())) { 13 | entry.getValue().removeField(EDITOR_SUFFIX.getFieldId()); 14 | } 15 | if (entry.getValue().containsField(EDITOR_NAME.getFieldId())) { 16 | entry.getValue().removeField(EDITOR_NAME.getFieldId()); 17 | } 18 | }); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/app/Skin.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.app; 2 | 3 | public class Skin { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/bin/Bin.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.bin; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.DataType; 4 | 5 | import javax.annotation.Nonnull; 6 | import javax.annotation.Nullable; 7 | import java.util.LinkedHashMap; 8 | import java.util.Map; 9 | 10 | public abstract class Bin { 11 | private final Map, DataType> _vals = new LinkedHashMap<>(); 12 | 13 | @Nonnull 14 | public Map, DataType> getVals() { 15 | return new LinkedHashMap<>(_vals); 16 | } 17 | 18 | public DataType get(@Nonnull BinState state) { 19 | return getVals().get(state); 20 | } 21 | 22 | public void set(@Nonnull BinState state, @Nullable DataType val) { 23 | _vals.put(state, val); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/bin/BinState.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.bin; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.DataType; 4 | import net.moonlightflower.wc3libs.dataTypes.DataTypeInfo; 5 | import net.moonlightflower.wc3libs.misc.FieldId; 6 | import net.moonlightflower.wc3libs.misc.State; 7 | 8 | import javax.annotation.Nonnull; 9 | import javax.annotation.Nullable; 10 | 11 | public class BinState extends State { 12 | public BinState(@Nonnull String fieldIdS, @Nonnull DataTypeInfo typeInfo, @Nullable T defVal) { 13 | super(FieldId.valueOf(fieldIdS), typeInfo, defVal); 14 | } 15 | 16 | public BinState(@Nonnull String fieldIdS, @Nonnull DataTypeInfo typeInfo) { 17 | this(fieldIdS, typeInfo, (T) typeInfo.getDefVal()); 18 | } 19 | 20 | public BinState(@Nonnull String idString, @Nonnull Class type) { 21 | this(idString, new DataTypeInfo(type)); 22 | } 23 | 24 | public BinState(@Nonnull String idString, @Nonnull Class type, @Nullable T defVal) { 25 | this(idString, new DataTypeInfo(type), defVal); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/bin/MetaState.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.bin; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collection; 5 | import java.util.List; 6 | 7 | import net.moonlightflower.wc3libs.dataTypes.DataType; 8 | import net.moonlightflower.wc3libs.dataTypes.DataTypeInfo; 9 | import net.moonlightflower.wc3libs.misc.MetaFieldId; 10 | import net.moonlightflower.wc3libs.misc.State; 11 | 12 | import javax.annotation.Nonnull; 13 | import javax.annotation.Nullable; 14 | 15 | public class MetaState extends State { 16 | public MetaState(@Nonnull String idS, @Nonnull DataTypeInfo typeInfo, @Nullable T defVal) { 17 | super(MetaFieldId.valueOf(idS), typeInfo, defVal); 18 | } 19 | 20 | public MetaState(@Nonnull String idString, @Nonnull DataTypeInfo typeInfo) { 21 | this(idString, typeInfo, null); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/bin/Reader.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.bin; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public abstract class Reader { 6 | public abstract EncodingFormat getAutoFormat(); 7 | 8 | private EncodingFormat _format = getAutoFormat(); 9 | 10 | @Nonnull 11 | public EncodingFormat getFormat() { 12 | return _format; 13 | } 14 | 15 | public void setFormat(@Nonnull EncodingFormat val) { 16 | _format = val; 17 | } 18 | 19 | private final Wc3BinInputStream _stream; 20 | 21 | @Nonnull 22 | public Wc3BinInputStream getStream() { 23 | return _stream; 24 | } 25 | 26 | public Reader(@Nonnull Wc3BinInputStream stream) { 27 | _stream = stream; 28 | } 29 | 30 | public Reader(@Nonnull Wc3BinInputStream stream, @Nonnull EncodingFormat format) { 31 | _stream = stream; 32 | _format = format; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/bin/StreamHandler.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.bin; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public abstract class StreamHandler { 6 | protected abstract void read(@Nonnull Wc3BinInputStream stream); 7 | protected abstract void write(@Nonnull Wc3BinInputStream stream); 8 | 9 | private Wc3BinInputStream _stream; 10 | 11 | @Nonnull 12 | public Wc3BinInputStream getStream() { 13 | return _stream; 14 | } 15 | 16 | public void execReading() { 17 | read(getStream()); 18 | } 19 | 20 | public void execWriting() { 21 | write(getStream()); 22 | } 23 | 24 | public StreamHandler(@Nonnull Wc3BinInputStream stream) { 25 | _stream = stream; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/bin/Writer.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.bin; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public abstract class Writer { 6 | public abstract EncodingFormat getAutoFormat(); 7 | 8 | private EncodingFormat _format = getAutoFormat(); 9 | 10 | @Nonnull 11 | public EncodingFormat getFormat() { 12 | return _format; 13 | } 14 | 15 | public void setFormat(@Nonnull EncodingFormat val) { 16 | _format = val; 17 | } 18 | 19 | private final Wc3BinOutputStream _stream; 20 | 21 | @Nonnull 22 | public Wc3BinOutputStream getStream() { 23 | return _stream; 24 | } 25 | 26 | public Writer(@Nonnull Wc3BinOutputStream stream) { 27 | _stream = stream; 28 | } 29 | 30 | public Writer(@Nonnull Wc3BinOutputStream stream, @Nonnull EncodingFormat format) { 31 | _stream = stream; 32 | _format = format; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/FileType.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes; 2 | 3 | import java.io.File; 4 | 5 | import net.moonlightflower.wc3libs.dataTypes.app.War3String; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | public class FileType extends War3String { 10 | public FileType(@Nonnull File file) { 11 | super(file.toString()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/Serializable.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes; 2 | 3 | public interface Serializable { 4 | Object toSLKVal(); 5 | Object toTXTVal(); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/Stringable.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes; 2 | 3 | public interface Stringable extends Comparable { 4 | @Override 5 | String toString(); 6 | 7 | @Override 8 | default int compareTo(Stringable o) { 9 | return this.toString().compareTo(o.toString()); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/War3Num.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes; 2 | 3 | public interface War3Num { 4 | float toFloat(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/AbilCode.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.ObjId; 4 | 5 | public class AbilCode extends ObjId { 6 | protected AbilCode(String idString) { 7 | super(idString); 8 | } 9 | 10 | public static AbilCode valueOf(ObjId id) { 11 | return new AbilCode(id.toString()); 12 | } 13 | 14 | public static AbilCode decodeStatic(Object val) { 15 | if (val == null) return null; 16 | 17 | return AbilCode.valueOf(ObjId.valueOf(val.toString())); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/AbilId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.ObjId; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | public class AbilId extends ObjId { 8 | protected AbilId(String idString) { 9 | super(idString); 10 | } 11 | 12 | public static AbilId valueOf(ObjId id) { 13 | return new AbilId(id.toString()); 14 | } 15 | 16 | public static AbilId decodeStatic(Object val) { 17 | if (val == null) return null; 18 | 19 | return AbilId.valueOf(ObjId.valueOf(val.toString())); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/AlphaMode.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | public class AlphaMode extends War3Int { 4 | public AlphaMode(int val) { 5 | super(val); 6 | } 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/ArmorSound.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import javax.annotation.Nonnull; 4 | import javax.annotation.Nullable; 5 | import java.util.LinkedHashMap; 6 | import java.util.Map; 7 | 8 | public class ArmorSound extends War3String { 9 | private final static Map _nameMap = new LinkedHashMap<>(); 10 | 11 | public final static ArmorSound ETHEREAL = new ArmorSound("Ethereal"); 12 | public final static ArmorSound FLESH = new ArmorSound("Flesh"); 13 | public final static ArmorSound METAL = new ArmorSound("Metal"); 14 | public final static ArmorSound STONE = new ArmorSound("Stone"); 15 | public final static ArmorSound WOOD = new ArmorSound("Wood"); 16 | 17 | public ArmorSound(@Nonnull String name) { 18 | super(name); 19 | 20 | _nameMap.put(name, this); 21 | } 22 | 23 | @Nullable 24 | public static ArmorSound valueOf(String name) { 25 | return _nameMap.get(name); 26 | } 27 | 28 | @Override 29 | public ArmorSound decode(Object val) { 30 | return new ArmorSound(val.toString()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/AttackBits.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import javax.annotation.Nullable; 4 | import java.util.LinkedHashMap; 5 | import java.util.Map; 6 | 7 | public class AttackBits extends War3Int { 8 | public static String getTranslatorSection() { 9 | return "attackBits"; 10 | } 11 | 12 | private final static Map _map = new LinkedHashMap<>(); 13 | 14 | public final static AttackBits NONE = new AttackBits(0x0); 15 | public final static AttackBits FIRST = new AttackBits(0x1); 16 | public final static AttackBits SECOND = new AttackBits(0x2); 17 | public final static AttackBits BOTH = new AttackBits(0x3); 18 | 19 | private AttackBits(int val) { 20 | super(val); 21 | 22 | _map.put(val, this); 23 | } 24 | 25 | @Nullable 26 | public static AttackBits valueOf(int val) { 27 | return _map.get(val); 28 | } 29 | 30 | public static AttackBits decodeStatic(Object val) { 31 | if (val != null) 32 | try { 33 | return valueOf(Integer.parseInt(val.toString())); 34 | } catch (NumberFormatException e) { 35 | } 36 | 37 | return null; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/AttackTable.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.DataType; 4 | 5 | public class AttackTable extends DataType { 6 | @Override 7 | public DataType decode(Object val) { 8 | // TODO Auto-generated method stub 9 | return null; 10 | } 11 | 12 | @Override 13 | public Object toSLKVal() { 14 | // TODO Auto-generated method stub 15 | return null; 16 | } 17 | 18 | @Override 19 | public Object toTXTVal() { 20 | // TODO Auto-generated method stub 21 | return null; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/AttributeType.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import javax.annotation.Nonnull; 4 | import javax.annotation.Nullable; 5 | import java.util.LinkedHashMap; 6 | import java.util.Map; 7 | 8 | public class AttributeType extends War3String { 9 | private final static Map _map = new LinkedHashMap<>(); 10 | 11 | public final static AttributeType AGI = new AttributeType("AGI"); 12 | public final static AttributeType INT = new AttributeType("INT"); 13 | public final static AttributeType STR = new AttributeType("STR"); 14 | 15 | @Override 16 | public boolean equals(Object other) { 17 | if (other instanceof AttributeType) 18 | return equals((AttributeType) other); 19 | 20 | return super.equals(other); 21 | } 22 | 23 | public boolean equals(AttributeType other) { 24 | return getVal().equals(other.getVal()); 25 | } 26 | 27 | public AttributeType(@Nonnull String name) { 28 | super(name); 29 | 30 | _map.put(name, this); 31 | } 32 | 33 | @Nullable 34 | public static AttributeType valueOf(@Nonnull String name) { 35 | return _map.get(name); 36 | } 37 | 38 | @Override 39 | public AttributeType decode(Object val) { 40 | return new AttributeType(val.toString()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/BlendMode.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import javax.annotation.Nullable; 4 | import java.util.LinkedHashMap; 5 | import java.util.Map; 6 | 7 | public class BlendMode extends War3Int { 8 | private final static Map _map = new LinkedHashMap<>(); 9 | 10 | private BlendMode(int val) { 11 | super(val); 12 | 13 | _map.put(val, this); 14 | } 15 | 16 | @Nullable 17 | public static BlendMode valueOf(int val) { 18 | return _map.get(val); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/BuffCode.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.ObjId; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | public class BuffCode extends ObjId { 8 | protected BuffCode(String idString) { 9 | super(idString); 10 | } 11 | 12 | @Nonnull 13 | public static BuffCode valueOf(ObjId id) { 14 | return new BuffCode(id.toString()); 15 | } 16 | 17 | public static BuffCode decodeStatic(Object val) { 18 | if (val == null) return null; 19 | 20 | return BuffCode.valueOf(ObjId.valueOf(val.toString())); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/BuffId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.ObjId; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | public class BuffId extends ObjId { 8 | protected BuffId(String idString) { 9 | super(idString); 10 | } 11 | 12 | @Nonnull 13 | public static BuffId valueOf(ObjId id) { 14 | return new BuffId(id.toString()); 15 | } 16 | 17 | public static BuffId decodeStatic(Object val) { 18 | if (val == null) return null; 19 | 20 | return BuffId.valueOf(ObjId.valueOf(val.toString())); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/CliffClass.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import javax.annotation.Nonnull; 4 | import javax.annotation.Nullable; 5 | import java.util.LinkedHashMap; 6 | import java.util.Map; 7 | 8 | public class CliffClass extends War3String { 9 | private final static Map _map = new LinkedHashMap<>(); 10 | 11 | public final static CliffClass CLIFF1 = new CliffClass("c1"); 12 | public final static CliffClass CLIFF2 = new CliffClass("c2"); 13 | 14 | @Override 15 | public boolean equals(Object other) { 16 | if (other instanceof CliffClass) 17 | return equals((CliffClass) other); 18 | 19 | return super.equals(other); 20 | } 21 | 22 | public boolean equals(CliffClass other) { 23 | return getVal().equals(other.getVal()); 24 | } 25 | 26 | private CliffClass(@Nonnull String name) { 27 | super(name); 28 | 29 | _map.put(name, this); 30 | } 31 | 32 | @Nullable 33 | public static CliffClass valueOf(@Nonnull String name) { 34 | return _map.get(name); 35 | } 36 | 37 | @Override 38 | public CliffClass decode(Object val) { 39 | return new CliffClass(val.toString()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/CliffId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.Id; 4 | import net.moonlightflower.wc3libs.misc.ObjId; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | public class CliffId extends ObjId { 9 | protected CliffId(String idString) { 10 | super(idString); 11 | } 12 | 13 | @Nonnull 14 | public static CliffId valueOf(Id val) { 15 | return new CliffId(val.toString()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/ColorARGB.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.DataType; 4 | 5 | public class ColorARGB extends DataType { 6 | @Override 7 | public DataType decode(Object val) { 8 | // TODO 9 | return null; 10 | } 11 | 12 | @Override 13 | public Object toSLKVal() { 14 | // TODO 15 | return null; 16 | } 17 | 18 | @Override 19 | public Object toTXTVal() { 20 | // TODO 21 | return null; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/Coords3DI.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public class Coords3DI { 6 | private final War3Int _x; 7 | private final War3Int _y; 8 | private final War3Int _z; 9 | 10 | @Nonnull 11 | public War3Int getX() { 12 | return _x; 13 | } 14 | 15 | @Nonnull 16 | public War3Int getY() { 17 | return _y; 18 | } 19 | 20 | @Nonnull 21 | public War3Int getZ() { 22 | return _z; 23 | } 24 | 25 | @Override 26 | public boolean equals(Object other) { 27 | if (other instanceof Coords3DI) 28 | return equals((Coords3DI) other); 29 | 30 | return super.equals(other); 31 | } 32 | 33 | public boolean equals(Coords3DI other) { 34 | return getX() == other.getX() && 35 | getY() == other.getY() && 36 | getZ() == other.getZ(); 37 | } 38 | 39 | public Coords3DI(@Nonnull War3Int x, @Nonnull War3Int y, @Nonnull War3Int z) { 40 | _x = x; 41 | _y = y; 42 | _z = z; 43 | } 44 | 45 | public Coords3DI(int x, int y, int z) { 46 | this(War3Int.valueOf(x), War3Int.valueOf(y), War3Int.valueOf(z)); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/DefenseTable.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.DataType; 4 | 5 | public class DefenseTable extends DataType { 6 | 7 | @Override 8 | public DataType decode(Object val) { 9 | // TODO 10 | return null; 11 | } 12 | 13 | @Override 14 | public Object toSLKVal() { 15 | // TODO 16 | return null; 17 | } 18 | 19 | @Override 20 | public Object toTXTVal() { 21 | // TODO 22 | return null; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/DestructableId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.ObjId; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | public class DestructableId extends ObjId { 8 | protected DestructableId(String idString) { 9 | super(idString); 10 | } 11 | 12 | @Nonnull 13 | public static DestructableId valueOf(ObjId id) { 14 | return new DestructableId(id.toString()); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/DoodId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.ObjId; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | public class DoodId extends ObjId { 8 | protected DoodId(String idString) { 9 | super(idString); 10 | } 11 | 12 | @Nonnull 13 | public static DoodId valueOf(ObjId id) { 14 | return new DoodId(id.toString()); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/Effect.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import java.io.File; 4 | 5 | public class Effect extends Model { 6 | public Effect(File file) { 7 | super(file); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/EffectList.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | public class EffectList { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/Icon.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import java.io.File; 4 | 5 | import net.moonlightflower.wc3libs.dataTypes.DataType; 6 | import net.moonlightflower.wc3libs.dataTypes.FileType; 7 | 8 | public class Icon extends FileType { 9 | private Icon(File file) { 10 | super(file); 11 | } 12 | 13 | public static Icon valueOf(File file) { 14 | return new Icon(file); 15 | } 16 | 17 | @Override 18 | public Icon decode(Object val) { 19 | return valueOf(new File(val.toString())); 20 | } 21 | 22 | public static Icon decodeStatic(Object val) { 23 | if (val != null) 24 | return valueOf(new File(val.toString())); 25 | 26 | return null; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/ItemClass.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import java.util.LinkedHashMap; 4 | import java.util.Map; 5 | 6 | public class ItemClass extends War3String { 7 | private final Map _map = new LinkedHashMap<>(); 8 | 9 | public final static ItemClass ARTIFACT = new ItemClass("Artifact"); 10 | public final static ItemClass CAMPAIGN = new ItemClass("Campaign"); 11 | public final static ItemClass CHARGED = new ItemClass("Charged"); 12 | public final static ItemClass MISC = new ItemClass("Miscellaneous"); 13 | public final static ItemClass PERMANENT = new ItemClass("Permanent"); 14 | public final static ItemClass POWERUP = new ItemClass("PowerUp"); 15 | public final static ItemClass PURCHASE = new ItemClass("Purchasable"); 16 | 17 | @Override 18 | public boolean equals(Object other) { 19 | if (other instanceof ItemClass) 20 | return equals((ItemClass) other); 21 | 22 | return super.equals(other); 23 | } 24 | 25 | public boolean equals(ItemClass other) { 26 | return getVal().equals(other.getVal()); 27 | } 28 | 29 | public ItemClass(String name) { 30 | super(name); 31 | 32 | _map.put(name, this); 33 | } 34 | 35 | @Override 36 | public ItemClass decode(Object val) { 37 | return _map.get(val); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/ItemId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.Id; 4 | import net.moonlightflower.wc3libs.misc.ObjId; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | public class ItemId extends ObjId { 9 | protected ItemId(String idString) { 10 | super(idString); 11 | } 12 | 13 | @Nonnull 14 | public static ItemId valueOf(Id val) { 15 | return new ItemId(val.toString()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/ItemList.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | public class ItemList { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/LightningId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.ObjId; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | public class LightningId extends ObjId { 8 | protected LightningId(String idString) { 9 | super(idString); 10 | } 11 | 12 | @Nonnull 13 | public static LightningId valueOf(ObjId id) { 14 | return new LightningId(id.toString()); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/LightningList.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | public class LightningList { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/Model.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import java.io.File; 4 | 5 | import net.moonlightflower.wc3libs.dataTypes.DataType; 6 | import net.moonlightflower.wc3libs.dataTypes.FileType; 7 | 8 | public class Model extends FileType { 9 | public Model(File file) { 10 | super(file); 11 | } 12 | 13 | @Override 14 | public Model decode(Object val) { 15 | return new Model(new File(val.toString())); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/MoveType.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import javax.annotation.Nonnull; 4 | import javax.annotation.Nullable; 5 | 6 | public class MoveType extends War3String { 7 | public final static MoveType AMPHIBIOUS = new MoveType("amph"); 8 | public final static MoveType FLOAT = new MoveType("float"); 9 | public final static MoveType FLY = new MoveType("fly"); 10 | public final static MoveType FOOT = new MoveType("foot"); 11 | public final static MoveType HORSE = new MoveType("horse"); 12 | public final static MoveType HOVER = new MoveType("hover"); 13 | 14 | @Override 15 | public boolean equals(Object other) { 16 | if (other instanceof MoveType) 17 | return equals((MoveType) other); 18 | 19 | return super.equals(other); 20 | } 21 | 22 | public boolean equals(MoveType other) { 23 | return getVal().equals(other.getVal()); 24 | } 25 | 26 | private MoveType(String val) { 27 | super(val); 28 | } 29 | 30 | @Nullable 31 | public static MoveType valueOf(@Nonnull String val) { 32 | return new MoveType(val); 33 | } 34 | 35 | @Override 36 | public MoveType decode(Object val) { 37 | return valueOf(val.toString()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/MusicFile.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import java.io.File; 4 | 5 | import net.moonlightflower.wc3libs.dataTypes.FileType; 6 | 7 | public class MusicFile extends FileType { 8 | public MusicFile(File file) { 9 | super(file); 10 | } 11 | 12 | @Override 13 | public MusicFile decode(Object val) { 14 | return new MusicFile(new File(val.toString())); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/OrderString.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import java.util.LinkedHashMap; 4 | import java.util.Map; 5 | 6 | public class OrderString extends War3String { 7 | private final static Map _map = new LinkedHashMap<>(); 8 | 9 | public OrderString(String val, String... aliases) { 10 | super(val, aliases); 11 | 12 | _map.put(val, this); 13 | for (String alias : aliases) { 14 | _map.put(alias, this); 15 | } 16 | } 17 | 18 | @Override 19 | public OrderString decode(Object val) { 20 | return _map.get(val); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/PathingPrevent.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.DataType; 4 | 5 | public class PathingPrevent extends DataType { 6 | @Override 7 | public Object toSLKVal() { 8 | // TODO Auto-generated method stub 9 | return null; 10 | } 11 | 12 | @Override 13 | public Object toTXTVal() { 14 | // TODO Auto-generated method stub 15 | return null; 16 | } 17 | 18 | @Override 19 | public DataType decode(Object val) { 20 | // TODO Auto-generated method stub 21 | return null; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/PathingRequire.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.DataType; 4 | 5 | public class PathingRequire extends DataType { 6 | @Override 7 | public Object toSLKVal() { 8 | // TODO Auto-generated method stub 9 | return null; 10 | } 11 | 12 | @Override 13 | public Object toTXTVal() { 14 | // TODO Auto-generated method stub 15 | return null; 16 | } 17 | 18 | @Override 19 | public DataType decode(Object val) { 20 | // TODO Auto-generated method stub 21 | return null; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/PathingTex.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | public class PathingTex extends War3String { 4 | public PathingTex(String stringVal, String... aliases) { 5 | super(stringVal, aliases); 6 | } 7 | 8 | @Override 9 | public PathingTex decode(Object val) { 10 | return new PathingTex(val.toString()); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/Req.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.ObjId; 4 | 5 | public class Req extends ObjId { 6 | protected Req(String idString) { 7 | super(idString); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/RequireList.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | public class RequireList { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/ShadowImage.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import java.io.File; 4 | import java.util.LinkedHashMap; 5 | import java.util.Map; 6 | 7 | import net.moonlightflower.wc3libs.dataTypes.DataType; 8 | import net.moonlightflower.wc3libs.dataTypes.FileType; 9 | 10 | public class ShadowImage extends FileType { 11 | public final static ShadowImage FLY = new ShadowImage("ShadowFlyer"); 12 | public final static ShadowImage GROUND = new ShadowImage("Shadow"); 13 | public final static ShadowImage NONE = new ShadowImage(""); 14 | 15 | @Override 16 | public boolean equals(Object other) { 17 | if (other instanceof ShadowImage) 18 | return equals((ShadowImage) other); 19 | 20 | return super.equals(other); 21 | } 22 | 23 | public boolean equals(ShadowImage other) { 24 | return getVal().equals(other.getVal()); 25 | } 26 | 27 | public ShadowImage(File file) { 28 | super(file); 29 | } 30 | 31 | private ShadowImage(String file) { 32 | this(new File(file)); 33 | } 34 | 35 | @Override 36 | public ShadowImage decode(Object val) { 37 | return new ShadowImage(new File(val.toString())); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/ShadowTex.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import java.io.File; 4 | 5 | import net.moonlightflower.wc3libs.dataTypes.FileType; 6 | 7 | public class ShadowTex extends FileType { 8 | public ShadowTex(File file) { 9 | super(file); 10 | } 11 | 12 | @Override 13 | public ShadowTex decode(Object val) { 14 | return new ShadowTex(new File(val.toString())); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/SoundLabel.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public class SoundLabel extends War3String { 6 | @Override 7 | public boolean equals(Object other) { 8 | if (other instanceof SoundLabel) 9 | return equals((SoundLabel) other); 10 | 11 | return super.equals(other); 12 | } 13 | 14 | public boolean equals(SoundLabel other) { 15 | return getVal().equals(other.getVal()); 16 | } 17 | 18 | public SoundLabel(String name) { 19 | super(name); 20 | } 21 | 22 | @Nonnull 23 | public static SoundLabel valueOf(String name) { 24 | return new SoundLabel(name); 25 | } 26 | 27 | @Override 28 | public SoundLabel decode(Object val) { 29 | return decodeStatic(val); 30 | } 31 | 32 | public static SoundLabel decodeStatic(Object val) { 33 | if (val != null) 34 | return valueOf(val.toString()); 35 | 36 | return null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/SpawnId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.ObjId; 4 | 5 | public class SpawnId extends ObjId { 6 | protected SpawnId(String idString) { 7 | super(idString); 8 | } 9 | 10 | public static SpawnId valueOf(ObjId id) { 11 | return new SpawnId(id.toString()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/SpellDetail.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import javax.annotation.Nullable; 4 | import java.util.LinkedHashMap; 5 | import java.util.Map; 6 | 7 | public class SpellDetail extends War3Int { 8 | private static Map _indexMap = new LinkedHashMap<>(); 9 | 10 | public final static SpellDetail LOW = new SpellDetail(0); 11 | public final static SpellDetail MEDIUM = new SpellDetail(1); 12 | public final static SpellDetail HIGH = new SpellDetail(2); 13 | 14 | @Override 15 | public boolean equals(Object other) { 16 | if (other instanceof SpellDetail) 17 | return equals((SpellDetail) other); 18 | 19 | return super.equals(other); 20 | } 21 | 22 | public boolean equals(SpellDetail other) { 23 | return getVal().equals(other.getVal()); 24 | } 25 | 26 | public SpellDetail(int val) { 27 | super(val); 28 | 29 | _indexMap.put(val, this); 30 | } 31 | 32 | @Nullable 33 | public static SpellDetail valueOf(int val) { 34 | return _indexMap.get(val); 35 | } 36 | 37 | @Override 38 | public SpellDetail decode(Object val) { 39 | try { 40 | return valueOf(Integer.parseInt(val.toString())); 41 | } catch (Exception e) { 42 | } 43 | 44 | return null; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/SplatId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.ObjId; 4 | 5 | public class SplatId extends ObjId { 6 | protected SplatId(String idString) { 7 | super(idString); 8 | } 9 | 10 | public static SplatId valueOf(ObjId id) { 11 | return new SplatId(id.toString()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/StringList.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | public class StringList { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/TargetList.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | public class TargetList { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/TeamColor.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | public class TeamColor extends War3Int { 4 | public final static TeamColor USE_OWNER = new TeamColor(-1); 5 | 6 | public TeamColor(int val) { 7 | super(val); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/TechId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.ObjId; 4 | 5 | public class TechId extends ObjId { 6 | protected TechId(String idString) { 7 | super(idString); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/TechList.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | public class TechList { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/TerrainFogType.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import javax.annotation.Nullable; 4 | import java.util.LinkedHashMap; 5 | import java.util.Map; 6 | 7 | public class TerrainFogType extends War3Int { 8 | private static Map _indexMap = new LinkedHashMap<>(); 9 | 10 | public final static TerrainFogType EXP = new TerrainFogType(2); 11 | public final static TerrainFogType EXP2 = new TerrainFogType(3); 12 | public final static TerrainFogType LINEAR = new TerrainFogType(1); 13 | public final static TerrainFogType NONE = new TerrainFogType(0); 14 | 15 | @Override 16 | public boolean equals(Object other) { 17 | if (other instanceof TerrainFogType) 18 | return equals((TerrainFogType) other); 19 | 20 | return super.equals(other); 21 | } 22 | 23 | public boolean equals(TerrainFogType other) { 24 | return getVal().equals(other.getVal()); 25 | } 26 | 27 | private TerrainFogType(int val) { 28 | super(val); 29 | 30 | _indexMap.put(val, this); 31 | } 32 | 33 | @Nullable 34 | public static TerrainFogType valueOf(Integer val) { 35 | return _indexMap.get(val); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/Tex.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import java.io.File; 4 | 5 | import net.moonlightflower.wc3libs.dataTypes.DataType; 6 | import net.moonlightflower.wc3libs.dataTypes.FileType; 7 | 8 | public class Tex extends FileType { 9 | 10 | public Tex(File file) { 11 | super(file); 12 | } 13 | 14 | @Override 15 | public Tex decode(Object val) { 16 | return new Tex(new File(val.toString())); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/TileId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.Id; 4 | import net.moonlightflower.wc3libs.misc.ObjId; 5 | 6 | public class TileId extends ObjId { 7 | protected TileId(String idString) { 8 | super(idString); 9 | } 10 | 11 | public static TileId valueOf(Id val) { 12 | return new TileId(val.toString()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/TileIdList.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | public class TileIdList { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/UberSplatId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.Id; 4 | import net.moonlightflower.wc3libs.misc.ObjId; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | public class UberSplatId extends ObjId { 9 | protected UberSplatId(String idString) { 10 | super(idString); 11 | } 12 | 13 | @Nonnull 14 | public static UberSplatId valueOf(Id val) { 15 | return new UberSplatId(val.toString()); 16 | } 17 | 18 | public static UberSplatId decodeStatic(Object val) { 19 | if (val == null) return null; 20 | 21 | return UberSplatId.valueOf(ObjId.valueOf(val.toString())); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/UnitId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.ObjId; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | public class UnitId extends ObjId { 8 | protected UnitId(String idString) { 9 | super(idString); 10 | } 11 | 12 | @Nonnull 13 | public static UnitId valueOf(ObjId id) { 14 | return new UnitId(id.toString()); 15 | } 16 | 17 | public static UnitId decodeStatic(Object val) { 18 | if (val == null) return null; 19 | 20 | return UnitId.valueOf(ObjId.valueOf(val.toString())); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/UnitList.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | public class UnitList { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/UnitSound.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | public class UnitSound extends SoundLabel { 4 | public UnitSound(String name) { 5 | super(name); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/UpgradeId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.Id; 4 | import net.moonlightflower.wc3libs.misc.ObjId; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | public class UpgradeId extends ObjId { 9 | protected UpgradeId(String idString) { 10 | super(idString); 11 | } 12 | 13 | @Nonnull 14 | public static UpgradeId valueOf(Id val) { 15 | return new UpgradeId(val.toString()); 16 | } 17 | 18 | public static UpgradeId decodeStatic(Object val) { 19 | if (val == null) return null; 20 | 21 | return UpgradeId.valueOf(ObjId.valueOf(val.toString())); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/War3Char.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.DataType; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | public class War3Char extends DataType { 8 | private final char _val; 9 | 10 | @Nonnull 11 | public Character getVal() { 12 | return _val; 13 | } 14 | 15 | @Override 16 | public Object toSLKVal() { 17 | return toString(); 18 | } 19 | 20 | @Override 21 | public Object toTXTVal() { 22 | return toString(); 23 | } 24 | 25 | private War3Char(char val) { 26 | _val = val; 27 | } 28 | 29 | @Nonnull 30 | public static War3Char valueOf(char val) { 31 | return new War3Char(val); 32 | } 33 | 34 | @Override 35 | public DataType decode(Object val) { 36 | return new War3Char(val.toString().charAt(0)); 37 | } 38 | } -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/WaterCode.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.ObjId; 4 | 5 | public class WaterCode extends ObjId { 6 | protected WaterCode(String idString) { 7 | super(idString); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/WaterId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.misc.Id; 4 | import net.moonlightflower.wc3libs.misc.ObjId; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | public class WaterId extends ObjId { 9 | protected WaterId(String idString) { 10 | super(idString); 11 | } 12 | 13 | @Nonnull 14 | public static WaterId valueOf(Id val) { 15 | return new WaterId(val.toString()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/dataTypes/app/WeatherId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.DataType; 4 | import net.moonlightflower.wc3libs.dataTypes.Stringable; 5 | import net.moonlightflower.wc3libs.misc.ObjId; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | public class WeatherId extends ObjId { 10 | protected WeatherId(String idString) { 11 | super(idString); 12 | } 13 | 14 | public static WeatherId valueOf(String id) { 15 | return new WeatherId(id); 16 | } 17 | 18 | public static WeatherId valueOf(Stringable id) { 19 | return new WeatherId(id.toString()); 20 | } 21 | 22 | @Override 23 | public WeatherId decode(Object val) { 24 | return valueOf(val.toString()); 25 | } 26 | 27 | public static WeatherId decodeStatic(Object val) { 28 | if (val == null) return null; 29 | 30 | return valueOf(val.toString()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/AsyncTask.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public abstract class AsyncTask { 6 | private final Thread _thread; 7 | 8 | public static class FinishedException extends RuntimeException { 9 | 10 | } 11 | 12 | public abstract void run(); 13 | public abstract void onPostExec(); 14 | 15 | public interface FinishedHandler { 16 | void finished(); 17 | } 18 | 19 | private final FinishedHandler _finishedHandler; 20 | 21 | public void start() { 22 | _thread.setDaemon(true); 23 | _thread.setUncaughtExceptionHandler((thread, exception) -> { 24 | if (exception instanceof FinishedException) { 25 | onPostExec(); 26 | } else { 27 | exception.printStackTrace(); 28 | } 29 | 30 | _finishedHandler.finished(); 31 | }); 32 | 33 | _thread.start(); 34 | } 35 | 36 | public AsyncTask(@Nonnull FinishedHandler finishedHandler) { 37 | _finishedHandler = finishedHandler; 38 | _thread = new Thread(() -> { 39 | run(); 40 | 41 | throw new FinishedException(); 42 | }); 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/Boundable.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.Coords2DF; 4 | import net.moonlightflower.wc3libs.dataTypes.app.Coords2DI; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | public interface Boundable { 9 | @Nonnull 10 | Coords2DF getCenter(); 11 | 12 | float getCenterX(); 13 | float getCenterY(); 14 | 15 | @Nonnull 16 | Size getSize(); 17 | 18 | int getWidth(); 19 | int getHeight(); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/ColorCodeTransformer.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc; 2 | 3 | import java.util.regex.Pattern; 4 | 5 | /** 6 | * Transforms wc3 colors codes |cFFFFFFFF |r to various outputs. 7 | */ 8 | public class ColorCodeTransformer { 9 | 10 | private static final Pattern COLOR_CODE_PATTERN = Pattern.compile("\\|cff(\\d{6})", Pattern.CASE_INSENSITIVE); 11 | 12 | /** 13 | * Transforms all colors codes in the given input to html for display in swing 14 | */ 15 | public static String transformToHtml(String input) { 16 | StringBuilder sb = new StringBuilder(""); 17 | 18 | input = COLOR_CODE_PATTERN.matcher(input).replaceAll(""); 19 | input = input.replaceAll("\\|r", ""); 20 | sb.append(input); 21 | 22 | sb.append(""); 23 | return sb.toString(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/FieldId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public class FieldId extends Id { 6 | protected FieldId(@Nonnull String idString) { 7 | super(idString); 8 | } 9 | 10 | public static FieldId valueOf(@Nonnull String idString) { 11 | return new FieldId(idString); 12 | } 13 | 14 | public static FieldId valueOf(@Nonnull Id id) { 15 | return valueOf(id.toString()); 16 | } 17 | 18 | @Override 19 | public FieldId lower() { 20 | return FieldId.valueOf(super.lower()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/IsNum.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc; 2 | 3 | public interface IsNum { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/Mergeable.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public interface Mergeable { 6 | void merge(@Nonnull T other); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/MetaFieldId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public class MetaFieldId extends FieldId { 6 | protected MetaFieldId(@Nonnull String idString) { 7 | super(idString); 8 | } 9 | 10 | public static MetaFieldId valueOf(@Nonnull String idString) { 11 | return new MetaFieldId(idString); 12 | } 13 | 14 | public static MetaFieldId valueOf(@Nonnull Id id) { 15 | return valueOf(id.toString()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/ObjId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.Stringable; 4 | 5 | public class ObjId extends Id { 6 | @Override 7 | public Object toSLKVal() { 8 | return toString(); 9 | } 10 | 11 | @Override 12 | public Object toTXTVal() { 13 | return toString(); 14 | } 15 | 16 | protected ObjId(String idString) { 17 | super(idString); 18 | } 19 | 20 | public static ObjId valueOf(String idString) { 21 | return new ObjId(idString); 22 | } 23 | 24 | public static ObjId valueOf(Stringable id) { 25 | return valueOf(id.toString()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/Printable.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc; 2 | 3 | import javax.annotation.Nonnull; 4 | import java.io.PrintStream; 5 | 6 | public interface Printable { 7 | void print(@Nonnull Printer printer); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/Printer.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc; 2 | 3 | import javax.annotation.Nonnull; 4 | import javax.annotation.Nullable; 5 | import java.io.PrintStream; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import java.util.Stack; 9 | 10 | public class Printer { 11 | private final PrintStream _stream; 12 | 13 | public Printer(@Nonnull PrintStream stream) { 14 | _stream = stream; 15 | } 16 | 17 | private final Stack _groups = new Stack<>(); 18 | 19 | public void beginGroup(@Nonnull Object name) { 20 | println("begin " + name + ":"); 21 | 22 | _groups.push(name); 23 | } 24 | 25 | public void endGroup() { 26 | if (_groups.isEmpty()) return; 27 | 28 | println("end " + _groups.pop()); 29 | } 30 | 31 | public void print(@Nullable Object s) { 32 | _stream.print(new String(new char[_groups.size()]).replace("\0", "\t") + s); 33 | } 34 | 35 | public void println(@Nullable Object s) { 36 | _stream.println(new String(new char[_groups.size()]).replace("\0", "\t") + s); 37 | } 38 | } -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/Size.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.Coords2DI; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | public class Size extends Coords2DI { 8 | public int getWidth() { 9 | return getX(); 10 | } 11 | 12 | public int getHeight() { 13 | return getY(); 14 | } 15 | 16 | @Override 17 | public boolean equals(Object other) { 18 | if (other instanceof Size) 19 | return equals((Size) other); 20 | 21 | return super.equals(other); 22 | } 23 | 24 | public boolean equals(Size other) { 25 | return getWidth() == other.getWidth() && 26 | getHeight() == other.getHeight(); 27 | } 28 | 29 | public int getArea() { 30 | return getWidth() * getHeight(); 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | return String.format("%dx%d", getWidth(), getHeight()); 36 | } 37 | 38 | @Nonnull 39 | @Override 40 | public Size scale(double scale) { 41 | return new Size((int) (getX() * scale), (int) (getY() * scale)); 42 | } 43 | 44 | public Size(int x, int y) { 45 | super(x, y); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/TypeInfoed.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public interface TypeInfoed { 6 | @Nonnull 7 | TypeInfo getTypeInfo(); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/UnsupportedFormatException.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public class UnsupportedFormatException extends Exception { 6 | private String _msg; 7 | 8 | @Override 9 | public String toString() { 10 | return _msg; 11 | } 12 | 13 | public UnsupportedFormatException(@Nonnull String msg) { 14 | _msg = msg; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/exeversion/ExeVersion.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc.exeversion; 2 | 3 | public interface ExeVersion { 4 | 5 | /** 6 | * Extracts Version information from a PE executable on Windows. 7 | * @param executablePath Path to executable file 8 | * @return Version string with only numbers, if file contains one. Empty string otherwise. 9 | * @throws VersionExtractionException An exception is thrown when extraction fails. 10 | */ 11 | static String getVersion(String executablePath) throws VersionExtractionException { 12 | throw new VersionExtractionException("Cannot call this function on the interface."); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/image/FxImg.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc.image; 2 | 3 | import javax.annotation.Nonnull; 4 | import java.awt.image.BufferedImage; 5 | import java.awt.image.ColorModel; 6 | import java.awt.image.WritableRaster; 7 | 8 | public class FxImg { 9 | private BufferedImage _bufImg; 10 | 11 | public double getWidth() { 12 | return _bufImg.getWidth(); 13 | } 14 | 15 | public double getHeight() { 16 | return _bufImg.getHeight(); 17 | } 18 | 19 | private static BufferedImage copyBufImg(@Nonnull BufferedImage bufImg) { 20 | ColorModel colorModel = bufImg.getColorModel(); 21 | 22 | WritableRaster raster = bufImg.copyData(null); 23 | 24 | return new BufferedImage(colorModel, raster, colorModel.isAlphaPremultiplied(), null); 25 | } 26 | 27 | public BufferedImage toBufImg() { 28 | return copyBufImg(_bufImg); 29 | } 30 | 31 | public FxImg(@Nonnull BufferedImage bufImg) { 32 | _bufImg = copyBufImg(bufImg); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/image/Wc3Img.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc.image; 2 | 3 | import javax.annotation.Nonnull; 4 | import java.awt.image.BufferedImage; 5 | 6 | public abstract class Wc3Img { 7 | public abstract FxImg getFXImg(); 8 | 9 | @Nonnull 10 | private BufferedImage toBufImg() { 11 | return getFXImg().toBufImg(); 12 | } 13 | 14 | @Nonnull 15 | public Wc3RasterImg toRasterImg() { 16 | return new Wc3RasterImg(toBufImg()); 17 | } 18 | 19 | protected Wc3Img() { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/model/mdx/EventObjectTrack.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc.model.mdx; 2 | 3 | import net.moonlightflower.wc3libs.bin.BinStream; 4 | import net.moonlightflower.wc3libs.bin.Wc3BinInputStream; 5 | import net.moonlightflower.wc3libs.bin.Wc3BinOutputStream; 6 | import net.moonlightflower.wc3libs.misc.model.MDX; 7 | 8 | import javax.annotation.Nonnull; 9 | 10 | public class EventObjectTrack extends MDXObject { 11 | private long _index = 0; 12 | 13 | public long getIndex() { 14 | return _index; 15 | } 16 | 17 | public void setIndex(long index) { 18 | _index = index; 19 | } 20 | 21 | @Override 22 | public void write(@Nonnull Wc3BinOutputStream stream, @Nonnull MDX.EncodingFormat format) throws BinStream.StreamException { 23 | stream.writeUInt32(_index); 24 | } 25 | 26 | @Override 27 | public void write(@Nonnull Wc3BinOutputStream stream) throws BinStream.StreamException { 28 | write(stream, MDX.EncodingFormat.AUTO); 29 | } 30 | 31 | public EventObjectTrack(@Nonnull Wc3BinInputStream stream) throws BinStream.StreamException { 32 | _index = stream.readUInt32("index"); 33 | } 34 | 35 | public EventObjectTrack() { 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/model/mdx/Face.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc.model.mdx; 2 | 3 | import net.moonlightflower.wc3libs.bin.BinInputStream; 4 | import net.moonlightflower.wc3libs.bin.BinStream; 5 | import net.moonlightflower.wc3libs.bin.Wc3BinInputStream; 6 | import net.moonlightflower.wc3libs.bin.Wc3BinOutputStream; 7 | import net.moonlightflower.wc3libs.misc.model.MDX; 8 | 9 | import javax.annotation.Nonnull; 10 | 11 | public class Face extends MDXObject { 12 | private int _val = 0; 13 | 14 | public int getVal() { 15 | return _val; 16 | } 17 | 18 | @Override 19 | public void write(@Nonnull Wc3BinOutputStream stream, @Nonnull MDX.EncodingFormat format) throws BinStream.StreamException { 20 | stream.writeUInt16(_val); 21 | } 22 | 23 | @Override 24 | public void write(@Nonnull Wc3BinOutputStream stream) throws BinInputStream.StreamException { 25 | write(stream, MDX.EncodingFormat.AUTO); 26 | } 27 | 28 | public Face(@Nonnull Wc3BinInputStream stream) throws BinStream.StreamException { 29 | _val = stream.readUInt16("val"); 30 | } 31 | 32 | public Face() { 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/model/mdx/Helper.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc.model.mdx; 2 | 3 | import net.moonlightflower.wc3libs.bin.BinStream; 4 | import net.moonlightflower.wc3libs.bin.Wc3BinInputStream; 5 | import net.moonlightflower.wc3libs.bin.Wc3BinOutputStream; 6 | import net.moonlightflower.wc3libs.misc.model.MDX; 7 | 8 | import javax.annotation.Nonnull; 9 | 10 | public class Helper extends MDXObject { 11 | private Node _node; 12 | 13 | @Nonnull 14 | public Node getNode() { 15 | return _node; 16 | } 17 | 18 | public void setNode(@Nonnull Node node) { 19 | _node = node; 20 | } 21 | 22 | @Override 23 | public void write(@Nonnull Wc3BinOutputStream stream, @Nonnull MDX.EncodingFormat format) throws BinStream.StreamException { 24 | _node.write(stream); 25 | } 26 | 27 | @Override 28 | public void write(@Nonnull Wc3BinOutputStream stream) throws BinStream.StreamException { 29 | write(stream, MDX.EncodingFormat.AUTO); 30 | } 31 | 32 | public Helper(@Nonnull Wc3BinInputStream stream) throws BinStream.StreamException { 33 | _node = new Node(stream); 34 | } 35 | 36 | public Helper() { 37 | _node = new Node(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/model/mdx/IndexReference.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc.model.mdx; 2 | 3 | import net.moonlightflower.wc3libs.bin.BinInputStream; 4 | import net.moonlightflower.wc3libs.bin.BinStream; 5 | import net.moonlightflower.wc3libs.bin.Wc3BinInputStream; 6 | import net.moonlightflower.wc3libs.bin.Wc3BinOutputStream; 7 | import net.moonlightflower.wc3libs.misc.model.MDX; 8 | 9 | import javax.annotation.Nonnull; 10 | 11 | public class IndexReference extends MDXObject { 12 | private long _index = 0; 13 | 14 | public long getIndex() { 15 | return _index; 16 | } 17 | 18 | public void setIndex(long index) { 19 | _index = index; 20 | } 21 | 22 | @Override 23 | public void write(@Nonnull Wc3BinOutputStream stream, @Nonnull MDX.EncodingFormat format) throws BinStream.StreamException { 24 | stream.writeUInt32(_index); 25 | } 26 | 27 | @Override 28 | public void write(@Nonnull Wc3BinOutputStream stream) throws BinInputStream.StreamException { 29 | write(stream, MDX.EncodingFormat.AUTO); 30 | } 31 | 32 | public IndexReference(@Nonnull Wc3BinInputStream stream) throws BinStream.StreamException { 33 | _index = stream.readUInt32("index"); 34 | } 35 | 36 | public IndexReference() { 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/model/mdx/PivotPoint.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc.model.mdx; 2 | 3 | import net.moonlightflower.wc3libs.bin.BinStream; 4 | import net.moonlightflower.wc3libs.bin.Wc3BinInputStream; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | public class PivotPoint extends Vertex { 9 | public PivotPoint(@Nonnull Wc3BinInputStream stream) throws BinStream.StreamException { 10 | super(stream); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/model/mdx/VertexGroup.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.misc.model.mdx; 2 | 3 | import net.moonlightflower.wc3libs.bin.BinInputStream; 4 | import net.moonlightflower.wc3libs.bin.BinStream; 5 | import net.moonlightflower.wc3libs.bin.Wc3BinInputStream; 6 | import net.moonlightflower.wc3libs.bin.Wc3BinOutputStream; 7 | import net.moonlightflower.wc3libs.misc.model.MDX; 8 | 9 | import javax.annotation.Nonnull; 10 | 11 | public class VertexGroup extends MDXObject { 12 | private int _index = 0; 13 | 14 | public int getIndex() { 15 | return _index; 16 | } 17 | 18 | public void setIndex(int index) { 19 | _index = index; 20 | } 21 | 22 | @Override 23 | public void write(@Nonnull Wc3BinOutputStream stream, @Nonnull MDX.EncodingFormat format) throws BinStream.StreamException { 24 | stream.writeUInt8(_index); 25 | } 26 | 27 | @Override 28 | public void write(@Nonnull Wc3BinOutputStream stream) throws BinInputStream.StreamException { 29 | write(stream, MDX.EncodingFormat.AUTO); 30 | } 31 | 32 | public VertexGroup(@Nonnull Wc3BinInputStream stream) throws BinStream.StreamException { 33 | _index = stream.readUInt8("index"); 34 | } 35 | 36 | public VertexGroup() { 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/misc/model/mdx/links.txt: -------------------------------------------------------------------------------- 1 | https://www.hiveworkshop.com/threads/mdx-specifications.240487/ -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/AlreadyTriedException.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public class AlreadyTriedException extends NotFoundException { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/EditorExeFinder.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port; 2 | 3 | import javax.annotation.Nonnull; 4 | import java.io.File; 5 | 6 | public abstract class EditorExeFinder extends Finder { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/Finder.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port; 2 | 3 | import javax.annotation.Nonnull; 4 | import java.util.LinkedHashSet; 5 | import java.util.Set; 6 | 7 | public abstract class Finder { 8 | @Nonnull 9 | public abstract T find() throws NotFoundException; 10 | 11 | static ThreadLocal>> _finders = new ThreadLocal<>(); 12 | 13 | public T get() throws NotFoundException { 14 | if (_finders.get() == null) { 15 | _finders.set(new LinkedHashSet<>()); 16 | } 17 | 18 | if (_finders.get().contains(this.getClass())) { 19 | throw new NotFoundException(new AlreadyTriedException()); 20 | } 21 | 22 | _finders.get().add(this.getClass()); 23 | 24 | try { 25 | return find(); 26 | } finally { 27 | _finders.get().remove(this.getClass()); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/GameDirFinder.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port; 2 | 3 | import java.io.File; 4 | 5 | public abstract class GameDirFinder extends Finder { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/GameExeFinder.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port; 2 | 3 | import java.io.File; 4 | 5 | public abstract class GameExeFinder extends Finder { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/GameVersionFinder.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public abstract class GameVersionFinder extends Finder { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/MapsDirFinder.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port; 2 | 3 | import javax.annotation.Nonnull; 4 | import java.io.File; 5 | 6 | public abstract class MapsDirFinder extends Finder { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/NotFoundException.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public class NotFoundException extends Exception { 6 | public NotFoundException() { 7 | super(); 8 | } 9 | 10 | public NotFoundException(@Nonnull Exception enclosedException) { 11 | super(enclosedException); 12 | } 13 | 14 | public NotFoundException(@Nonnull String message) { 15 | super(message); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/StdGameExeFinder.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port; 2 | 3 | import net.moonlightflower.wc3libs.port.mac.MacGameExeFinder; 4 | import net.moonlightflower.wc3libs.port.win.WinGameExeFinder; 5 | 6 | import javax.annotation.Nonnull; 7 | import java.io.File; 8 | 9 | public class StdGameExeFinder extends GameExeFinder { 10 | public StdGameExeFinder() { 11 | } 12 | 13 | protected GameExeFinder getMacGameExeFinder() { 14 | return Context.getService(MacGameExeFinder.class); 15 | } 16 | 17 | protected GameExeFinder getWinGameExeFinder() { 18 | return Context.getService(WinGameExeFinder.class); 19 | } 20 | 21 | @Nonnull 22 | @Override 23 | public File find() throws NotFoundException { 24 | if (Orient.isMacSystem()) { 25 | GameExeFinder macGameExeFinder = getMacGameExeFinder(); 26 | 27 | return macGameExeFinder.get(); 28 | } else if (Orient.isWindowsSystem()) { 29 | GameExeFinder winGameExeFinder = getWinGameExeFinder(); 30 | 31 | return winGameExeFinder.get(); 32 | } else { 33 | throw new UnsupportedPlatformException("system not supported: " + Orient.getSystem()); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/UnsupportedPlatformException.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port; 2 | 3 | public class UnsupportedPlatformException extends RuntimeException { 4 | public UnsupportedPlatformException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/War3MPQs.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port; 2 | 3 | import java.io.File; 4 | 5 | public class War3MPQs { 6 | public final static File WAR3 = new File("War3.mpq"); 7 | public final static File WAR3_LOCAL = new File("War3Local.mpq"); 8 | public final static File WAR3X = new File("War3x.mpq"); 9 | public final static File WAR3X_LOCAL = new File("War3xLocal.mpq"); 10 | public final static File WAR3PATCH = new File("War3Patch.mpq"); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/mac/MacGameDirFinder.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port.mac; 2 | 3 | import net.moonlightflower.wc3libs.port.GameDirFinder; 4 | import net.moonlightflower.wc3libs.port.NotFoundException; 5 | 6 | import javax.annotation.Nonnull; 7 | import java.io.File; 8 | 9 | public class MacGameDirFinder extends GameDirFinder { 10 | public static File DIR = new File("/Applications/Warcraft III"); 11 | 12 | @Nonnull 13 | @Override 14 | public File find() throws NotFoundException { 15 | return DIR; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/mac/MacGameExeFinder.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port.mac; 2 | 3 | import net.moonlightflower.wc3libs.port.GameExeFinder; 4 | import net.moonlightflower.wc3libs.port.GameVersion; 5 | import net.moonlightflower.wc3libs.port.NotFoundException; 6 | 7 | import javax.annotation.Nonnull; 8 | import java.io.File; 9 | 10 | public class MacGameExeFinder extends GameExeFinder { 11 | public static File X32_FILE = new File("/Applications/Warcraft III/Warcraft III.app/Contents/MacOS/Warcraft III"); 12 | public static File X64_FILE = new File("/Applications/Warcraft III/x86_64/Warcraft III.app/Contents/MacOS/Warcraft III"); 13 | 14 | @Nonnull 15 | @Override 16 | public File find() throws NotFoundException { 17 | if (X64_FILE.exists()) { 18 | return X64_FILE; 19 | } else if (X32_FILE.exists()) { 20 | return X32_FILE; 21 | } 22 | 23 | throw new NotFoundException(new Exception("tried " + X64_FILE + " and " + X32_FILE)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/mac/MacGameVersionFinder.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port.mac; 2 | 3 | import net.moonlightflower.wc3libs.port.GameVersion; 4 | import net.moonlightflower.wc3libs.port.GameVersionFinder; 5 | import net.moonlightflower.wc3libs.port.NotFoundException; 6 | 7 | import javax.annotation.Nonnull; 8 | import java.io.File; 9 | 10 | public class MacGameVersionFinder extends GameVersionFinder { 11 | @Nonnull 12 | @Override 13 | public GameVersion find() throws NotFoundException { 14 | try { 15 | GameVersion gameVersion = PListGameVersionParser.get(); 16 | 17 | return gameVersion; 18 | } catch (Exception e) { 19 | throw new NotFoundException(e); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/win/WinDefaultGameDirFinder.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port.win; 2 | 3 | import net.moonlightflower.wc3libs.port.GameDirFinder; 4 | import net.moonlightflower.wc3libs.port.NotFoundException; 5 | 6 | import javax.annotation.Nonnull; 7 | import java.io.File; 8 | 9 | public class WinDefaultGameDirFinder extends GameDirFinder { 10 | public final static File WIN_DEFAULT_PATH = new File("C:/Program Files/Warcraft III"); 11 | public final static File WIN_DEFAULT_X86_PATH = new File("C:/Program Files (86)/Warcraft III"); 12 | 13 | @Nonnull 14 | @Override 15 | public File find() throws NotFoundException { 16 | if (WIN_DEFAULT_PATH.exists()) return WIN_DEFAULT_PATH; 17 | if (WIN_DEFAULT_X86_PATH.exists()) return WIN_DEFAULT_X86_PATH; 18 | 19 | throw new NotFoundException(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/win/WinGameDirFinder.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port.win; 2 | 3 | import net.moonlightflower.wc3libs.port.GameDirFinder; 4 | import net.moonlightflower.wc3libs.port.NotFoundException; 5 | import net.moonlightflower.wc3libs.port.win.registry.WinRegistryGameDirFinder; 6 | 7 | import javax.annotation.Nonnull; 8 | import java.io.File; 9 | 10 | public class WinGameDirFinder extends GameDirFinder { 11 | protected GameDirFinder getRegistryGameDirFinder() { 12 | return new WinRegistryGameDirFinder(); 13 | } 14 | 15 | protected GameDirFinder getDefaultGameDirFinder() { 16 | return new WinDefaultGameDirFinder(); 17 | } 18 | 19 | @Nonnull 20 | @Override 21 | public File find() throws NotFoundException { 22 | GameDirFinder registryGameDirFinder = getRegistryGameDirFinder(); 23 | 24 | try { 25 | return registryGameDirFinder.get(); 26 | } catch (NotFoundException e) { 27 | } 28 | 29 | GameDirFinder defaultGameDirFinder = getDefaultGameDirFinder(); 30 | 31 | try { 32 | return defaultGameDirFinder.get(); 33 | } catch (NotFoundException e) { 34 | } 35 | 36 | throw new NotFoundException(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/win/registry/WinRegistryGameExeFinder.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port.win.registry; 2 | 3 | import net.moonlightflower.wc3libs.misc.WinRegistryHandler; 4 | import net.moonlightflower.wc3libs.misc.WinRegistryHandler.Wc3Entry; 5 | import net.moonlightflower.wc3libs.port.GameExeFinder; 6 | import net.moonlightflower.wc3libs.port.NotFoundException; 7 | 8 | import javax.annotation.Nonnull; 9 | import java.io.File; 10 | import java.io.IOException; 11 | 12 | public class WinRegistryGameExeFinder extends GameExeFinder { 13 | public WinRegistryGameExeFinder() { 14 | } 15 | 16 | @Nonnull 17 | @Override 18 | public File find() throws NotFoundException { 19 | try { 20 | String fileS = getRegistryHandler().get(Wc3Entry.PROGRAM); 21 | 22 | if (fileS == null) throw new NotFoundException(); 23 | 24 | File file = new File(fileS); 25 | 26 | if (file.exists()) { 27 | return file; 28 | } 29 | } catch (IOException ignored) { 30 | } 31 | 32 | throw new NotFoundException(); 33 | } 34 | 35 | protected WinRegistryHandler getRegistryHandler() { 36 | return new WinRegistryHandler(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/port/win/registry/WinRegistryGameVersionFinder.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.port.win.registry; 2 | 3 | import net.moonlightflower.wc3libs.bin.GameExe; 4 | import net.moonlightflower.wc3libs.port.*; 5 | 6 | import javax.annotation.Nonnull; 7 | import java.io.File; 8 | import java.io.IOException; 9 | 10 | public class WinRegistryGameVersionFinder extends GameVersionFinder { 11 | public WinRegistryGameVersionFinder() { 12 | } 13 | 14 | @Nonnull 15 | public GameVersion find() throws NotFoundException { 16 | GameExeFinder gameExeFinder = getRegistryGameExeFinder(); 17 | 18 | try { 19 | File gameExeFile = gameExeFinder.get(); 20 | 21 | return GameExe.getVersion(gameExeFile); 22 | } catch (IOException | AlreadyTriedException e) { 23 | throw new NotFoundException(e); 24 | } 25 | } 26 | 27 | protected GameExeFinder getRegistryGameExeFinder() { 28 | return new WinRegistryGameExeFinder(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/slk/MetaSLK.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.slk; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | 6 | import net.moonlightflower.wc3libs.misc.*; 7 | 8 | import javax.annotation.Nonnull; 9 | 10 | public abstract class MetaSLK, ObjIdType extends ObjId, ObjType extends MetaSLK.Obj> extends SLK { 11 | public MetaSLK(@Nonnull File file) throws IOException { 12 | super(file); 13 | } 14 | 15 | public MetaSLK() { 16 | super(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/slk/SLKState.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.slk; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.DataType; 4 | import net.moonlightflower.wc3libs.dataTypes.DataTypeInfo; 5 | import net.moonlightflower.wc3libs.dataTypes.Serializable; 6 | import net.moonlightflower.wc3libs.misc.FieldId; 7 | import net.moonlightflower.wc3libs.misc.State; 8 | 9 | import javax.annotation.Nonnull; 10 | import javax.annotation.Nullable; 11 | 12 | public class SLKState extends State { 13 | public SLKState(@Nonnull String fieldIdS, @Nonnull DataTypeInfo typeInfo, @Nullable T defVal) { 14 | super(FieldId.valueOf(fieldIdS), typeInfo, defVal); 15 | } 16 | 17 | public SLKState(@Nonnull String fieldIdS, @Nonnull DataTypeInfo typeInfo) { 18 | this(fieldIdS, typeInfo, (T) typeInfo.getDefVal()); 19 | } 20 | 21 | public SLKState(@Nonnull String idString, @Nonnull Class type) { 22 | this(idString, new DataTypeInfo(type)); 23 | } 24 | 25 | public SLKState(@Nonnull String idString, @Nonnull Class type, @Nullable T defVal) { 26 | this(idString, new DataTypeInfo(type), defVal); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/slk/app/meta/AbilityBuffMetaSLK.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.slk.app.meta; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.DataType; 4 | import net.moonlightflower.wc3libs.dataTypes.DataTypeInfo; 5 | 6 | import javax.annotation.Nonnull; 7 | import javax.annotation.Nullable; 8 | import java.io.File; 9 | 10 | public class AbilityBuffMetaSLK extends CommonMetaSLK { 11 | public static File GAME_PATH = new File("Units\\AbilityBuffMetaData.slk"); 12 | 13 | public static class State extends CommonMetaSLK.State { 14 | public State(@Nonnull String idString, @Nonnull DataTypeInfo typeInfo, @Nullable T defVal) { 15 | super(idString, typeInfo, defVal); 16 | } 17 | 18 | public State(@Nonnull String idString, @Nonnull DataTypeInfo typeInfo) { 19 | super(idString, typeInfo); 20 | } 21 | 22 | public State(@Nonnull String idString, @Nonnull Class type) { 23 | super(idString, type); 24 | } 25 | 26 | public State(@Nonnull String idString, @Nonnull Class type, @Nullable T defVal) { 27 | super(idString, type, defVal); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/slk/app/meta/DestructableMetaSLK.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.slk.app.meta; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.DataType; 4 | import net.moonlightflower.wc3libs.dataTypes.DataTypeInfo; 5 | 6 | import javax.annotation.Nonnull; 7 | import javax.annotation.Nullable; 8 | import java.io.File; 9 | 10 | public class DestructableMetaSLK extends CommonMetaSLK { 11 | public static File GAME_PATH = new File("Units\\DestructableMetaData.slk"); 12 | 13 | public static class State extends CommonMetaSLK.State { 14 | public State(@Nonnull String idString, @Nonnull DataTypeInfo typeInfo, @Nullable T defVal) { 15 | super(idString, typeInfo, defVal); 16 | } 17 | 18 | public State(@Nonnull String idString, @Nonnull DataTypeInfo typeInfo) { 19 | super(idString, typeInfo); 20 | } 21 | 22 | public State(@Nonnull String idString, @Nonnull Class type) { 23 | super(idString, type); 24 | } 25 | 26 | public State(@Nonnull String idString, @Nonnull Class type, @Nullable T defVal) { 27 | super(idString, type, defVal); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/TXTSectionId.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt; 2 | 3 | import net.moonlightflower.wc3libs.misc.Id; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | public class TXTSectionId extends Id { 8 | protected TXTSectionId(@Nonnull String idString) { 9 | super(idString); 10 | } 11 | 12 | @Nonnull 13 | public static TXTSectionId valueOf(@Nonnull String idString) { 14 | return new TXTSectionId(idString); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/TXTState.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.DataType; 4 | import net.moonlightflower.wc3libs.dataTypes.DataTypeInfo; 5 | import net.moonlightflower.wc3libs.dataTypes.Serializable; 6 | import net.moonlightflower.wc3libs.misc.FieldId; 7 | import net.moonlightflower.wc3libs.misc.State; 8 | 9 | import javax.annotation.Nonnull; 10 | import javax.annotation.Nullable; 11 | 12 | public class TXTState extends State { 13 | public TXTState(@Nonnull String fieldIdS, @Nonnull DataTypeInfo typeInfo, @Nullable T defVal) { 14 | super(FieldId.valueOf(fieldIdS), typeInfo, defVal); 15 | } 16 | 17 | public TXTState(@Nonnull String fieldIdS, @Nonnull DataTypeInfo typeInfo) { 18 | this(fieldIdS, typeInfo, (T) typeInfo.getDefVal()); 19 | } 20 | 21 | public TXTState(@Nonnull String idString, @Nonnull Class type) { 22 | this(idString, new DataTypeInfo(type)); 23 | } 24 | 25 | public TXTState(@Nonnull String idString, @Nonnull Class type, @Nullable T defVal) { 26 | this(idString, new DataTypeInfo(type), defVal); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/Telemetry.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app; 2 | 3 | import net.moonlightflower.wc3libs.txt.TXT; 4 | 5 | import java.io.File; 6 | 7 | public class Telemetry extends TXT { 8 | public final static File GAME_PATH = new File("Units\\Telemetry.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/Condition.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | import net.moonlightflower.wc3libs.antlr.LightJassParser; 5 | import net.moonlightflower.wc3libs.txt.app.jass.expr.bool.BoolExpr; 6 | 7 | import javax.annotation.Nonnull; 8 | import java.io.StringWriter; 9 | 10 | public interface Condition { 11 | /*static Condition create(@Nonnull JassParser.ConditionContext conditionContext) { 12 | return BoolExpr.create(conditionContext.bool_expr()); 13 | }*/ 14 | 15 | static Condition create(@Nonnull LightJassParser.ConditionContext conditionContext) { 16 | return BoolExpr.create(conditionContext.expr()); 17 | } 18 | 19 | void write(@Nonnull StringWriter sw); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/Decl.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass; 2 | 3 | import javax.annotation.Nonnull; 4 | import java.io.StringWriter; 5 | 6 | public interface Decl { 7 | void write(@Nonnull StringWriter sw, boolean isLua); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/Param.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | import net.moonlightflower.wc3libs.antlr.LightJassParser; 5 | 6 | import javax.annotation.Nonnull; 7 | import java.io.StringWriter; 8 | 9 | public class Param { 10 | private String _type; 11 | private String _name; 12 | 13 | public Param(@Nonnull String type, @Nonnull String name) { 14 | _type = type; 15 | _name = name; 16 | } 17 | 18 | public static Param create(@Nonnull LightJassParser.Func_paramContext func_paramContext) { 19 | return new Param(func_paramContext.type_ref().getText(), func_paramContext.var_name().getText()); 20 | } 21 | 22 | public void write(@Nonnull StringWriter sw) { 23 | write(sw, false); 24 | } 25 | 26 | public void write(@Nonnull StringWriter sw, boolean isLua) { 27 | if (!isLua) { 28 | sw.write(_type); 29 | 30 | sw.write(" "); 31 | 32 | } 33 | sw.write(_name); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/TypeDecl.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassLexer; 4 | import net.moonlightflower.wc3libs.antlr.JassParser; 5 | import net.moonlightflower.wc3libs.antlr.LightJassParser; 6 | 7 | import javax.annotation.Nonnull; 8 | import java.io.StringWriter; 9 | 10 | public class TypeDecl implements Decl { 11 | private String _name; 12 | private String _parent; 13 | 14 | public TypeDecl(@Nonnull String name, @Nonnull String parent) { 15 | _name = name; 16 | _parent = parent; 17 | } 18 | 19 | public static TypeDecl create(@Nonnull LightJassParser.Type_declContext type_declContext) { 20 | return new TypeDecl(type_declContext.type_name().getText(), type_declContext.parent.getText()); 21 | } 22 | 23 | public void write(@Nonnull StringWriter sw, boolean isLua) { 24 | sw.write(JassScript.getPrimaryLiteral(JassLexer.TYPE_DECL)); 25 | 26 | sw.write(" "); 27 | 28 | sw.write(_name); 29 | 30 | sw.write(" "); 31 | 32 | sw.write(JassScript.getPrimaryLiteral(JassLexer.TYPE_EXTENDS)); 33 | 34 | sw.write(_parent); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/VarDecl.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassLexer; 4 | import net.moonlightflower.wc3libs.antlr.JassParser; 5 | import net.moonlightflower.wc3libs.antlr.LightJassParser; 6 | import net.moonlightflower.wc3libs.txt.app.jass.expr.Expr; 7 | 8 | import javax.annotation.Nonnull; 9 | import javax.annotation.Nullable; 10 | import java.io.StringWriter; 11 | 12 | public abstract class VarDecl implements Decl { 13 | protected boolean _isConstant; 14 | protected String _type; 15 | protected boolean _isArray; 16 | protected String _name; 17 | protected Expr _val; 18 | 19 | public VarDecl(boolean isConstant, @Nonnull String type, boolean isArray, @Nonnull String name, @Nullable Expr val) { 20 | _isConstant = isConstant; 21 | _type = type; 22 | _isArray = isArray; 23 | _name = name; 24 | _val = val; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/ArrayRead.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | import net.moonlightflower.wc3libs.txt.app.jass.expr.num.IntExpr; 5 | 6 | import javax.annotation.Nonnull; 7 | import java.io.StringWriter; 8 | 9 | public class ArrayRead implements AnyTypeExpr { 10 | private String _varRef; 11 | private IntExpr _index; 12 | 13 | public ArrayRead(@Nonnull String varRef, @Nonnull IntExpr index) { 14 | _varRef = varRef; 15 | _index = index; 16 | } 17 | 18 | public static ArrayRead create(@Nonnull JassParser.Array_readContext array_readContext) { 19 | return new ArrayRead(array_readContext.var_ref().getText(), IntExpr.create(array_readContext.int_expr())); 20 | } 21 | 22 | @Override 23 | public void write(@Nonnull StringWriter sw) { 24 | sw.write(_varRef); 25 | sw.write("["); 26 | _index.write(sw); 27 | sw.write("]"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/NullExpr.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | import net.moonlightflower.wc3libs.txt.app.jass.expr.misc_literal.NullLiteral; 5 | import net.moonlightflower.wc3libs.txt.app.jass.expr.num.CodeExpr; 6 | import net.moonlightflower.wc3libs.txt.app.jass.expr.num.HandleExpr; 7 | 8 | import javax.annotation.Nonnull; 9 | 10 | public interface NullExpr extends HandleExpr, CodeExpr, StringExpr { 11 | static NullExpr create(@Nonnull JassParser.Null_parensContext null_parensContext) { 12 | return create(null_parensContext.null_expr()); 13 | } 14 | 15 | static NullExpr create(@Nonnull JassParser.Null_exprContext null_exprContext) { 16 | if (null_exprContext.null_parens() != null) { 17 | return create(null_exprContext.null_parens()); 18 | } 19 | if (null_exprContext.any_expr_atom() != null) { 20 | return AnyTypeExpr.create(null_exprContext.any_expr_atom()); 21 | } 22 | 23 | return NullLiteral.create(null_exprContext.null_literal()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/Op.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr; 2 | 3 | import javax.annotation.Nonnull; 4 | import java.io.StringWriter; 5 | 6 | public interface Op { 7 | void write(@Nonnull StringWriter sw); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/StringConcat.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr; 2 | 3 | import javax.annotation.Nonnull; 4 | import java.io.StringWriter; 5 | 6 | public class StringConcat implements StringExpr { 7 | public interface IConcatOp extends Op { 8 | 9 | } 10 | 11 | public enum ConcatOp implements IConcatOp { 12 | CONCAT { 13 | @Override 14 | public void write(@Nonnull StringWriter sw) { 15 | sw.write("+"); 16 | } 17 | } 18 | } 19 | 20 | private StringExpr _left; 21 | private ConcatOp _op = ConcatOp.CONCAT; 22 | private StringExpr _right; 23 | 24 | public StringConcat(@Nonnull StringExpr left, @Nonnull StringExpr right) { 25 | _left = left; 26 | _right = right; 27 | } 28 | 29 | @Override 30 | public void write(@Nonnull StringWriter sw) { 31 | _left.write(sw); 32 | _op.write(sw); 33 | _right.write(sw); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/VarRef.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | 5 | import javax.annotation.Nonnull; 6 | import java.io.StringWriter; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | public class VarRef implements AnyTypeExpr { 11 | private String _varRef; 12 | 13 | public VarRef(@Nonnull String varRef) { 14 | _varRef = varRef; 15 | } 16 | 17 | public static VarRef create(@Nonnull JassParser.Var_refContext var_refContext) { 18 | return new VarRef(var_refContext.getText()); 19 | } 20 | 21 | @Override 22 | public void write(@Nonnull StringWriter sw) { 23 | sw.write(_varRef); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/bool/BoolRelation.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr.bool; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | public class BoolRelation extends Relation { 8 | public BoolRelation(@Nonnull BoolExpr left, @Nonnull Op op, @Nonnull BoolExpr right) { 9 | super(left, op, right); 10 | } 11 | 12 | public static BoolExpr create(@Nonnull JassParser.Bool_exprContext left, @Nonnull JassParser.Bool_relation_opContext bool_relation_opContext, @Nonnull JassParser.Bool_exprContext right) { 13 | return new BoolRelation(BoolExpr.create(left), createOp(bool_relation_opContext), BoolExpr.create(right)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/bool/CodeRelation.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr.bool; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | import net.moonlightflower.wc3libs.txt.app.jass.expr.num.CodeExpr; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | public class CodeRelation extends Relation { 9 | public CodeRelation(@Nonnull CodeExpr left, @Nonnull Op op, @Nonnull CodeExpr right) { 10 | super(left, op, right); 11 | } 12 | 13 | public static BoolExpr create(@Nonnull JassParser.Code_exprContext left, @Nonnull JassParser.Bool_relation_opContext bool_relation_opContext, @Nonnull JassParser.Code_exprContext right) { 14 | return new CodeRelation(CodeExpr.create(left), createOp(bool_relation_opContext), CodeExpr.create(right)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/bool/HandleRelation.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr.bool; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | import net.moonlightflower.wc3libs.txt.app.jass.expr.num.HandleExpr; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | public class HandleRelation extends Relation { 9 | public HandleRelation(@Nonnull HandleExpr left, @Nonnull Op op, @Nonnull HandleExpr right) { 10 | super(left, op, right); 11 | } 12 | 13 | public static BoolExpr create(@Nonnull JassParser.Handle_exprContext left, @Nonnull JassParser.Bool_relation_opContext bool_relation_opContext, @Nonnull JassParser.Handle_exprContext right) { 14 | return new HandleRelation(HandleExpr.create(left), createOp(bool_relation_opContext), HandleExpr.create(right)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/bool/NullRelation.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr.bool; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | import net.moonlightflower.wc3libs.txt.app.jass.expr.NullExpr; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | public class NullRelation extends Relation { 9 | public NullRelation(@Nonnull NullExpr left, @Nonnull Op op, @Nonnull NullExpr right) { 10 | super(left, op, right); 11 | } 12 | 13 | public static BoolExpr create(@Nonnull JassParser.Null_exprContext left, @Nonnull JassParser.Bool_relation_opContext bool_relation_opContext, @Nonnull JassParser.Null_exprContext right) { 14 | return new NullRelation(NullExpr.create(left), createOp(bool_relation_opContext), NullExpr.create(right)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/bool/StringRelation.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr.bool; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | import net.moonlightflower.wc3libs.txt.app.jass.expr.StringExpr; 5 | 6 | import javax.annotation.Nonnull; 7 | import java.io.StringWriter; 8 | import java.util.function.Function; 9 | 10 | public class StringRelation extends Relation { 11 | public StringRelation(@Nonnull StringExpr left, @Nonnull Op op, @Nonnull StringExpr right) { 12 | super(left, op, right); 13 | } 14 | 15 | public static BoolExpr create(@Nonnull JassParser.String_exprContext left, @Nonnull JassParser.Bool_relation_opContext bool_relation_opContext, @Nonnull JassParser.String_exprContext right) { 16 | return new StringRelation(StringExpr.create(left), createOp(bool_relation_opContext), StringExpr.create(right)); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/bool/UnaryBoolExpr.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr.bool; 2 | 3 | import net.moonlightflower.wc3libs.txt.app.jass.expr.Expr; 4 | import net.moonlightflower.wc3libs.txt.app.jass.expr.Op; 5 | 6 | import javax.annotation.Nonnull; 7 | import java.io.StringWriter; 8 | 9 | public class UnaryBoolExpr implements BoolExpr { 10 | public interface IUnaryOp extends Op { 11 | 12 | } 13 | 14 | public enum UnaryOp implements IUnaryOp { 15 | NEG { 16 | @Override 17 | public void write(@Nonnull StringWriter sw) { 18 | sw.write("not"); 19 | } 20 | } 21 | } 22 | 23 | private UnaryOp _op; 24 | private BoolExpr _expr; 25 | 26 | public UnaryBoolExpr(@Nonnull UnaryOp op, @Nonnull BoolExpr expr) { 27 | _op = op; 28 | _expr = expr; 29 | } 30 | 31 | @Override 32 | public void write(@Nonnull StringWriter sw) { 33 | _op.write(sw); 34 | sw.write(" "); 35 | _expr.write(sw); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/misc_literal/CodeLiteral.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr.misc_literal; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | import net.moonlightflower.wc3libs.txt.app.jass.expr.Literal; 5 | import net.moonlightflower.wc3libs.txt.app.jass.expr.num.CodeExpr; 6 | 7 | import javax.annotation.Nonnull; 8 | import javax.annotation.Nullable; 9 | import java.io.StringWriter; 10 | 11 | public class CodeLiteral implements CodeExpr, Literal { 12 | private String _funcRef; 13 | 14 | public CodeLiteral(@Nullable String funcRef) { 15 | _funcRef = funcRef; 16 | } 17 | 18 | public static CodeLiteral create(@Nonnull JassParser.Code_literalContext code_literalContext) { 19 | if (code_literalContext.func_ref() != null) { 20 | return new CodeLiteral(code_literalContext.func_ref().getText()); 21 | } 22 | 23 | return new CodeLiteral(null); 24 | } 25 | 26 | @Override 27 | public void write(@Nonnull StringWriter sw) { 28 | if (_funcRef == null) { 29 | new NullLiteral().write(sw); 30 | } else { 31 | sw.write("function "); 32 | 33 | sw.write(_funcRef); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/num/CodeExpr.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr.num; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | import net.moonlightflower.wc3libs.txt.app.jass.expr.Expr; 5 | import net.moonlightflower.wc3libs.txt.app.jass.expr.misc_literal.CodeLiteral; 6 | import net.moonlightflower.wc3libs.txt.app.jass.expr.misc_literal.NullLiteral; 7 | 8 | import javax.annotation.Nonnull; 9 | 10 | public interface CodeExpr extends Expr { 11 | static CodeExpr create(@Nonnull JassParser.Code_parensContext code_parensContext) { 12 | return create(code_parensContext.code_expr()); 13 | } 14 | 15 | static CodeExpr create(@Nonnull JassParser.Code_exprContext code_exprContext) { 16 | if (code_exprContext.code_literal() != null) { 17 | return CodeLiteral.create(code_exprContext.code_literal()); 18 | } 19 | if (code_exprContext.code_parens() != null) { 20 | return create(code_exprContext.code_parens()); 21 | } 22 | 23 | return Expr.create(code_exprContext.any_expr_atom()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/num/HandleExpr.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr.num; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | import net.moonlightflower.wc3libs.txt.app.jass.expr.Expr; 5 | import net.moonlightflower.wc3libs.txt.app.jass.expr.misc_literal.NullLiteral; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | public interface HandleExpr extends Expr { 10 | static HandleExpr create(@Nonnull JassParser.Handle_literalContext handle_literalContext) { 11 | return NullLiteral.create(handle_literalContext.null_literal()); 12 | } 13 | 14 | static HandleExpr create(@Nonnull JassParser.Handle_parensContext handle_parensContext) { 15 | return create(handle_parensContext.handle_expr()); 16 | } 17 | 18 | static HandleExpr create(@Nonnull JassParser.Handle_exprContext handle_exprContext) { 19 | if (handle_exprContext.handle_literal() != null) { 20 | return create(handle_exprContext.handle_literal()); 21 | } 22 | if (handle_exprContext.handle_parens() != null) { 23 | return create(handle_exprContext.handle_parens()); 24 | } 25 | 26 | return Expr.create(handle_exprContext.any_expr_atom()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/num/IntProd.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr.num; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public class IntProd extends Prod implements IntExpr { 6 | public IntProd(@Nonnull NumExpr left, @Nonnull ProdOp op, @Nonnull NumExpr right) { 7 | super(left, op, right); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/num/IntSum.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr.num; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public class IntSum extends Sum implements IntExpr { 6 | protected IntSum(@Nonnull IntExpr left, @Nonnull SumOp op, @Nonnull IntExpr right) { 7 | super(left, op, right); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/num/IntUnary.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr.num; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | public class IntUnary extends UnaryNumExpr implements IntExpr { 8 | public IntUnary(@Nonnull Sign sign, @Nonnull NumExpr expr) { 9 | super(sign, expr); 10 | } 11 | 12 | public static IntUnary create(@Nonnull JassParser.Num_unary_opContext num_unary_opContext, @Nonnull JassParser.Int_maybe_unaryContext int_maybe_unaryContext) { 13 | return new IntUnary(UnaryNumExpr.createOp(num_unary_opContext), IntExpr.create(int_maybe_unaryContext)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/num/NumExpr.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr.num; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | import net.moonlightflower.wc3libs.txt.app.jass.expr.Expr; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | public interface NumExpr extends Expr { 9 | static NumExpr create(@Nonnull JassParser.Num_exprContext num_exprContext) { 10 | if (num_exprContext.int_expr() != null) { 11 | return create(num_exprContext.int_expr()); 12 | } 13 | if (num_exprContext.real_expr() != null) { 14 | return create(num_exprContext.real_expr()); 15 | } 16 | 17 | throw new AssertionError("no option for " + num_exprContext.getText()); 18 | } 19 | 20 | static NumExpr create(@Nonnull JassParser.Int_exprContext int_exprContext) { 21 | return IntExpr.create(int_exprContext); 22 | } 23 | 24 | static NumExpr create(@Nonnull JassParser.Real_exprContext real_exprContext) { 25 | return RealExpr.create(real_exprContext); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/num/NumLiteral.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr.num; 2 | 3 | import net.moonlightflower.wc3libs.txt.app.jass.expr.Literal; 4 | 5 | public interface NumLiteral extends NumExpr, Literal { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/num/RealProd.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr.num; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public class RealProd extends Prod implements RealExpr { 6 | public RealProd(@Nonnull NumExpr left, @Nonnull ProdOp op, @Nonnull NumExpr right) { 7 | super(left, op, right); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/num/RealSum.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr.num; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public class RealSum extends Sum implements RealExpr { 6 | protected RealSum(@Nonnull RealExpr left, @Nonnull SumOp op, @Nonnull RealExpr right) { 7 | super(left, op, right); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/expr/num/RealUnary.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.expr.num; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | public class RealUnary extends UnaryNumExpr implements RealExpr { 8 | public RealUnary(@Nonnull Sign sign, @Nonnull NumExpr expr) { 9 | super(sign, expr); 10 | } 11 | 12 | public static RealUnary create(@Nonnull JassParser.Num_unary_opContext num_unary_opContext, @Nonnull JassParser.Real_maybe_unaryContext real_maybe_unaryContext) { 13 | return new RealUnary(UnaryNumExpr.createOp(num_unary_opContext), RealExpr.create(real_maybe_unaryContext)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/statement/CallStatement.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.statement; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | import net.moonlightflower.wc3libs.antlr.LightJassParser; 5 | import net.moonlightflower.wc3libs.txt.app.jass.expr.misc_literal.FuncCall; 6 | 7 | import javax.annotation.Nonnull; 8 | import java.io.StringWriter; 9 | 10 | public class CallStatement extends Statement { 11 | private FuncCall _funcCall; 12 | 13 | public CallStatement(@Nonnull FuncCall funcCall) { 14 | _funcCall = funcCall; 15 | } 16 | 17 | public static CallStatement create(@Nonnull LightJassParser.CallContext callContext) { 18 | return new CallStatement(FuncCall.create(callContext.func_call())); 19 | } 20 | 21 | @Override 22 | public void write(@Nonnull StringWriter sw, boolean isLua) { 23 | super.write(sw, isLua); 24 | 25 | if (!isLua) { 26 | sw.write("call "); 27 | } 28 | 29 | _funcCall.write(sw); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/statement/ExitwhenStatement.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.statement; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | import net.moonlightflower.wc3libs.antlr.LightJassParser; 5 | import net.moonlightflower.wc3libs.txt.app.jass.Condition; 6 | import net.moonlightflower.wc3libs.txt.app.jass.statement.Statement; 7 | 8 | import javax.annotation.Nonnull; 9 | import java.io.StringWriter; 10 | 11 | public class ExitwhenStatement extends Statement { 12 | private Condition _condition; 13 | 14 | public ExitwhenStatement(@Nonnull Condition condition) { 15 | _condition = condition; 16 | } 17 | 18 | public static ExitwhenStatement create(@Nonnull LightJassParser.ExitwhenContext exitwhenContext) { 19 | return new ExitwhenStatement(Condition.create(exitwhenContext.condition())); 20 | } 21 | 22 | @Override 23 | public void write(@Nonnull StringWriter sw, boolean isLua) { 24 | super.write(sw, isLua); 25 | 26 | sw.write("exitwhen "); 27 | 28 | _condition.write(sw); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/jass/statement/ReturnStatement.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.jass.statement; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | import net.moonlightflower.wc3libs.antlr.LightJassParser; 5 | import net.moonlightflower.wc3libs.txt.app.jass.expr.Expr; 6 | import net.moonlightflower.wc3libs.txt.app.jass.statement.Statement; 7 | 8 | import javax.annotation.Nonnull; 9 | import javax.annotation.Nullable; 10 | import java.io.StringWriter; 11 | 12 | public class ReturnStatement extends Statement { 13 | private Expr _expr; 14 | 15 | public ReturnStatement(@Nullable Expr expr) { 16 | _expr = expr; 17 | } 18 | 19 | public static ReturnStatement create(@Nonnull LightJassParser.Rule_returnContext ruleReturnContext) { 20 | Expr expr = ruleReturnContext.expr() != null ? Expr.create(ruleReturnContext.expr()) : null; 21 | 22 | return new ReturnStatement(expr); 23 | } 24 | 25 | @Override 26 | public void write(@Nonnull StringWriter sw, boolean isLua) { 27 | super.write(sw, isLua); 28 | 29 | sw.write("return"); 30 | 31 | if (_expr != null) { 32 | sw.write(" "); 33 | 34 | _expr.write(sw); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/CampaignAbilityFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class CampaignAbilityFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\CampaignAbilityFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/CampaignAbilityStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class CampaignAbilityStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\CampaignAbilityStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/CampaignUnitFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class CampaignUnitFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\CampaignUnitFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/CampaignUnitStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class CampaignUnitStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\CampaignUnitStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/CampaignUpgradeFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class CampaignUpgradeFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\CampaignUpgradeFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/CampaignUpgradeStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class CampaignUpgradeStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\CampaignUpgradeFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/CommandFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class CommandFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\CommandFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/CommandStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class CommandStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\CommandFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/CommonAbilityFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class CommonAbilityFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\CommonAbilityFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/CommonAbilityStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class CommonAbilityStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\CommonAbilityFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/HumanAbilityFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class HumanAbilityFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\HumanAbilityFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/HumanAbilityStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class HumanAbilityStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\HumanAbilityFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/HumanUnitFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class HumanUnitFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\HumanUnitFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/HumanUnitStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class HumanUnitStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\HumanUnitStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/HumanUpgradeFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class HumanUpgradeFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\HumanUpgradeFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/HumanUpgradeStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class HumanUpgradeStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\HumanUpgradeStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/ItemAbilityFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class ItemAbilityFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\ItemAbilityFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/ItemAbilityStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class ItemAbilityStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\ItemAbilityStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/ItemFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class ItemFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\ItemFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/ItemStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class ItemStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\ItemStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/MiscData.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class MiscData extends Profile { 8 | public final static File GAME_PATH = new File("Units\\MiscData.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/MiscGame.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class MiscGame extends Profile { 8 | public final static File GAME_PATH = new File("Units\\MiscGame.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/NeutralAbilityFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class NeutralAbilityFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\NeutralAbilityFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/NeutralAbilityStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class NeutralAbilityStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\NeutralAbilityStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/NeutralUnitFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class NeutralUnitFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\NeutralUnitFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/NeutralUnitStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class NeutralUnitStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\NeutralUnitStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/NeutralUpgradeFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class NeutralUpgradeFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\NeutralUpgradeFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/NeutralUpgradeStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class NeutralUpgradeStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\NeutralUpgradeStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/NightElfAbilityFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class NightElfAbilityFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\NightElfAbilityFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/NightElfAbilityStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class NightElfAbilityStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\NightElfAbilityStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/NightElfUnitFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class NightElfUnitFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\NightElfUnitFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/NightElfUnitStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class NightElfUnitStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\NightElfUnitStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/NightElfUpgradeFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class NightElfUpgradeFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\NightElfUpgradeFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/NightElfUpgradeStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class NightElfUpgradeStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\NightElfUpgradeStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/OrcAbilityFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class OrcAbilityFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\OrcAbilityFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/OrcAbilityStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class OrcAbilityStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\OrcAbilityStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/OrcUnitFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class OrcUnitFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\OrcUnitFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/OrcUnitStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class OrcUnitStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\OrcUnitStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/OrcUpgradeFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class OrcUpgradeFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\OrcUpgradeFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/OrcUpgradeStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class OrcUpgradeStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\OrcUpgradeStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/UndeadAbilityFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class UndeadAbilityFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\UndeadAbilityFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/UndeadAbilityStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class UndeadAbilityStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\UndeadAbilityStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/UndeadUnitFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class UndeadUnitFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\UndeadUnitFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/UndeadUnitStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class UndeadUnitStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\UndeadUnitStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/UndeadUpgradeFunc.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class UndeadUpgradeFunc extends Profile { 8 | public final static File GAME_PATH = new File("Units\\UndeadUpgradeFunc.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/moonlightflower/wc3libs/txt/app/profile/UndeadUpgradeStrings.java: -------------------------------------------------------------------------------- 1 | package net.moonlightflower.wc3libs.txt.app.profile; 2 | 3 | import net.moonlightflower.wc3libs.txt.Profile; 4 | 5 | import java.io.File; 6 | 7 | public class UndeadUpgradeStrings extends Profile { 8 | public final static File GAME_PATH = new File("Units\\UndeadUpgradeStrings.txt"); 9 | } 10 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/DOOTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.app.DOO; 4 | import net.moonlightflower.wc3libs.bin.app.DOO_UNITS; 5 | import net.moonlightflower.wc3libs.bin.app.MMP; 6 | import org.testng.annotations.Test; 7 | import wc3libs.misc.Wc3LibTest; 8 | 9 | import java.io.IOException; 10 | 11 | public class DOOTest extends Wc3LibTest { 12 | @Test() 13 | public void readWriteCycle() throws IOException { 14 | readWriteCycle(DOO.class, getFile("wc3data/DOO/war3map.doo")); 15 | } 16 | 17 | @Test() 18 | public void readWriteCycle_with_skin() throws IOException { 19 | readWriteCycle(DOO.class, getFile("wc3data/DOO/war3map_with_skin.doo")); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/DOO_UNITSTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.app.DOO; 4 | import net.moonlightflower.wc3libs.bin.app.DOO_UNITS; 5 | import org.testng.annotations.Test; 6 | import wc3libs.misc.Wc3LibTest; 7 | 8 | import java.io.IOException; 9 | 10 | public class DOO_UNITSTest extends Wc3LibTest { 11 | @Test() 12 | public void readWriteCycle() throws IOException { 13 | readWriteCycle(DOO_UNITS.class, getFile("wc3data/DOO_UNITS/war3mapUnits.doo")); 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/IMPTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.app.IMP; 4 | import org.testng.annotations.Test; 5 | import wc3libs.misc.Wc3LibTest; 6 | 7 | import java.io.IOException; 8 | 9 | public class IMPTest extends Wc3LibTest { 10 | @Test() 11 | public void readWriteCycle() throws IOException { 12 | readWriteCycle(IMP.class, getFile("wc3data/war3map.imp")); 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/MMPTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.app.MMP; 4 | import org.testng.annotations.Test; 5 | import wc3libs.misc.Wc3LibTest; 6 | 7 | import java.io.IOException; 8 | 9 | public class MMPTest extends Wc3LibTest { 10 | @Test() 11 | public void readWriteCycle() throws IOException { 12 | readWriteCycle(MMP.class, getFile("wc3data/MMP/war3map.mmp")); 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/MapFooterTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.Wc3BinInputStream; 4 | import net.moonlightflower.wc3libs.bin.app.MapFooter; 5 | import net.moonlightflower.wc3libs.bin.app.MapFooter; 6 | import net.moonlightflower.wc3libs.bin.app.WPM; 7 | import net.moonlightflower.wc3libs.port.Orient; 8 | import org.testng.Assert; 9 | import org.testng.annotations.Test; 10 | import wc3libs.misc.Wc3LibTest; 11 | 12 | import java.io.File; 13 | import java.io.IOException; 14 | import java.nio.file.Files; 15 | import java.nio.file.Paths; 16 | 17 | public class MapFooterTest extends Wc3LibTest { 18 | @Test() 19 | public void readWriteCycle() throws IOException { 20 | File inFile = getFile("wc3data/Map/Forest_Defense_0.18w_sign.w3x"); 21 | 22 | MapFooter mapFooter = MapFooter.ofMapFile(inFile); 23 | 24 | File outFile = File.createTempFile("wc3libsTest", "mapFooter"); 25 | 26 | Orient.copyFile(inFile, outFile, true); 27 | 28 | mapFooter.writeToMapFile(outFile); 29 | 30 | byte[] inBytes = Files.readAllBytes(inFile.toPath()); 31 | byte[] outBytes = Files.readAllBytes(outFile.toPath()); 32 | 33 | Assert.assertEquals(outBytes, inBytes); 34 | } 35 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/MapHeaderTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.Wc3BinInputStream; 4 | import net.moonlightflower.wc3libs.bin.app.MapHeader; 5 | import net.moonlightflower.wc3libs.bin.app.WPM; 6 | import net.moonlightflower.wc3libs.port.Orient; 7 | import org.testng.Assert; 8 | import org.testng.annotations.Test; 9 | import wc3libs.misc.Wc3LibTest; 10 | 11 | import java.io.File; 12 | import java.io.IOException; 13 | import java.nio.file.Files; 14 | import java.nio.file.Paths; 15 | 16 | public class MapHeaderTest extends Wc3LibTest { 17 | @Test() 18 | public void readWriteCycle() throws IOException { 19 | File inFile = getFile("wc3data/Map/Forest_Defense_0.18w.w3x"); 20 | 21 | Wc3BinInputStream stream = new Wc3BinInputStream(inFile); 22 | 23 | MapHeader.Reader reader = new MapHeader.Reader(stream); 24 | 25 | MapHeader mapHeader = reader.exec(); 26 | 27 | stream.close(); 28 | 29 | File outFile = File.createTempFile("wc3libsTest", "mapHeader"); 30 | 31 | Orient.copyFile(inFile, outFile, true); 32 | 33 | mapHeader.writeToMapFile(outFile); 34 | 35 | byte[] inBytes = Files.readAllBytes(inFile.toPath()); 36 | byte[] outBytes = Files.readAllBytes(outFile.toPath()); 37 | 38 | Assert.assertEquals(outBytes, inBytes); 39 | } 40 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/SHDTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.app.SHD; 4 | import org.testng.annotations.Test; 5 | import wc3libs.misc.Wc3LibTest; 6 | 7 | import java.io.IOException; 8 | 9 | public class SHDTest extends Wc3LibTest { 10 | @Test() 11 | public void readWriteCycle() throws IOException { 12 | readWriteCycle(SHD.class, getFile("wc3data/SHD/war3map.shd")); 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/W3ATest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.app.objMod.W3A; 4 | import org.testng.annotations.Test; 5 | import wc3libs.misc.Wc3LibTest; 6 | 7 | import java.io.IOException; 8 | 9 | public class W3ATest extends Wc3LibTest { 10 | @Test() 11 | public void readWriteCycle() throws IOException { 12 | readWriteCycle(W3A.class, getFile("wc3data/W3A/war3map.w3a")); 13 | readWriteCycle(W3A.class, getFile("wc3data/W3A/war3map_format3.w3a")); 14 | readWriteCycle(W3A.class, getFile("wc3data/W3A/threeLetterId.w3a")); 15 | } 16 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/W3BTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.app.objMod.W3A; 4 | import net.moonlightflower.wc3libs.bin.app.objMod.W3B; 5 | import org.testng.annotations.Test; 6 | import wc3libs.misc.Wc3LibTest; 7 | 8 | import java.io.IOException; 9 | 10 | public class W3BTest extends Wc3LibTest { 11 | @Test() 12 | public void readWriteCycle() throws IOException { 13 | readWriteCycle(W3B.class, getFile("wc3data/W3B/war3map.w3b")); 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/W3DTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.app.objMod.W3B; 4 | import net.moonlightflower.wc3libs.bin.app.objMod.W3D; 5 | import org.testng.annotations.Test; 6 | import wc3libs.misc.Wc3LibTest; 7 | 8 | import java.io.IOException; 9 | 10 | public class W3DTest extends Wc3LibTest { 11 | @Test() 12 | public void readWriteCycle() throws IOException { 13 | readWriteCycle(W3D.class, getFile("wc3data/W3D/war3map.w3d")); 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/W3ETest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.app.W3E; 4 | import net.moonlightflower.wc3libs.bin.app.WPM; 5 | import org.testng.annotations.Test; 6 | import wc3libs.misc.Wc3LibTest; 7 | 8 | import java.io.IOException; 9 | 10 | public class W3ETest extends Wc3LibTest { 11 | @Test() 12 | public void readWriteCycle() throws IOException { 13 | readWriteCycle(W3E.class, getFile("wc3data/W3E/war3map.w3e")); 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/W3HTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.app.objMod.W3D; 4 | import net.moonlightflower.wc3libs.bin.app.objMod.W3H; 5 | import org.testng.annotations.Test; 6 | import wc3libs.misc.Wc3LibTest; 7 | 8 | import java.io.IOException; 9 | 10 | public class W3HTest extends Wc3LibTest { 11 | @Test() 12 | public void readWriteCycle() throws IOException { 13 | readWriteCycle(W3H.class, getFile("wc3data/W3H/war3map.w3h")); 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/W3QTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.app.objMod.W3H; 4 | import net.moonlightflower.wc3libs.bin.app.objMod.W3Q; 5 | import org.testng.annotations.Test; 6 | import wc3libs.misc.Wc3LibTest; 7 | 8 | import java.io.IOException; 9 | 10 | public class W3QTest extends Wc3LibTest { 11 | @Test() 12 | public void readWriteCycle() throws IOException { 13 | readWriteCycle(W3Q.class, getFile("wc3data/W3Q/war3map.w3q")); 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/W3STest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.BinState; 4 | import net.moonlightflower.wc3libs.bin.Wc3BinInputStream; 5 | import net.moonlightflower.wc3libs.bin.Wc3BinOutputStream; 6 | import net.moonlightflower.wc3libs.bin.app.W3R; 7 | import net.moonlightflower.wc3libs.bin.app.W3S; 8 | import org.testng.Assert; 9 | import org.testng.annotations.Test; 10 | import wc3libs.misc.Wc3LibTest; 11 | 12 | import java.io.ByteArrayInputStream; 13 | import java.io.ByteArrayOutputStream; 14 | import java.io.IOException; 15 | 16 | public class W3STest extends Wc3LibTest { 17 | @Test() 18 | public void readWriteCycle() throws IOException { 19 | readWriteCycle(W3S.class, getFile("wc3data/W3S/war3map.w3s")); 20 | } 21 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/W3TTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.app.objMod.W3H; 4 | import net.moonlightflower.wc3libs.bin.app.objMod.W3T; 5 | import org.testng.annotations.Test; 6 | import wc3libs.misc.Wc3LibTest; 7 | 8 | import java.io.IOException; 9 | 10 | public class W3TTest extends Wc3LibTest { 11 | @Test() 12 | public void readWriteCycle() throws IOException { 13 | readWriteCycle(W3T.class, getFile("wc3data/W3T/war3map.w3t")); 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/W3UTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.app.objMod.W3H; 4 | import net.moonlightflower.wc3libs.bin.app.objMod.W3U; 5 | import org.testng.annotations.Test; 6 | import wc3libs.misc.Wc3LibTest; 7 | 8 | import java.io.IOException; 9 | 10 | public class W3UTest extends Wc3LibTest { 11 | @Test() 12 | public void readWriteCycle() throws IOException { 13 | readWriteCycle(W3U.class, getFile("wc3data/W3U/war3map.w3u")); 14 | readWriteCycle(W3U.class, getFile("wc3data/W3U/war3mapReforged.w3u")); 15 | readWriteCycle(W3U.class, getFile("wc3data/W3U/war3mapBorked.w3u")); 16 | } 17 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/WCTTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.app.WCT; 4 | import net.moonlightflower.wc3libs.bin.app.WTG; 5 | import org.testng.annotations.Test; 6 | import wc3libs.misc.Wc3LibTest; 7 | 8 | import java.io.IOException; 9 | 10 | public class WCTTest extends Wc3LibTest { 11 | @Test() 12 | public void readWriteCycle() throws IOException { 13 | readWriteCycle(WCT.class, getFile("wc3data/WCT/war3map.wct")); 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/WPMTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.app.W3S; 4 | import net.moonlightflower.wc3libs.bin.app.WPM; 5 | import org.testng.annotations.Test; 6 | import wc3libs.misc.Wc3LibTest; 7 | 8 | import java.io.IOException; 9 | 10 | public class WPMTest extends Wc3LibTest { 11 | @Test() 12 | public void readWriteCycle() throws IOException { 13 | readWriteCycle(WPM.class, getFile("wc3data/WPM/war3map.wpm")); 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/bin/app/WTGTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.bin.app; 2 | 3 | import net.moonlightflower.wc3libs.bin.Wc3BinInputStream; 4 | import net.moonlightflower.wc3libs.bin.Wc3BinOutputStream; 5 | import net.moonlightflower.wc3libs.bin.app.DOO_UNITS; 6 | import net.moonlightflower.wc3libs.bin.app.WTG; 7 | import net.moonlightflower.wc3libs.port.JMpqPort; 8 | import net.moonlightflower.wc3libs.port.MpqPort; 9 | import net.moonlightflower.wc3libs.txt.TXT; 10 | import org.testng.Assert; 11 | import org.testng.annotations.Test; 12 | import wc3libs.misc.Wc3LibTest; 13 | 14 | import java.io.*; 15 | import java.lang.reflect.InvocationTargetException; 16 | import java.lang.reflect.Method; 17 | 18 | public class WTGTest extends Wc3LibTest { 19 | @Test() 20 | public void readWriteCycle() throws Exception { 21 | WTG wtg = new WTG(); 22 | 23 | wtg.addTriggerData(new TXT(getFile("wc3data/UI/TriggerData.txt"))); 24 | 25 | readWriteCycle(wtg, getFile("wc3data/WTG/war3map.wtg")); 26 | } 27 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/dataTypes/app/AIPlaceTypeTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.AIPlaceType; 4 | import org.testng.Assert; 5 | import org.testng.annotations.Test; 6 | 7 | public class AIPlaceTypeTest { 8 | @Test 9 | public void test() { 10 | Assert.assertEquals(AIPlaceType.valueOf(0), AIPlaceType.NONE); 11 | Assert.assertEquals(AIPlaceType.valueOf(1), AIPlaceType.TOWNHALL); 12 | Assert.assertEquals(AIPlaceType.valueOf(2), AIPlaceType.RESOURCE); 13 | Assert.assertEquals(AIPlaceType.valueOf(3), AIPlaceType.FACTORY); 14 | Assert.assertEquals(AIPlaceType.valueOf(4), AIPlaceType.GENERAL); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/dataTypes/app/ArmorSoundTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.AIPlaceType; 4 | import net.moonlightflower.wc3libs.dataTypes.app.ArmorSound; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | public class ArmorSoundTest { 9 | @Test 10 | public void test() { 11 | Assert.assertEquals(ArmorSound.valueOf("Ethereal"), ArmorSound.ETHEREAL); 12 | Assert.assertEquals(ArmorSound.valueOf("Flesh"), ArmorSound.FLESH); 13 | Assert.assertEquals(ArmorSound.valueOf("Metal"), ArmorSound.METAL); 14 | Assert.assertEquals(ArmorSound.valueOf("Stone"), ArmorSound.STONE); 15 | Assert.assertEquals(ArmorSound.valueOf("Wood"), ArmorSound.WOOD); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/dataTypes/app/AttackBitsTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.ArmorSound; 4 | import net.moonlightflower.wc3libs.dataTypes.app.AttackBits; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | public class AttackBitsTest { 9 | @Test 10 | public void test() { 11 | Assert.assertEquals(AttackBits.valueOf(0), AttackBits.NONE); 12 | Assert.assertEquals(AttackBits.valueOf(1), AttackBits.FIRST); 13 | Assert.assertEquals(AttackBits.valueOf(2), AttackBits.SECOND); 14 | Assert.assertEquals(AttackBits.valueOf(3), AttackBits.BOTH); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/dataTypes/app/AttributeTypeTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.AttackType; 4 | import net.moonlightflower.wc3libs.dataTypes.app.AttributeType; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | public class AttributeTypeTest { 9 | @Test 10 | public void test() { 11 | Assert.assertEquals(AttributeType.valueOf("AGI"), AttributeType.AGI); 12 | Assert.assertEquals(AttributeType.valueOf("INT"), AttributeType.INT); 13 | Assert.assertEquals(AttributeType.valueOf("STR"), AttributeType.STR); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/dataTypes/app/ControllerTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.CombatTarget; 4 | import net.moonlightflower.wc3libs.dataTypes.app.Controller; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | public class ControllerTest { 9 | @Test 10 | public void test() { 11 | Assert.assertEquals(Controller.valueOf(2), Controller.COMPUTER); 12 | Assert.assertEquals(Controller.valueOf(3), Controller.NEUTRAL); 13 | Assert.assertEquals(Controller.valueOf(4), Controller.RESCUABLE); 14 | Assert.assertEquals(Controller.valueOf(1), Controller.USER); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/dataTypes/app/DeathTypeTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.Controller; 4 | import net.moonlightflower.wc3libs.dataTypes.app.DeathType; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | public class DeathTypeTest { 9 | @Test 10 | public void test() { 11 | Assert.assertEquals(DeathType.valueOf(0x0), DeathType.NONE); 12 | Assert.assertEquals(DeathType.valueOf(0x1), DeathType.RAISES); 13 | Assert.assertEquals(DeathType.valueOf(0x2), DeathType.DECAYS); 14 | Assert.assertEquals(DeathType.valueOf(0x3), DeathType.RAISES_AND_DECAYS); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/dataTypes/app/DestructableClassTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.DefType; 4 | import net.moonlightflower.wc3libs.dataTypes.app.DestructableClass; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | public class DestructableClassTest { 9 | @Test 10 | public void test() { 11 | Assert.assertEquals(DestructableClass.valueOf("B"), DestructableClass.BRIDGE); 12 | Assert.assertEquals(DestructableClass.valueOf("D"), DestructableClass.DESTRUCTABLE); 13 | Assert.assertEquals(DestructableClass.valueOf("P"), DestructableClass.PATHING); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/dataTypes/app/DoodadClassTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.DestructableClass; 4 | import net.moonlightflower.wc3libs.dataTypes.app.DoodadClass; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | public class DoodadClassTest { 9 | @Test 10 | public void test() { 11 | Assert.assertEquals(DoodadClass.valueOf("Z"), DoodadClass.CINEMATIC); 12 | Assert.assertEquals(DoodadClass.valueOf("C"), DoodadClass.CLIFF); 13 | Assert.assertEquals(DoodadClass.valueOf("E"), DoodadClass.ENVIRONMENT); 14 | Assert.assertEquals(DoodadClass.valueOf("O"), DoodadClass.ITEM); 15 | Assert.assertEquals(DoodadClass.valueOf("S"), DoodadClass.STRUCTURE); 16 | Assert.assertEquals(DoodadClass.valueOf("W"), DoodadClass.WATER); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/dataTypes/app/ItemClassTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.DoodadClass; 4 | import net.moonlightflower.wc3libs.dataTypes.app.ItemClass; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | public class ItemClassTest { 9 | @Test 10 | public void test() { 11 | Assert.assertEquals(ItemClass.valueOf("Artifact"), ItemClass.ARTIFACT); 12 | Assert.assertEquals(ItemClass.valueOf("Campaign"), ItemClass.CAMPAIGN); 13 | Assert.assertEquals(ItemClass.valueOf("Charged"), ItemClass.CHARGED); 14 | Assert.assertEquals(ItemClass.valueOf("Miscellaneous"), ItemClass.MISC); 15 | Assert.assertEquals(ItemClass.valueOf("Permanent"), ItemClass.PERMANENT); 16 | Assert.assertEquals(ItemClass.valueOf("PowerUp"), ItemClass.POWERUP); 17 | Assert.assertEquals(ItemClass.valueOf("Purchasable"), ItemClass.PURCHASE); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/dataTypes/app/MoveTypeTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.ItemClass; 4 | import net.moonlightflower.wc3libs.dataTypes.app.MoveType; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | public class MoveTypeTest { 9 | @Test 10 | public void test() { 11 | Assert.assertEquals(MoveType.valueOf("amph"), MoveType.AMPHIBIOUS); 12 | Assert.assertEquals(MoveType.valueOf("float"), MoveType.FLOAT); 13 | Assert.assertEquals(MoveType.valueOf("fly"), MoveType.FLY); 14 | Assert.assertEquals(MoveType.valueOf("foot"), MoveType.FOOT); 15 | Assert.assertEquals(MoveType.valueOf("horse"), MoveType.HORSE); 16 | Assert.assertEquals(MoveType.valueOf("hover"), MoveType.HOVER); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/dataTypes/app/RegenTypeTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.PathingFlag; 4 | import net.moonlightflower.wc3libs.dataTypes.app.RegenType; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | public class RegenTypeTest { 9 | @Test 10 | public void test() { 11 | Assert.assertEquals(RegenType.valueOf("none"), RegenType.NONE); 12 | Assert.assertEquals(RegenType.valueOf("always"), RegenType.ALWAYS); 13 | Assert.assertEquals(RegenType.valueOf("blight"), RegenType.BLIGHT); 14 | Assert.assertEquals(RegenType.valueOf("day"), RegenType.DAY); 15 | Assert.assertEquals(RegenType.valueOf("night"), RegenType.NIGHT); 16 | 17 | Assert.assertEquals(RegenType.valueOf(0), RegenType.NONE); 18 | Assert.assertEquals(RegenType.valueOf(1), RegenType.ALWAYS); 19 | Assert.assertEquals(RegenType.valueOf(2), RegenType.BLIGHT); 20 | Assert.assertEquals(RegenType.valueOf(3), RegenType.DAY); 21 | Assert.assertEquals(RegenType.valueOf(4), RegenType.NIGHT); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/dataTypes/app/SpellDetailTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.RegenType; 4 | import net.moonlightflower.wc3libs.dataTypes.app.SpellDetail; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | public class SpellDetailTest { 9 | @Test 10 | public void test() { 11 | Assert.assertEquals(SpellDetail.valueOf(0), SpellDetail.LOW); 12 | Assert.assertEquals(SpellDetail.valueOf(1), SpellDetail.MEDIUM); 13 | Assert.assertEquals(SpellDetail.valueOf(2), SpellDetail.HIGH); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/dataTypes/app/TerrainFogTypeTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.SpellDetail; 4 | import net.moonlightflower.wc3libs.dataTypes.app.TerrainFogType; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | public class TerrainFogTypeTest { 9 | @Test 10 | public void test() { 11 | Assert.assertEquals(TerrainFogType.valueOf(0), TerrainFogType.NONE); 12 | Assert.assertEquals(TerrainFogType.valueOf(1), TerrainFogType.LINEAR); 13 | Assert.assertEquals(TerrainFogType.valueOf(2), TerrainFogType.EXP); 14 | Assert.assertEquals(TerrainFogType.valueOf(3), TerrainFogType.EXP2); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/dataTypes/app/UnitRaceTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.UnitClass; 4 | import net.moonlightflower.wc3libs.dataTypes.app.UnitRace; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | public class UnitRaceTest { 9 | @Test 10 | public void test() { 11 | Assert.assertEquals(UnitRace.valueOf("human"), UnitRace.HUMAN); 12 | Assert.assertEquals(UnitRace.valueOf("orc"), UnitRace.ORC); 13 | Assert.assertEquals(UnitRace.valueOf("undead"), UnitRace.UNDEAD); 14 | Assert.assertEquals(UnitRace.valueOf("nightelf"), UnitRace.NIGHT_ELF); 15 | Assert.assertEquals(UnitRace.valueOf("demon"), UnitRace.DEMON); 16 | Assert.assertEquals(UnitRace.valueOf("creeps"), UnitRace.CREEPS); 17 | Assert.assertEquals(UnitRace.valueOf("critters"), UnitRace.CRITTERS); 18 | Assert.assertEquals(UnitRace.valueOf("other"), UnitRace.OTHER); 19 | Assert.assertEquals(UnitRace.valueOf("commoner"), UnitRace.COMMONER); 20 | Assert.assertEquals(UnitRace.valueOf("naga"), UnitRace.NAGA); 21 | Assert.assertEquals(UnitRace.valueOf("unknown"), UnitRace.UNKNOWN); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/dataTypes/app/UpgradeClassTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.UnitRace; 4 | import net.moonlightflower.wc3libs.dataTypes.app.UpgradeClass; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | public class UpgradeClassTest { 9 | @Test 10 | public void test() { 11 | Assert.assertEquals(UpgradeClass.valueOf("armor"), UpgradeClass.ARMOR); 12 | Assert.assertEquals(UpgradeClass.valueOf("artillery"), UpgradeClass.ARTILLERY); 13 | Assert.assertEquals(UpgradeClass.valueOf("caster"), UpgradeClass.CASTER); 14 | Assert.assertEquals(UpgradeClass.valueOf("melee"), UpgradeClass.MELEE); 15 | Assert.assertEquals(UpgradeClass.valueOf("ranged"), UpgradeClass.RANGED); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/dataTypes/app/VersionFlagsTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.UpgradeEffect; 4 | import net.moonlightflower.wc3libs.dataTypes.app.VersionFlags; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | public class VersionFlagsTest { 9 | @Test 10 | public void test() { 11 | Assert.assertEquals(VersionFlags.valueOf(0x0), VersionFlags.NONE); 12 | Assert.assertEquals(VersionFlags.valueOf(0x1), VersionFlags.ROC); 13 | Assert.assertEquals(VersionFlags.valueOf(0x2), VersionFlags.TFT); 14 | Assert.assertEquals(VersionFlags.valueOf(0x3), VersionFlags.BOTH); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/dataTypes/app/WeaponTypeTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.dataTypes.app; 2 | 3 | import net.moonlightflower.wc3libs.dataTypes.app.VersionFlags; 4 | import net.moonlightflower.wc3libs.dataTypes.app.WeaponType; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | public class WeaponTypeTest { 9 | @Test 10 | public void test() { 11 | Assert.assertEquals(WeaponType.valueOf("artillery"), WeaponType.ARTILLERY); 12 | Assert.assertEquals(WeaponType.valueOf("aline"), WeaponType.ARTILLERY_LINE); 13 | Assert.assertEquals(WeaponType.valueOf("instant"), WeaponType.INSTANT); 14 | Assert.assertEquals(WeaponType.valueOf("missile"), WeaponType.MISSILE); 15 | Assert.assertEquals(WeaponType.valueOf("msplash"), WeaponType.MISSILE_SPLASH); 16 | Assert.assertEquals(WeaponType.valueOf("mbounce"), WeaponType.MISSILE_BOUNCE); 17 | Assert.assertEquals(WeaponType.valueOf("mline"), WeaponType.MISSILE_LINE); 18 | Assert.assertEquals(WeaponType.valueOf("normal"), WeaponType.NORMAL); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/misc/BLPTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.misc; 2 | 3 | import net.moonlightflower.wc3libs.misc.UnsupportedFormatException; 4 | import net.moonlightflower.wc3libs.misc.image.BLP; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | import java.io.File; 9 | import java.io.IOException; 10 | 11 | public class BLPTest extends Wc3LibTest { 12 | @Test 13 | public void testBlp() throws IOException, UnsupportedFormatException { 14 | File file = getFile("images/test.blp"); 15 | BLP blp = new BLP(file); 16 | 17 | Assert.assertEquals(blp.getHeight(), 64); 18 | Assert.assertEquals(blp.getWidth(), 64); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/misc/ColorCodeTransformerTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.misc; 2 | 3 | import net.moonlightflower.wc3libs.misc.ColorCodeTransformer; 4 | import org.testng.annotations.Test; 5 | 6 | import static org.testng.Assert.*; 7 | 8 | public class ColorCodeTransformerTest { 9 | 10 | @Test 11 | public void testTransformToHtml() { 12 | String result = ColorCodeTransformer.transformToHtml("|cff122132Hello World!|r"); 13 | assertEquals(result, "Hello World!"); 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/misc/JPGTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.misc; 2 | 3 | import net.moonlightflower.wc3libs.misc.image.JPG; 4 | import org.testng.Assert; 5 | import org.testng.annotations.Test; 6 | 7 | import java.io.File; 8 | import java.io.FileNotFoundException; 9 | import java.io.IOException; 10 | 11 | public class JPGTest extends Wc3LibTest { 12 | @Test 13 | public void testJpg() throws IOException { 14 | File file = getFile("images/test.jpg"); 15 | JPG jpg = new JPG(file); 16 | 17 | Assert.assertEquals(jpg.getHeight(), 256); 18 | Assert.assertEquals(jpg.getWidth(), 256); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/misc/MathTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.misc; 2 | 3 | import net.moonlightflower.wc3libs.misc.Math; 4 | import org.testng.Assert; 5 | import org.testng.annotations.Test; 6 | 7 | public class MathTest { 8 | @Test() 9 | public void decodeEncode() { 10 | Assert.assertEquals(Math.decode("A", Math.CODE_ASCII), 65); 11 | 12 | Assert.assertEquals(Math.encode(65, Math.CODE_ASCII), "A"); 13 | 14 | Assert.assertEquals(Math.encode(1747988548, Math.CODE_ASCII), "h00D"); 15 | 16 | Assert.assertEquals(Math.decode("D00h", Math.CODE_ASCII), 1144008808); 17 | 18 | System.out.println(Math.encode(1747988549, Math.CODE_ASCII)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/misc/SizeTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.misc; 2 | 3 | import net.moonlightflower.wc3libs.misc.Size; 4 | import org.testng.Assert; 5 | import org.testng.annotations.Test; 6 | 7 | public class SizeTest { 8 | @Test() 9 | public void test() { 10 | Size size = new Size(10, 20); 11 | 12 | Assert.assertEquals(size.getWidth(), 10); 13 | Assert.assertEquals(size.getHeight(), 20); 14 | Assert.assertEquals(size.getArea(), 10*20); 15 | 16 | Assert.assertEquals(size, new Size(10, 20)); 17 | 18 | Assert.assertEquals(size.toString(), "10x20"); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/misc/StateTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.misc; 2 | 3 | import net.moonlightflower.wc3libs.misc.State; 4 | import net.moonlightflower.wc3libs.slk.app.meta.AbilityMetaSLK; 5 | import net.moonlightflower.wc3libs.slk.app.meta.CommonMetaSLK; 6 | import org.testng.Assert; 7 | import org.testng.annotations.Test; 8 | 9 | import java.util.Collection; 10 | 11 | public class StateTest { 12 | @SuppressWarnings({"unchecked", "rawtypes"}) 13 | @Test() 14 | public void test() { 15 | Class c = AbilityMetaSLK.State.class; 16 | 17 | Collection states = State.allValues(c); 18 | 19 | Assert.assertTrue(states.contains(AbilityMetaSLK.State.USE_CREEP)); 20 | Assert.assertTrue(states.contains(CommonMetaSLK.State.CAN_BE_EMPTY)); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/misc/StringHashTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.misc; 2 | 3 | import org.testng.Assert; 4 | import org.testng.annotations.Test; 5 | import net.moonlightflower.wc3libs.misc.StringHash; 6 | 7 | public class StringHashTest { 8 | 9 | @Test 10 | public void testStringHash() throws Exception { 11 | Assert.assertEquals(StringHash.hash(""), 0); 12 | Assert.assertEquals(StringHash.hash("0"), -242600650); 13 | Assert.assertEquals(StringHash.hash("12345678901234"), 306791019); 14 | /*Assert.assertEquals(StringHash.hash("äöü"), 1243485226); 15 | Assert.assertEquals(StringHash.hash("abc"), 1043745117); 16 | Assert.assertEquals(StringHash.hash("我"), 1458977629);*/ 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/misc/TGATest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.misc; 2 | 3 | import net.moonlightflower.wc3libs.misc.UnsupportedFormatException; 4 | import net.moonlightflower.wc3libs.misc.image.TGA; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | import java.io.File; 9 | import java.io.IOException; 10 | 11 | public class TGATest extends Wc3LibTest { 12 | @Test 13 | public void testTga() throws IOException, UnsupportedFormatException { 14 | File file = getFile("images/test.tga"); 15 | TGA tga = new TGA(file); 16 | 17 | Assert.assertEquals(tga.getHeight(), 64); 18 | Assert.assertEquals(tga.getWidth(), 64); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/misc/WAVTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.misc; 2 | 3 | import net.moonlightflower.wc3libs.misc.audio.WAV; 4 | import org.testng.Assert; 5 | import org.testng.annotations.Test; 6 | 7 | import javax.sound.sampled.LineUnavailableException; 8 | import javax.sound.sampled.UnsupportedAudioFileException; 9 | import java.io.File; 10 | import java.io.IOException; 11 | 12 | public class WAVTest extends Wc3LibTest { 13 | @Test 14 | public void testWav() throws IOException, LineUnavailableException, UnsupportedAudioFileException { 15 | File file = getFile("test.wav"); 16 | 17 | WAV wav = new WAV(file); 18 | Assert.assertNotNull(wav); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/misc/model/MDXTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.misc.model; 2 | 3 | import net.moonlightflower.wc3libs.misc.model.MDX; 4 | import org.testng.Assert; 5 | import org.testng.annotations.Test; 6 | import wc3libs.misc.Wc3LibTest; 7 | 8 | import java.io.IOException; 9 | 10 | public class MDXTest extends Wc3LibTest { 11 | @Test() 12 | public void MDXTest() throws IOException { 13 | MDX mdx = new MDX(getFile("wc3data/Models/PackHorse.mdx")); 14 | 15 | Assert.assertTrue(mdx.getVersionChunk().isPresent()); 16 | System.out.println(mdx.getVersionChunk().get().getVersion()); 17 | } 18 | 19 | @Test() 20 | public void readWriteCycle() throws IOException { 21 | readWriteCycle(MDX.class, getFile("wc3data/Models/PackHorse.mdx")); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/port/GameExeFinderTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.port; 2 | 3 | import net.moonlightflower.wc3libs.port.GameExeFinder; 4 | import net.moonlightflower.wc3libs.port.NotFoundException; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | 8 | import javax.annotation.Nonnull; 9 | import java.io.File; 10 | 11 | public class GameExeFinderTest { 12 | public static class TestGameExeFinder extends GameExeFinder { 13 | @Nonnull 14 | @Override 15 | public File find() throws NotFoundException { 16 | return new File(""); 17 | } 18 | } 19 | 20 | @Test 21 | public void notAlreadyTriedTest() throws NotFoundException { 22 | Assert.assertEquals(new TestGameExeFinder().get(), new File("")); 23 | Assert.assertEquals(new TestGameExeFinder().get(), new File("")); 24 | Assert.assertEquals(new TestGameExeFinder().get(), new File("")); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/port/mac/MacGameVersionFinderTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.port.mac; 2 | 3 | import net.moonlightflower.wc3libs.port.GameVersion; 4 | import net.moonlightflower.wc3libs.port.mac.PListGameVersionParser; 5 | import org.testng.Assert; 6 | import org.testng.annotations.Test; 7 | import wc3libs.misc.Wc3LibTest; 8 | 9 | import java.io.File; 10 | 11 | public class MacGameVersionFinderTest extends Wc3LibTest { 12 | @Test 13 | public void test() throws Exception { 14 | PListGameVersionParser finder = new PListGameVersionParser(); 15 | 16 | GameVersion gameVersion = finder.get(getFile("wc3data/context/Info.plist")); 17 | 18 | Assert.assertEquals(gameVersion, new GameVersion("1.31.1.12164")); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/slk/AbilSLKTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.slk; 2 | 3 | import net.moonlightflower.wc3libs.slk.app.objs.AbilSLK; 4 | import org.testng.annotations.Test; 5 | 6 | import java.io.File; 7 | import java.io.IOException; 8 | import java.nio.file.Files; 9 | 10 | import static wc3libs.slk.SLKTest.assertLinesEqual; 11 | 12 | 13 | public class AbilSLKTest { 14 | 15 | @Test 16 | public void testRebuild() throws IOException { 17 | File orig = new File(getClass().getClassLoader().getResource("slks/AbilityData.slk").getFile()); 18 | AbilSLK abilSLK = new AbilSLK(orig); 19 | 20 | File rebuild = new File("out/slkdat/AbilityDataOut.slk"); 21 | rebuild.delete(); 22 | 23 | abilSLK.cleanEmptyColumns(); 24 | 25 | abilSLK.write(rebuild); 26 | 27 | assertLinesEqual(new String(Files.readAllBytes(rebuild.toPath())), new String(Files.readAllBytes(orig.toPath()))); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/slk/CleanSLKTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.slk; 2 | 3 | import net.moonlightflower.wc3libs.slk.app.objs.UnitWeaponsSLK; 4 | import org.testng.annotations.Test; 5 | 6 | import java.io.File; 7 | import java.io.IOException; 8 | import java.nio.file.Files; 9 | 10 | import static wc3libs.slk.SLKTest.assertLinesEqual; 11 | 12 | public class CleanSLKTest { 13 | 14 | @Test 15 | public void testCleanEmptyColumns() throws IOException { 16 | File orig = new File(getClass().getClassLoader().getResource("slks/reduce/UnitWeapons.slk").getFile()); 17 | File origR = new File(getClass().getClassLoader().getResource("slks/reduce/UnitWeaponsReduced.slk").getFile()); 18 | UnitWeaponsSLK unitWeaponsSLK = new UnitWeaponsSLK(orig); 19 | 20 | unitWeaponsSLK.cleanEmptyColumns(); 21 | 22 | File rebuild = new File("out/slkdat/UnitWeaponsReducedOut.slk"); 23 | rebuild.delete(); 24 | unitWeaponsSLK.write(rebuild); 25 | 26 | assertLinesEqual(new String(Files.readAllBytes(rebuild.toPath())), new String(Files.readAllBytes(origR.toPath()))); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/slk/DestructableSLKTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.slk; 2 | 3 | import net.moonlightflower.wc3libs.slk.app.objs.DestructableSLK; 4 | import org.testng.annotations.Test; 5 | 6 | import java.io.File; 7 | import java.io.IOException; 8 | import java.nio.file.Files; 9 | 10 | import static wc3libs.slk.SLKTest.assertLinesEqual; 11 | 12 | public class DestructableSLKTest { 13 | 14 | @Test 15 | public void testRebuild() throws IOException { 16 | File orig = new File(getClass().getClassLoader().getResource("slks/DestructableData.slk").getFile()); 17 | DestructableSLK destrSLK = new DestructableSLK(orig); 18 | 19 | File rebuild = new File("out/slkdat/DestructableDataOut.slk"); 20 | rebuild.delete(); 21 | destrSLK.write(rebuild); 22 | 23 | assertLinesEqual(new String(Files.readAllBytes(rebuild.toPath())), new String(Files.readAllBytes(orig.toPath()))); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/slk/DoodSLKTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.slk; 2 | 3 | import net.moonlightflower.wc3libs.slk.app.doodads.DoodSLK; 4 | import org.testng.annotations.Test; 5 | 6 | import java.io.File; 7 | import java.io.IOException; 8 | import java.nio.file.Files; 9 | 10 | import static wc3libs.slk.SLKTest.assertLinesEqual; 11 | 12 | public class DoodSLKTest { 13 | 14 | @Test 15 | public void testRebuild() throws IOException { 16 | File orig = new File(getClass().getClassLoader().getResource("slks/Doodads.slk").getFile()); 17 | DoodSLK doodSLK = new DoodSLK(orig); 18 | 19 | File rebuild = new File("out/slkdat/DoodadsOut.slk"); 20 | rebuild.delete(); 21 | doodSLK.write(rebuild); 22 | 23 | assertLinesEqual(new String(Files.readAllBytes(rebuild.toPath())), new String(Files.readAllBytes(orig.toPath()))); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/slk/ItemSLKTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.slk; 2 | 3 | import net.moonlightflower.wc3libs.slk.app.objs.ItemSLK; 4 | import org.testng.annotations.Test; 5 | 6 | import java.io.File; 7 | import java.io.IOException; 8 | import java.nio.file.Files; 9 | 10 | import static wc3libs.slk.SLKTest.assertLinesEqual; 11 | 12 | public class ItemSLKTest { 13 | 14 | @Test 15 | public void testRebuild() throws IOException { 16 | File orig = new File(getClass().getClassLoader().getResource("slks/ItemData.slk").getFile()); 17 | ItemSLK itemSLK = new ItemSLK(orig); 18 | 19 | itemSLK.cleanEmptyColumns(); 20 | 21 | File rebuild = new File("out/slkdat/ItemData.slk"); 22 | rebuild.delete(); 23 | itemSLK.write(rebuild); 24 | 25 | assertLinesEqual(new String(Files.readAllBytes(rebuild.toPath())), new String(Files.readAllBytes(orig.toPath()))); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/slk/UnitAbilitiesSLKTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.slk; 2 | 3 | import net.moonlightflower.wc3libs.slk.app.objs.UnitAbilsSLK; 4 | import org.testng.annotations.Test; 5 | 6 | import java.io.File; 7 | import java.io.IOException; 8 | import java.nio.file.Files; 9 | 10 | import static wc3libs.slk.SLKTest.assertLinesEqual; 11 | 12 | public class UnitAbilitiesSLKTest { 13 | 14 | @Test 15 | public void testRebuild() throws IOException { 16 | File orig = new File(getClass().getClassLoader().getResource("slks/UnitAbilities.slk").getFile()); 17 | UnitAbilsSLK unitAbilsSLK = new UnitAbilsSLK(orig); 18 | 19 | File rebuild = new File("out/slkdat/UnitAbilitiesOut.slk"); 20 | rebuild.delete(); 21 | unitAbilsSLK.write(rebuild); 22 | 23 | assertLinesEqual(new String(Files.readAllBytes(rebuild.toPath())), new String(Files.readAllBytes(orig.toPath()))); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/slk/UnitBalanceSLKTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.slk; 2 | 3 | import net.moonlightflower.wc3libs.slk.app.objs.UnitBalanceSLK; 4 | import org.testng.annotations.Test; 5 | 6 | import java.io.File; 7 | import java.io.IOException; 8 | import java.nio.file.Files; 9 | 10 | import static wc3libs.slk.SLKTest.assertLinesEqual; 11 | 12 | public class UnitBalanceSLKTest { 13 | 14 | @Test 15 | public void testRebuild() throws IOException { 16 | File orig = new File(getClass().getClassLoader().getResource("slks/UnitBalance.slk").getFile()); 17 | UnitBalanceSLK itemSLK = new UnitBalanceSLK(orig); 18 | 19 | File rebuild = new File("out/slkdat/UnitBalanceOut.slk"); 20 | rebuild.delete(); 21 | itemSLK.write(rebuild); 22 | 23 | assertLinesEqual(new String(Files.readAllBytes(rebuild.toPath())), new String(Files.readAllBytes(orig.toPath()))); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/slk/UnitUISLKTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.slk; 2 | 3 | import net.moonlightflower.wc3libs.slk.app.objs.UnitUISLK; 4 | import org.testng.annotations.Test; 5 | 6 | import java.io.File; 7 | import java.io.IOException; 8 | import java.nio.file.Files; 9 | 10 | import static wc3libs.slk.SLKTest.assertLinesEqual; 11 | 12 | public class UnitUISLKTest { 13 | 14 | @Test 15 | public void testRebuild() throws IOException { 16 | File orig = new File(getClass().getClassLoader().getResource("slks/UnitUI.slk").getFile()); 17 | UnitUISLK itemSLK = new UnitUISLK(orig); 18 | 19 | File rebuild = new File("out/slkdat/UnitUIOut.slk"); 20 | rebuild.delete(); 21 | itemSLK.write(rebuild); 22 | 23 | assertLinesEqual(new String(Files.readAllBytes(rebuild.toPath())), new String(Files.readAllBytes(orig.toPath()))); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /src/test/java/wc3libs/slk/UnitWeaponsSLKTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.slk; 2 | 3 | import net.moonlightflower.wc3libs.slk.app.objs.UnitWeaponsSLK; 4 | import org.testng.annotations.Test; 5 | 6 | import java.io.File; 7 | import java.io.IOException; 8 | import java.nio.file.Files; 9 | 10 | import static wc3libs.slk.SLKTest.assertLinesEqual; 11 | 12 | public class UnitWeaponsSLKTest { 13 | 14 | @Test 15 | public void testRebuild() throws IOException { 16 | File orig = new File(getClass().getClassLoader().getResource("slks/UnitWeapons.slk").getFile()); 17 | UnitWeaponsSLK unitWeaponsSLK = new UnitWeaponsSLK(orig); 18 | 19 | 20 | File rebuild = new File("out/slkdat/UnitWeaponsOut.slk"); 21 | rebuild.delete(); 22 | unitWeaponsSLK.write(rebuild); 23 | 24 | assertLinesEqual(new String(Files.readAllBytes(rebuild.toPath())), new String(Files.readAllBytes(orig.toPath()))); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/txt/FDFTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.txt; 2 | 3 | import net.moonlightflower.wc3libs.txt.FDF; 4 | import net.moonlightflower.wc3libs.txt.TXT; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.testng.annotations.Test; 8 | import wc3libs.misc.Wc3LibTest; 9 | 10 | import java.io.File; 11 | import java.io.IOException; 12 | 13 | import static org.testng.Assert.assertEquals; 14 | 15 | 16 | public class FDFTest extends Wc3LibTest { 17 | private static final Logger log = LoggerFactory.getLogger(FDFTest.class.getName()); 18 | 19 | @Test 20 | public void testRebuild() throws Exception { 21 | File file = getFile("fdfs/GlobalStrings.fdf"); 22 | 23 | try { 24 | FDF fdf = new FDF(file); 25 | 26 | File rebuild = new File("out/txtdat/" + file.getName()); 27 | rebuild.delete(); 28 | 29 | TXT txt = fdf.toTXT(); 30 | txt.write(rebuild); 31 | 32 | TXT.Section defaultSection = txt.getDefaultSection(); 33 | TXT.Section.Field firstField = defaultSection.getFields().values().iterator().next(); 34 | assertEquals(firstField.getVals().get(0).toString(), "Accept" ); 35 | } catch (IOException e) { 36 | log.error(e.getMessage(), e); 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/txt/PLDTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.txt; 2 | 3 | import net.moonlightflower.wc3libs.antlr.JassParser; 4 | import net.moonlightflower.wc3libs.txt.PLD; 5 | import net.moonlightflower.wc3libs.txt.app.jass.FuncImpl; 6 | import org.antlr.v4.runtime.CharStreams; 7 | import org.antlr.v4.runtime.misc.Interval; 8 | import org.testng.annotations.Test; 9 | 10 | public class PLDTest { 11 | @Test() 12 | public void test() { 13 | PLD pld = new PLD(); 14 | 15 | pld.addPreload("A"); 16 | pld.addPreload("B.mdx"); 17 | pld.addPreload("C\\D.blp"); 18 | 19 | FuncImpl funcImpl = pld.toJassFunc(); 20 | 21 | //System.out.println(CharStreams.fromString(funcImpl.getStart().getInputStream().getText(new Interval(func.start.getStartIndex(), func.stop.getStopIndex())))); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/wc3libs/txt/SLKTest.java: -------------------------------------------------------------------------------- 1 | package wc3libs.txt; 2 | 3 | import net.moonlightflower.wc3libs.slk.RawSLK; 4 | import net.moonlightflower.wc3libs.slk.SLK; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.testng.annotations.Test; 8 | import wc3libs.misc.Wc3LibTest; 9 | 10 | import java.io.IOException; 11 | import java.nio.file.Path; 12 | import java.util.List; 13 | 14 | public class SLKTest extends Wc3LibTest { 15 | private static final Logger log = LoggerFactory.getLogger(SLKTest.class.getName()); 16 | @Test() 17 | public void test() throws IOException { 18 | List files = getFiles("slks/"); 19 | 20 | files.forEach(path -> { 21 | if (!path.getFileName().toString().startsWith("AbilityBuffMeta")) return; 22 | 23 | try { 24 | SLK slk = new RawSLK(path.toFile()); 25 | } catch (IOException e) { 26 | log.error(path.toString() + ":"); 27 | 28 | log.error(e.getMessage(), e); 29 | } 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/resources/images/test.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/images/test.blp -------------------------------------------------------------------------------- /src/test/resources/images/test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/images/test.jpg -------------------------------------------------------------------------------- /src/test/resources/images/test.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/images/test.tga -------------------------------------------------------------------------------- /src/test/resources/in.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/in.w3x -------------------------------------------------------------------------------- /src/test/resources/jass/compiled.j: -------------------------------------------------------------------------------- 1 | globals 2 | endglobals 3 | 4 | function abc takes nothing returns nothing 5 | 6 | local integer a = 100 7 | local integer b = 07 8 | local integer c = 0x4 9 | local integer d = 'dddd' 10 | endfunction 11 | 12 | -------------------------------------------------------------------------------- /src/test/resources/jass/compiled3.j: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/jass/compiled3.j -------------------------------------------------------------------------------- /src/test/resources/jass/compiled4.j: -------------------------------------------------------------------------------- 1 | "ab\"c" -------------------------------------------------------------------------------- /src/test/resources/pefile/dotnet-pe-version.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/pefile/dotnet-pe-version.dll -------------------------------------------------------------------------------- /src/test/resources/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/test.wav -------------------------------------------------------------------------------- /src/test/resources/txts/MiscData.txt: -------------------------------------------------------------------------------- 1 | [Misc] 2 | CloseEnoughRange=100 3 | BuildingUnblightRadius=350 4 | BuildingPlacementNotifyRadius=600 5 | NeutralUseNotifyRadius=900 6 | BuildingAngle=270 7 | RootAngle=250 8 | AttackHalfAngle=0.5 9 | FoggedAttackRevealRadius=200.0 10 | DyingRevealRadius=500.0 11 | BoneDecayTime=88 12 | StructureDecayTime=30 13 | DecayTime=2 14 | DissipateTime=3 15 | CancelTime=6 16 | BulletDeathTime=5 17 | EffectDeathTime=5 18 | FogFlashTime=3 19 | CreepCampPathingCellDistance=26 20 | FollowRange=300 21 | StructureFollowRange=100 22 | FollowItemRange=1000 23 | SpellCastRangeBuffer=300 24 | MaxCollisionRadius=200 25 | RallyZOffset=200 26 | ScaledAnimTime=60 27 | ReactionDelay=0.25 28 | ChanceToMiss=0.25 29 | DayLength=480 30 | Dawn=6 31 | Dusk=18 32 | DayHours=24 33 | GoldMineMaxGold=1000000 34 | LowGoldAmount=1500 35 | GoldMineOwnDuration=2.0 36 | InvisSpeed=0.4 37 | SelectionCircleBaseZ=16 38 | ItemShadowFile=Shadow 39 | ItemShadowSize=120,120 40 | ItemShadowOffset=50,50 41 | AttackNotifyDelay=30.0 42 | AttackNotifyRange=1250 43 | TradingIncSmall=100 44 | TradingIncLarge=200 45 | MissDamageReduction=0.5 -------------------------------------------------------------------------------- /src/test/resources/txts/UnitStrings.txt: -------------------------------------------------------------------------------- 1 | [ANsl] 2 | art=ReplaceableTextures\CommandButtons\BTNSleep.blp 3 | researchart=ReplaceableTextures\CommandButtons\BTNSleep.blp 4 | buttonpos=3,2 5 | researchbuttonpos=3,0 6 | order=soulpreservation 7 | name=Soul Preservation 8 | tip=Sou|cffffcc00l|r Preservation 9 | ubertip=Puts a converted zombie into the nether-realm for later use. 10 | hotkey=L 11 | researchtip=Learn Sou|cffffcc00l|r Preservation 12 | researchubertip=Puts a converted zombie into the nether-realm for later use. 13 | researchhotkey=L 14 | editorsuffix= (Malganis) 15 | [BNsl] 16 | buffart=ReplaceableTextures\CommandButtons\BTNSleep.blp 17 | effectsound=SoulPreservation 18 | editorname=Soul Preservation -------------------------------------------------------------------------------- /src/test/resources/wc3data/DOO/war3map.doo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/DOO/war3map.doo -------------------------------------------------------------------------------- /src/test/resources/wc3data/DOO/war3map_with_skin.doo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/DOO/war3map_with_skin.doo -------------------------------------------------------------------------------- /src/test/resources/wc3data/DOO_UNITS/war3mapUnits.doo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/DOO_UNITS/war3mapUnits.doo -------------------------------------------------------------------------------- /src/test/resources/wc3data/Infos/war3map.w3i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/Infos/war3map.w3i -------------------------------------------------------------------------------- /src/test/resources/wc3data/Infos/war3map2.w3i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/Infos/war3map2.w3i -------------------------------------------------------------------------------- /src/test/resources/wc3data/Infos/war3map3.w3i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/Infos/war3map3.w3i -------------------------------------------------------------------------------- /src/test/resources/wc3data/Infos/war3map31_HD.w3i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/Infos/war3map31_HD.w3i -------------------------------------------------------------------------------- /src/test/resources/wc3data/Infos/war3map31_HD2.w3i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/Infos/war3map31_HD2.w3i -------------------------------------------------------------------------------- /src/test/resources/wc3data/Infos/war3map31_SD.w3i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/Infos/war3map31_SD.w3i -------------------------------------------------------------------------------- /src/test/resources/wc3data/Infos/war3map31_SD_HD.w3i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/Infos/war3map31_SD_HD.w3i -------------------------------------------------------------------------------- /src/test/resources/wc3data/Infos/war3map31_SD_Jass.w3i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/Infos/war3map31_SD_Jass.w3i -------------------------------------------------------------------------------- /src/test/resources/wc3data/Infos/war3map31_SD_Lua.w3i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/Infos/war3map31_SD_Lua.w3i -------------------------------------------------------------------------------- /src/test/resources/wc3data/Infos/war3map_1F.w3i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/Infos/war3map_1F.w3i -------------------------------------------------------------------------------- /src/test/resources/wc3data/Infos/war3map_ga.w3i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/Infos/war3map_ga.w3i -------------------------------------------------------------------------------- /src/test/resources/wc3data/MMP/war3map.mmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/MMP/war3map.mmp -------------------------------------------------------------------------------- /src/test/resources/wc3data/Map/Forest_Defense_0.18w.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/Map/Forest_Defense_0.18w.w3x -------------------------------------------------------------------------------- /src/test/resources/wc3data/Map/Forest_Defense_0.18w_sign.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/Map/Forest_Defense_0.18w_sign.w3x -------------------------------------------------------------------------------- /src/test/resources/wc3data/Models/PackHorse.mdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/Models/PackHorse.mdx -------------------------------------------------------------------------------- /src/test/resources/wc3data/SHD/war3map.shd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/SHD/war3map.shd -------------------------------------------------------------------------------- /src/test/resources/wc3data/Units/NeutralUpgradeFunc.txt: -------------------------------------------------------------------------------- 1 | // Non-race-specific upgrades 2 | // glyph of fortification 3 | [Rgfo] 4 | Art=ReplaceableTextures\CommandButtons\BTNGlyph.blp,ReplaceableTextures\CommandButtons\BTNGlyph.blp,ReplaceableTextures\CommandButtons\BTNGlyph.blp 5 | 6 | // glyph of ultravision 7 | [Rguv] 8 | Art=ReplaceableTextures\CommandButtons\BTNGlyph.blp -------------------------------------------------------------------------------- /src/test/resources/wc3data/W3A/threeLetterId.w3a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/W3A/threeLetterId.w3a -------------------------------------------------------------------------------- /src/test/resources/wc3data/W3A/war3map.w3a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/W3A/war3map.w3a -------------------------------------------------------------------------------- /src/test/resources/wc3data/W3A/war3map_format3.w3a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/W3A/war3map_format3.w3a -------------------------------------------------------------------------------- /src/test/resources/wc3data/W3B/war3map.w3b: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /src/test/resources/wc3data/W3C/war3map.w3c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/W3C/war3map.w3c -------------------------------------------------------------------------------- /src/test/resources/wc3data/W3D/war3map.w3d: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /src/test/resources/wc3data/W3E/war3map.w3e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/W3E/war3map.w3e -------------------------------------------------------------------------------- /src/test/resources/wc3data/W3H/war3map.w3h: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /src/test/resources/wc3data/W3I/war3map.w3i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/W3I/war3map.w3i -------------------------------------------------------------------------------- /src/test/resources/wc3data/W3Q/war3map.w3q: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /src/test/resources/wc3data/W3R/war3map.w3r: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/W3R/war3map.w3r -------------------------------------------------------------------------------- /src/test/resources/wc3data/W3S/war3map.w3s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/W3S/war3map.w3s -------------------------------------------------------------------------------- /src/test/resources/wc3data/W3T/war3map.w3t: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /src/test/resources/wc3data/W3U/war3map.w3u: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /src/test/resources/wc3data/W3U/war3mapBorked.w3u: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/W3U/war3mapBorked.w3u -------------------------------------------------------------------------------- /src/test/resources/wc3data/W3U/war3mapReforged.w3u: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/W3U/war3mapReforged.w3u -------------------------------------------------------------------------------- /src/test/resources/wc3data/WCT/war3map.wct: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/WCT/war3map.wct -------------------------------------------------------------------------------- /src/test/resources/wc3data/WPM/war3map.wpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inwc3/wc3libs/701ba80e0d5e10eef6230cf98eba2f4e8c66f40b/src/test/resources/wc3data/WPM/war3map.wpm -------------------------------------------------------------------------------- /src/test/resources/wc3data/WTS/war3map.wts: -------------------------------------------------------------------------------- 1 | STRING 1 2 | { 3 | Player 1 4 | } 5 | 6 | STRING 2 7 | { 8 | Force 1 9 | } 10 | 11 | STRING 9 12 | // Abilities: A001 (BlubLol), Name (Name (anam)) 13 | { 14 | BlubLol 15 | } 16 | 17 | STRING 10 18 | // Abilities: A000 (RoflKopter), Name (Name (anam)) 19 | { 20 | RoflKopter 21 | } 22 | 23 | STRING 14 24 | // Abilities: A001 (BlubLol), Researchtip (Tooltip - Learn (aret)) 25 | { 26 | hi there 27 | Blub {"Hi" '|cff800080Das|r ist ein Test' 28 | next line 29 | // this is a comment 30 | and so on 31 | } 32 | } 33 | still in? 34 | } 35 | 36 | STRING 11 37 | // Abilities: A000 (RoflKopter), Name (Name (anam)) 38 | { 39 | xaxaxaxaxaxa 40 | } 41 | 42 | STRING 2224 43 | { 44 | https://test.com 45 | } 46 | 47 | STRING 2228 48 | // real comment 49 | { 50 | empty 51 | } 52 | 53 | STRING 4322 54 | { 55 | Some 56 | implicit 57 | newline 58 | string 59 | } 60 | -------------------------------------------------------------------------------- /src/test/resources/wc3data/war3map.imp: -------------------------------------------------------------------------------- 1 |  BubbleMissile.mdx CorpseBomb.mdx dummy.mdx StonePedestal.mdx UI\Glues\Loading\Backgrounds\Campaigns\Ashenvale-TopLeft.blp war3mapImported\Elveswood1.mdx war3mapImported\Elveswood2.mdx war3mapImported\GeneralHeroGlow.mdx war3mapImported\grass.mdx war3mapImported\HalfArchway.mdx war3mapImported\peasantfatcomp.mdx war3mapImported\peasantfatcomp_Portrait.mdx war3mapPreview.tga -------------------------------------------------------------------------------- /wc3libs_doc/src/specs/bin/SHD: -------------------------------------------------------------------------------- 1 | byte[mapWidth*mapHeight*16]: shadowFlag 2 | 0x0: no shadow 3 | 0xff: shadow -------------------------------------------------------------------------------- /wc3libs_doc/src/specs/bin/W3E: -------------------------------------------------------------------------------- 1 | //0xB 2 | Id: startToken (W3E!) 3 | int: version 4 | char: mainTileset 5 | A: ashenvale 6 | B: barrens 7 | C: felwood 8 | D: dungeon 9 | F: lordaeronFall 10 | G: underground 11 | L: lordaeronSummer 12 | N: northrend 13 | Q: villageFall 14 | V: village 15 | W: lordaeronWinter 16 | X: dalaran 17 | Y: cityscape 18 | Z: sunkenRuins 19 | I: icecrown 20 | J: dalaranRuins 21 | O: outland 22 | k: blackCitadel 23 | int: customTilesetFlag (1: enabled) 24 | int: groundTilesUsedCount 25 | Id[groundTilesUsedCount]: groundTiles 26 | int: cliffTilesUsedCount 27 | Id[cliffTilesUsedCount]: cliffTiles 28 | int: width + 1 29 | int: height + 1 30 | float: centerX 31 | float: centerY 32 | 33 | tiles[(width + 1) * (height + 1)]: 34 | short: groundHeight 35 | 0xC000: minHeight (-16384) 36 | 0x2000: normalHeight (0) 37 | 0x3fff: maxHeight (+16383) 38 | short: waterLevel, mapEdgeBoundaryFlag 39 | & 0x8000: boundary enabled 40 | bit[4]: flags 41 | 0x4000: boundaryFlag 42 | 0x10: rampFlag 43 | 0x20: blightFlag 44 | 0x40: waterFlag 45 | 0x80: boundaryFlag2 46 | bit[4]: texType 47 | byte: texDetails 48 | bit[4]: cliffTexType 49 | bit[4]: layerHeight -------------------------------------------------------------------------------- /wc3libs_doc/src/specs/bin/WPM: -------------------------------------------------------------------------------- 1 | //0x0 2 | Id: startToken (MP3W) 3 | int: version (0) 4 | int: width (mapWidth*4) 5 | int: height (mapHeight*4) 6 | 7 | tiles[width*height]: 8 | byte: flags 9 | 0x1: unused 10 | 0x2: walkFlag (1=disabled) 11 | 0x4: flyFlag (1=disabled) 12 | 0x8: buildFlag (1=disabled) 13 | 0x10: unused 14 | 0x20: blightFlag (1=enabled) 15 | 0x40: waterFlag (1=disabled) 16 | 0x80: unknownFlag (1=enabled) -------------------------------------------------------------------------------- /wc3libs_doc/src/specs/bin/links: -------------------------------------------------------------------------------- 1 | http://www.wc3c.net/tools/specs/index.html -------------------------------------------------------------------------------- /wc3libs_doc/src/specs/bin/mapFooter: -------------------------------------------------------------------------------- 1 | Id: startToken (NGIS) 2 | byte[256]: data -------------------------------------------------------------------------------- /wc3libs_doc/src/specs/bin/mapHeader: -------------------------------------------------------------------------------- 1 | Id: startToken (HM3W) 2 | int: unknown 3 | string: mapName 4 | int: mapFlags 5 | 0x1: hideMinimapInPreviewScreens 6 | 0x2: modifyAllyPriorities 7 | 0x4: meleeMap 8 | 0x8: playableMapSizeWasLargeAndHasNeverBeenReducedToMedium 9 | 0x10: maskedAreaArePartiallyVisible 10 | 0x20: fixedPlayerSettingForCustomForces 11 | 0x40: useCustomForces 12 | 0x80: useCustomTechtree 13 | 0x100: useCustomAbilities 14 | 0x200: useCustomUpgrades 15 | 0x400: mapPropertiesMenuOpenedAtLeastOnceSinceMapCreation 16 | 0x800: showWaterWavesOnCliffShores 17 | 0x1000: showWaterWavesOnRollingShores 18 | int: maxPlayersCount 19 | byte[x]: padding (filled with 0 until header spans 512 bytes) --------------------------------------------------------------------------------