项目作者: ChiefOfGxBxL

项目描述 :
Translate war3map ⇄ json formats for WarCraft III .w3x maps
高级语言: Objective-J
项目地址: git://github.com/ChiefOfGxBxL/WC3MapTranslator.git
创建时间: 2017-04-21T22:15:02Z
项目社区:https://github.com/ChiefOfGxBxL/WC3MapTranslator

开源协议:MIT License

下载



WC3MapTranslator

Translate war3mapjson formats for WarCraft III .w3x maps














Quality
















Known Vulnerabilities




Overview ·
Install ·
Usage ·
File Support ·
Specification ·
Contributing ·
Special Thanks


Overview

WC3MapTranslator is a TypeScript module to convert between JSON and WarCraft III (.w3x) war3map formats. This makes the map data readable and easily modifiable, a perfect format for storing WC3 maps in Git repositories and inspecting diffs!

TranslationExample

Install

  1. npm install wc3maptranslator

Requires Node ≥ 14

Usage

  1. import {
  2. CamerasTranslator,
  3. DoodadsTranslator,
  4. ImportsTranslator,
  5. InfoTranslator,
  6. ObjectsTranslator,
  7. RegionsTranslator,
  8. SoundsTranslator,
  9. StringsTranslator,
  10. TerrainTranslator,
  11. UnitsTranslator
  12. } from 'wc3maptranslator';
  13. // E.g. let's create a camera for the map
  14. const cameras = [
  15. {
  16. "target": {
  17. "x": -319.01,
  18. "y": -90.18
  19. },
  20. "offsetZ": 0,
  21. "rotation": 90,
  22. "aoa": 304,
  23. "distance": 2657.34,
  24. "roll": 5,
  25. "fov": 70,
  26. "farClipping": 5000,
  27. "name": "MyCamera1"
  28. }
  29. ]
  30. // Now translate the JSON into the WarCraft III format
  31. // All translators have: `.jsonToWar` and `.warToJson` functions
  32. const translatedResult = CamerasTranslator.jsonToWar(cameras);
  33. // `translatedResult` contains a `buffer` which can be saved to disk
  34. // This war3map.w3c file can now be placed inside a .w3x via an MPQ
  35. // editor, and you should now see a camera in the Camera Palette!
  36. fs.writeFileSync('war3map.w3c', translatedResult.buffer);

File Support

World files

Type Json → War War → Json File
Terrain check times war3map.w3e
Units check check war3mapUnits.doo
Doodads check check war3map.doo
Regions check check war3map.w3r
Cameras check check war3map.w3c
Sounds (definitions) check check war3map.w3s

Object data files

Type Json → War War → Json File
Units - Objects check check war3map.w3u
Items - Objects check check war3map.w3t
Abilities - Objects check check war3map.w3a
Destructables - Objects check check war3map.w3b
Doodads - Objects check check war3map.w3d
Upgrades - Objects check check war3map.w3q
Buffs - Objects check check war3map.w3h

Trigger files

Type Json → War War → Json File
LUA times times war3map.lua
JASS times times war3map.j
Strings check check war3map.wts

Map files

Type Json → War War → Json File
Info File check check war3map.w3i
Imported Files check check war3map.imp
Pathing times times war3map.wpm
Shadow map times times war3map.shd

Not relevant

minus-solid Custom Text Trigger File (war3map.wct)
minus-solid Trigger Names File (war3map.wtg)
minus-solid Menu Minimap (war3map.mmp)
minus-solid Minimap Image (war3mapMap.blp)
minus-solid Minimap Image (war3mapMap.b00
minus-solid Minimap Image (war3mapMap.tga)
minus-solid Map Preview Image (war3mapPreview.tga)

Specification

WC3MapTranslator format

We have a detailed explaining how to format a map in JSON. It explains everything from the high-level map object, all the way down to creating individual units, tiles, or custom objects.

🔗 WC3MapTranslator format

war3map format

The underlying WarCraft map files (e.g. war3map.doo) have been documented in a separate repository. If you are curious about how a .w3x file is composed, this is the place to learn!

🔗 WC3MapSpecification

Contributing

We encourage contributions! Generally, the process of making a change is:

  1. Fork this repo
  2. Develop your changes on a new branch
  3. Submit a pull request to dev

Your code should:

  • run (your code needs to work, of course)
  • include tests (write unit tests to demonstrate your code works under different conditions)
  • be linted (run npm run lint and follow the project’s coding standards)
  • pass CI (we enforce: ESLint, unit tests pass, code coverage)

A code review is required on your PR to be accepted into dev. A project member will get back to you within one week. If you haven’t heard from someone regarding your PR, feel free to ping @chiefofgxbxl.

Special Thanks

We owe a lot of thanks to Chocobo on TheHelper for the detailed documentation of the files found in a .w3x archive. Two tutorials are here (1) and here (2).