bluelovers / node-ck2 Goto Github PK
View Code? Open in Web Editor NEWGFX game configuration format parser. Crusader Kings II | Paradox Interactive
GFX game configuration format parser. Crusader Kings II | Paradox Interactive
$ npm install --save ck2
npm ERR! code EINVALIDPACKAGENAME
npm ERR! Invalid package name "bluelovers/string-width": name can only contain URL-friendly characters
I can't seem to find the package anywhere either, so I have no idea what it does. Perhaps https://www.npmjs.com/package/string-width does the same and can replace it?
I also noticed that every dependencies is set to use any version ("fast-csv": "*"
), which would break this package if any dependency have breaking changes. This should be fixed too.
I had to manually download and extracted this repository because of broken dependencies (#1).
input.txt: (extracted from Stellaris\common\technology\00_soc_tech.txt, line 3443)
ai_weight = {
factor = 5 #very rare tech
modifier = {
factor = 1.5
OR = {
has_ethic = ethic_spiritualist
has_ethic = ethic_fanatic_spiritualist
}
}
modifier = {
factor = 1.25
research_leader = {
area = society
has_trait = "leader_trait_expertise_psionics"
}
}
}
test.js:
'use strict'
const fs = require('fs')
const ck2 = require('./node-ck2-master/src/parse.js')
var input = fs.readFileSync('./input.txt', { encoding: 'utf8' })
var data = ck2.parse(input)
var output = JSON.stringify(data, null, '\t')
fs.writeFileSync('./output.json', output)
node ./test.js
output.json:
{
"ai_weight": {
"5": {
"factor": "1.5",
"OR": {
"has_ethic": "ethic_spiritualist",
"has_ethic#0": "ethic_fanatic_spiritualist"
}
},
"factor": "5",
"modifier": {
"factor": "1.25",
"research_leader": {
"area": "society",
"has_trait": "\"leader_trait_expertise_psionics\""
}
}
}
}
As you can see, the first modifier
property gets its name replaced by the value of the previous line. The issue only occurs when the comment is present, except when the value is surrounded with double quotation marks (factor = "5"
).
There's also some other issues with the output, but they're not as worrisome as those are hot-fixable when processing the output. They should still be addressed and fixed though.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.