Skip to content

Commit

Permalink
Tools: Add a script to export fog parameters as JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
rdw-software committed Jan 31, 2024
1 parent 56d2f01 commit 3486b9e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Tools/export-fog-parameters.lua
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)

0 comments on commit 3486b9e

Please sign in to comment.