foundryvtt-wh4-lang-fr-fr/tools/foundry_wh4_detect_effects.lua

42 lines
1.0 KiB
Lua
Raw Permalink Normal View History

2021-11-26 12:54:58 +01:00
package.path = package.path .. ";luajson/?.lua"
local JSON = require"json"
--local talent_db = "../../WFRP4e-FoundryVTT/packs/talents.db"
2022-06-24 00:02:52 +02:00
local traitdb ='/home/morr/.local/share/FoundryVTT/Data/modules/wfrp4e-core/packs/talents.db'
2021-11-26 12:54:58 +01:00
local f1 = io.open(traitdb)
2022-06-24 00:02:52 +02:00
local translatedf = "../compendium/wfrp4e-core.talents.json"
local f2 = io.open(translatedf)
local content = f2:read("*a")
local dbData = JSON.decode(content)
f2:close()
2021-11-26 12:54:58 +01:00
local function trim1(s)
return (s:gsub("^%s*(.-)%s*$", "%1"))
end
local line = f1:read()
while line do
--print(line)
local trait = JSON.decode( line )
2022-06-24 00:02:52 +02:00
if trait.effects then
local comp
for _, item in pairs(dbData.entries) do
if string.lower(item.id) == string.lower(trait.name)then
comp = item
print("====================> Found", trait.name, item.name)
2021-11-26 12:54:58 +01:00
end
end
2022-06-24 00:02:52 +02:00
if #comp.effects == 0 and #trait.effects > 0 then
print( "MISSING EFFECTS", trait.name )
--print( JSON.encode (trait.effects) )
--print ()
end
2021-11-26 12:54:58 +01:00
end
line = f1:read()
end
f1:close()