Fix maladies effects

This commit is contained in:
2022-06-24 00:02:52 +02:00
parent 39f476cf82
commit e69a9d8ce1
5 changed files with 1527 additions and 137 deletions

View File

@ -3,9 +3,15 @@ package.path = package.path .. ";luajson/?.lua"
local JSON = require"json"
--local talent_db = "../../WFRP4e-FoundryVTT/packs/talents.db"
local traitdb ='/home/morr/.local/share/FoundryVTT/Data/modules/wfrp4e-core/packs/traits.db'
local traitdb ='/home/morr/.local/share/FoundryVTT/Data/modules/wfrp4e-core/packs/talents.db'
local f1 = io.open(traitdb)
local translatedf = "../compendium/wfrp4e-core.talents.json"
local f2 = io.open(translatedf)
local content = f2:read("*a")
local dbData = JSON.decode(content)
f2:close()
local function trim1(s)
return (s:gsub("^%s*(.-)%s*$", "%1"))
end
@ -14,15 +20,19 @@ local line = f1:read()
while line do
--print(line)
local trait = JSON.decode( line )
if trait.effects then
for _, effect in pairs(trait.effects) do
if effect.flags and effect.flags.wfrp4e and effect.flags.wfrp4e.script then
print( trait.name )
print( JSON.encode (trait.effects) )
print ()
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)
end
end
if #comp.effects == 0 and #trait.effects > 0 then
print( "MISSING EFFECTS", trait.name )
--print( JSON.encode (trait.effects) )
--print ()
end
end
line = f1:read()