Traduction des effets

This commit is contained in:
2021-02-12 15:21:58 +01:00
parent 533ecafdc8
commit b03b357c23
11 changed files with 12515 additions and 26006 deletions

View File

@ -0,0 +1,44 @@
package.path = package.path .. ";luajson/?.lua"
local JSON = require"json"
--local talent_db = "../../WFRP4e-FoundryVTT/packs/talents.db"
local dbfile ='/home/morr/.local/share/FoundryVTT/Data/modules/wfrp4e-core/packs/spells.db'
local jsonfile = "../compendium/wfrp4e-core.spells.json"
local dbf = io.open(dbfile)
local jsonf = io.open(jsonfile)
local strjson = jsonf:read("*a")
jsonf:close()
local datajson = JSON.decode(strjson)
local function trim1(s)
return (s:gsub("^%s*(.-)%s*$", "%1"))
end
local line = dbf:read()
while line do
--print(line)
local itemdb = JSON.decode( line )
--print("Testing : ", db_talent.name )
for _, data in pairs(datajson.entries) do
if data.id == itemdb.name then
data.effects = itemdb.effects
for _, effect in pairs(data.effects) do
if effect.label == itemdb.name then
effect.label = data.name
end
end
end
end
line = dbf:read()
end
dbf:close()
local jsonout = JSON.encode( datajson )
local fout = io.open("witheffects.json", "w+")
fout:write( jsonout )
fout:close()