Generate map scripts and MPQ archives from C#/vJass source code.
$ dotnet add package War3Net.BuildWar3Net.Build is a library for generating complete Warcraft III map scripts (JASS) from map data and compiling C# source code to Lua for use in Warcraft III maps. It is part of the War3Net modding library.
Map objectsusing War3Net.Build;
// Load or create your map
var map = Map.Open("path/to/map.w3x");
// Create the script builder and configure it
var scriptBuilder = new MapScriptBuilder();
scriptBuilder.SetDefaultOptionsForMap(map);
// Generate the JASS script
string jassScript = scriptBuilder.Build(map);
using War3Net.Build;
var map = Map.Open("path/to/map.w3x");
var scriptBuilder = new MapScriptBuilder();
scriptBuilder.SetDefaultOptionsForCSharpLua(lobbyMusic: "Sound\\Music\\mp3Music\\War3IntroX.mp3");
string jassScript = scriptBuilder.Build(map);
using System.IO;
using War3Net.Build;
using War3Net.Build.Script;
using War3Net.CodeAnalysis;
var writer = new IndentedTextWriter(new StringWriter());
var triggerData = TriggerData.Default;
var variables = map.Triggers.Variables;
var renderer = new TriggerRenderer(writer, triggerData, variables);
renderer.RenderTrigger(triggerDefinition);
The main types provided by this library are:
War3Net.Build.MapScriptBuilder - Generates complete JASS map scripts from Map objects with customizable outputWar3Net.Build.TriggerRenderer - Renders individual trigger definitions into JASS codeWar3Net.Build.TriggerRendererContext - Context for trigger rendering operationsWar3Net.Build.TrigFunctionIdentifierBuilder - Helper for building unique trigger function identifiersWar3Net.Build.BuildResult - Result of a build operation with success status and diagnosticsWar3Net.Build.CompileResult - Result of a compilation operationWar3Net.Build is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
This README was generated with the assistance of AI and may contain inaccuracies. Please verify the information and consult the source code for authoritative details.