-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tools: Add a script to export fog parameters as JSON
- Loading branch information
1 parent
56d2f01
commit 3486b9e
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
local RagnarokGRF = require("Core.FileFormats.RagnarokGRF") | ||
local FogParameters = require("Core.FileFormats.FogParameters") | ||
|
||
local json = require("json") | ||
|
||
local inputFilePath = "data/fogparametertable.txt" | ||
printf("Exporting fog parameters: %s", inputFilePath) | ||
|
||
local grfPath = "data.grf" | ||
local grf = RagnarokGRF() | ||
grf:Open(grfPath) | ||
|
||
local inputFileContents = grf:ExtractFileInMemory(inputFilePath) | ||
|
||
grf:Close() | ||
|
||
local fogParametersTable = FogParameters:DecodeFileContents(inputFileContents) | ||
|
||
local outputFilePath = path.join("Exports", "fog-parameters.json") | ||
local jsonFileContents = json.prettier(fogParametersTable) | ||
printf("Saving fog parameters for %s maps: %s", table.count(fogParametersTable), outputFilePath) | ||
C_FileSystem.WriteFile(outputFilePath, jsonFileContents) |