forked from public/foundryvtt-wh4-lang-fr-fr
Fix Talent, prayer and db
This commit is contained in:
37
tools/foundry_wh4_fill_talents.lua
Normal file
37
tools/foundry_wh4_fill_talents.lua
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
package.path = package.path .. ";luajson/?.lua"
|
||||
local JSON = require"json"
|
||||
|
||||
local talent_db = "../../WFRP-4th-Edition-FoundryVTT/packs/talents.db"
|
||||
local talent = "../compendium/wfrp4e.talents.json"
|
||||
|
||||
local f1 = io.open(talent_db)
|
||||
|
||||
local f2 = io.open(talent)
|
||||
local strjson = f2:read("*a")
|
||||
f2:close()
|
||||
local talents = JSON.decode(strjson)
|
||||
|
||||
local function trim1(s)
|
||||
return (s:gsub("^%s*(.-)%s*$", "%1"))
|
||||
end
|
||||
|
||||
local line = f1:read()
|
||||
while line do
|
||||
--print(line)
|
||||
local db_talent = JSON.decode( line)
|
||||
|
||||
for _, mytalent in pairs(talents.entries) do
|
||||
if mytalent.id == db_talent.name then
|
||||
mytalent.tests = db_talent.data.tests.value
|
||||
end
|
||||
end
|
||||
|
||||
line = f1:read()
|
||||
end
|
||||
f1:close()
|
||||
|
||||
local jsonout = JSON.encode( talents )
|
||||
local fout = io.open("talents.json", "w+")
|
||||
fout:write( jsonout )
|
||||
fout:close()
|
1
tools/talents.json
Normal file
1
tools/talents.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user