forked from public/foundryvtt-wh4-lang-fr-fr
Auto-patch careers + tables
This commit is contained in:
2493
tools/careerv10.json
Normal file
2493
tools/careerv10.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,22 +2,42 @@ package.path = package.path .. ";luajson/?.lua"
|
||||
local JSON = require"json"
|
||||
|
||||
--local enjsonf = "/home/morr/foundry/foundrydata-dev/Data/modules/wfrp4e-dotr/lang/en.json"
|
||||
local careerv9 = "../compendium/wfrp4e-core.career-descriptions.json"
|
||||
local careerv10 = "../compendium/v10_entries.json"
|
||||
local careerv10 = "careerv10.json"
|
||||
local goodC = "../compendium/wfrp4e-core.careers.json"
|
||||
|
||||
local fp = io.open(careerv9, "r")
|
||||
local c9 = JSON.decode( fp:read("*a") )
|
||||
local fp = io.open(careerv10, "r")
|
||||
local c10 = JSON.decode( fp:read("*a") )
|
||||
fp:close()
|
||||
|
||||
local c10 = {}
|
||||
for k, v in pairs( c9.entries) do
|
||||
c10[v.id] = {
|
||||
name = v.name,
|
||||
text = v.description
|
||||
}
|
||||
local fp = io.open(goodC, "r")
|
||||
local good10 = JSON.decode( fp:read("*a") )
|
||||
fp:close()
|
||||
|
||||
|
||||
for k1, v1 in pairs( good10.entries) do
|
||||
for k2, v2 in pairs(c10.entries) do
|
||||
if v1.id == v2.id then
|
||||
local careerGroup = string.match(v2.description, "{([%w%s]*)}")
|
||||
local careerFR
|
||||
for k3, v3 in pairs( good10.entries) do
|
||||
if v3.id == careerGroup then
|
||||
careerFR = v3.name
|
||||
end
|
||||
end
|
||||
if ( careerGroup == 'Slayer' ) then
|
||||
careerFR = "Tueur"
|
||||
end
|
||||
if careerGroup and careerFR then
|
||||
local careerGroupFR = string.gsub(v2.description, careerGroup, careerFR)
|
||||
v1.description = careerGroupFR
|
||||
else
|
||||
print("Error", v2.description)
|
||||
end
|
||||
--print("Career group", careerGroupFR, careerGroup)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local json10 = JSON.encode(c10)
|
||||
fp = io.open(careerv10, "w+")
|
||||
fp:write( json10)
|
||||
fp:close()
|
||||
local fp = io.open(goodC, "w+")
|
||||
fp:write( JSON.encode(good10))
|
||||
fp:close()
|
Reference in New Issue
Block a user