Merge branch 'master' of ssh://cryps.gg:40022/~/cryps
This commit is contained in:
commit
a64572e6a2
1
client/.gitignore
vendored
1
client/.gitignore
vendored
@ -2,3 +2,4 @@ package-lock.json
|
|||||||
node_modules/
|
node_modules/
|
||||||
dist/
|
dist/
|
||||||
.cache/
|
.cache/
|
||||||
|
assets/molecules
|
||||||
|
|||||||
2
ops/.gitignore
vendored
2
ops/.gitignore
vendored
@ -1,2 +1,4 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
molecules/
|
||||||
|
bulk.sdf
|
||||||
|
|||||||
82
ops/fetch.molecules.js
Normal file
82
ops/fetch.molecules.js
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const renderer = require('sdftosvg');
|
||||||
|
|
||||||
|
const SVG_OPTS = {
|
||||||
|
backgroundColor: 'none',
|
||||||
|
}
|
||||||
|
|
||||||
|
function convert(i) {
|
||||||
|
const output = `./../client/assets/molecules/${i}.svg`;
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
fs.readFile(`./molecules/mol${i}`, 'utf8', function rfCb(err, sdf) {
|
||||||
|
if (err) return reject(err);
|
||||||
|
// write svg
|
||||||
|
renderer.renderSdfToSvg(sdf, SVG_OPTS, function(err, svg) {
|
||||||
|
if (err) return reject(err);
|
||||||
|
fs.writeFile(output, svg, function written(err) {
|
||||||
|
if (err) reject(err);
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loop() {
|
||||||
|
for (var i = 10000; i >= 0; i--) {
|
||||||
|
try {
|
||||||
|
await convert(i);
|
||||||
|
console.log('finished record', i);
|
||||||
|
} catch (e) {
|
||||||
|
console.error('record error', i, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
loop();
|
||||||
|
|
||||||
|
// const request = require('request');
|
||||||
|
// const fs = require('fs');
|
||||||
|
// const renderer = require('sdftosvg');
|
||||||
|
|
||||||
|
// const SVG_OPTS = {
|
||||||
|
// backgroundColor: 'none',
|
||||||
|
// }
|
||||||
|
|
||||||
|
// function fetch(i) {
|
||||||
|
// return new Promise((resolve, reject) => {
|
||||||
|
// const url = `https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/CID/${i}/record/SDF/?record_type=2d&response_type=save&response_basename=Structure2D_CID_2519`;
|
||||||
|
// const output = `./../client/assets/molecules/${i}.svg`;
|
||||||
|
|
||||||
|
// request(url, function cb(err, res, body) {
|
||||||
|
// if (err) reject(err);
|
||||||
|
|
||||||
|
// // write file
|
||||||
|
// fs.writeFile(`./molecules/Structure2D_CID_${i}.sdf`, body, function written(err) {
|
||||||
|
// if (err) reject(err);
|
||||||
|
// });
|
||||||
|
|
||||||
|
// // write svg
|
||||||
|
// renderer.renderSdfToSvg(body, SVG_OPTS, function(err, svg) {
|
||||||
|
// if (err) reject(err);
|
||||||
|
// fs.writeFile(output, svg, function written(err) {
|
||||||
|
// if (err) reject(err);
|
||||||
|
// resolve();
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// async function loop() {
|
||||||
|
// for (var i = 10000; i >= 0; i--) {
|
||||||
|
// try {
|
||||||
|
// await fetch(i);
|
||||||
|
// console.log('finished record', i);
|
||||||
|
// } catch (e) {
|
||||||
|
// console.error(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
18
ops/molecules.js
Normal file
18
ops/molecules.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
const renderer = require('sdftosvg');
|
||||||
|
const uuidv4 = require('uuid/v4');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
function convert(f) {
|
||||||
|
const uuid = uuidv4();
|
||||||
|
const input = `./molecules/${f}`;
|
||||||
|
const output = `./../client/assets/molecules/${uuid}.svg`;
|
||||||
|
fs.readFile(input, 'utf8', (err, sdf) => {
|
||||||
|
renderer.renderSdfToSvg(sdf, {}, function(err, svg) {
|
||||||
|
if (err) console.error(input, err);
|
||||||
|
fs.writeFile(output, svg, 'utf8', err => {
|
||||||
|
if (err) console.error(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@ -4,6 +4,7 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"split:molecules": "cd molecules; csplit -f mol bulk.sdf /\$\$\$\$/ {*} --suppress-matched -z",
|
||||||
"migrate": "knex migrate:latest",
|
"migrate": "knex migrate:latest",
|
||||||
"migrate:make": "knex migrate:make --",
|
"migrate:make": "knex migrate:make --",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
@ -12,6 +13,9 @@
|
|||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"knex": "^0.15.2",
|
"knex": "^0.15.2",
|
||||||
"pg": "^7.4.3"
|
"pg": "^7.4.3",
|
||||||
|
"request": "^2.88.0",
|
||||||
|
"sdftosvg": "0.0.4",
|
||||||
|
"uuid": "^3.3.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,11 +38,6 @@ make strike *really* hit first / resolve at same time?
|
|||||||
* vbox drops chances
|
* vbox drops chances
|
||||||
* 50% spec, 25% colour etc
|
* 50% spec, 25% colour etc
|
||||||
|
|
||||||
* rework damage and resolutions
|
|
||||||
deal_damage(colour)
|
|
||||||
resolutions.push(skill()).flatten()
|
|
||||||
overkill in logs
|
|
||||||
|
|
||||||
* confirm cryp without skill ready
|
* confirm cryp without skill ready
|
||||||
* iconography
|
* iconography
|
||||||
* aoe skills
|
* aoe skills
|
||||||
|
|||||||
@ -738,6 +738,7 @@ impl Skill {
|
|||||||
Skill::DecayTick => Var::from(Skill::Decay).speed(),
|
Skill::DecayTick => Var::from(Skill::Decay).speed(),
|
||||||
Skill::TriageTick => Var::from(Skill::Triage).speed(),
|
Skill::TriageTick => Var::from(Skill::Triage).speed(),
|
||||||
Skill::StrangleTick => Var::from(Skill::Strangle).speed(),
|
Skill::StrangleTick => Var::from(Skill::Strangle).speed(),
|
||||||
|
Skill::CorruptionTick => Var::from(Skill::Corrupt).speed(),
|
||||||
|
|
||||||
_ => Var::from(*self).speed(),
|
_ => Var::from(*self).speed(),
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user