Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local json = require ("dkjson")
- resetWorld = {}
- function resetWorld.load(fileName)
- local file = assert(io.open(fileName, 'r'), 'Error loading file: world.json');
- local content = file:read("*all");
- file:close();
- return json.decode(content, 1, nil);
- end
- function resetWorld.save(fileName, data, keyOrderArray)
- local content = json.encode(data, { indent = true, keyorder = keyOrderArray });
- local file = assert(io.open(fileName, 'w+b'), 'Error loading file: world.json');
- file:write(content);
- file:close();
- end
- resetWorld.config = resetWorld.load("/home/max/Games/development/test-0.6.1/keepers/CoreScripts/data/world/reset.json")
- if(resetWorld.config.doReset == true) then
- tempWorld = resetWorld.load("/home/max/Games/development/test-0.6.1/keepers/CoreScripts/data/world/world.json")
- tempWorld.customVariables = {}
- tempWorld.factionReputation = {}
- tempWorld.factionRanks = {}
- tempWorld.topics = {"solstheim","dark brotherhood","apelles matius","the mainland"}
- tempWorld.factionExpulsion = {}
- tempWorld.kills = {}
- -- table.insert() "torasa aram"=1, "scamp_creeper"=1, "mudcrab_unique"=1
- tempWorld.journal = [{
- "type"=0,
- "index"=10,
- "quest"="bm_rumors",
- "actorRefId"="imperial guard"
- },{
- "type"=0,
- "index"=50,
- "quest"="bm_rumors",
- "actorRefId"="imperial guard"
- },{
- "type"=0,
- "index"=10,
- "quest"="tr_dbattack",
- "actorRefId"="db_assassin1b"
- },{
- "type"=0,
- "index"=30,
- "quest"="tr_dbattack",
- "actorRefId"="imperial guard"
- }]
- resetWorld.save("/home/max/Games/development/test-0.6.1/keepers/CoreScripts/data/world/world.json", tempWorld)
- resetWorld.config.doReset = false
- resetWorld.save("/home/max/Games/development/test-0.6.1/keepers/CoreScripts/data/world/reset.json", resetWord.config)
- end
- return resetWorld
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement