diff --git a/app.js b/app.js
index 039db49..a9170d5 100644
--- a/app.js
+++ b/app.js
@@ -7,11 +7,13 @@ var bodyParser = require('body-parser');
var async = require('async');
var mongo = require('mongodb');
var request = require('request');
+var hbs = require('hbs');
var index = require('./routes/index');
var comp = require('./routes/comp');
var bio = require('./routes/bio');
var hyb = require('./routes/hyb');
+var set = require('./routes/set');
var app = express();
@@ -27,10 +29,18 @@ app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
+hbs.registerHelper('ifCond', function(v1, v2, options) {
+ if (v1 === v2) {
+ return options.fn(this);
+ }
+ return options.inverse(this);
+});
+
app.use('/', index);
app.use('/biochemical', bio);
app.use('/composite', comp);
app.use('/hybrid', hyb);
+app.use('/settings', set);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
diff --git a/db_server/bps.json b/db_server/bps.json
index 98a75b8..987d92b 100644
--- a/db_server/bps.json
+++ b/db_server/bps.json
@@ -1,24 +1,244 @@
{
"_id": "composite",
"reaction": [{
- "name": "Sulfuric Acid",
- "id": 16661,
+ "name": "Caesarium Cadmide",
+ "id": 16663,
"type": "simple",
"inputs": [{
- "id": 16634,
+ "id": 16643,
"qt": 100
},
{
+ "id": 16647,
+ "qt": 100
+ },
+ {
+ "id": 4312,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16663,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Carbon Polymers",
+ "id": 16659,
+ "type": "simple",
+ "inputs": [{
+ "id": 16633,
+ "qt": 100
+ },
+ {
+ "id": 16636,
+ "qt": 100
+ },
+ {
+ "id": 4247,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16659,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Ceramic Powder",
+ "id": 16660,
+ "type": "simple",
+ "inputs": [{
"id": 16635,
"qt": 100
},
+ {
+ "id": 16636,
+ "qt": 100
+ },
+ {
+ "id": 4246,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16660,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Crystallite Alloy",
+ "id": 16655,
+ "type": "simple",
+ "inputs": [{
+ "id": 16640,
+ "qt": 100
+ },
+ {
+ "id": 16643,
+ "qt": 100
+ },
+ {
+ "id": 4247,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16655,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Dysporite",
+ "id": 16668,
+ "type": "simple",
+ "inputs": [{
+ "id": 16646,
+ "qt": 100
+ },
+ {
+ "id": 16650,
+ "qt": 100
+ },
+ {
+ "id": 4247,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16668,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Fernite Alloy",
+ "id": 16656,
+ "type": "simple",
+ "inputs": [{
+ "id": 16639,
+ "qt": 100
+ },
+ {
+ "id": 16642,
+ "qt": 100
+ },
+ {
+ "id": 4246,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16656,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Ferrofluid",
+ "id": 16669,
+ "type": "simple",
+ "inputs": [{
+ "id": 16648,
+ "qt": 100
+ },
+ {
+ "id": 16650,
+ "qt": 100
+ },
+ {
+ "id": 4246,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16669,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Fluxed Condensates",
+ "id": 17769,
+ "type": "simple",
+ "inputs": [{
+ "id": 16651,
+ "qt": 100
+ },
+ {
+ "id": 16653,
+ "qt": 100
+ },
+ {
+ "id": 4312,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 17769,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Hexite",
+ "id": 16665,
+ "type": "simple",
+ "inputs": [{
+ "id": 16641,
+ "qt": 100
+ },
+ {
+ "id": 16644,
+ "qt": 100
+ },
{
"id": 4051,
"qt": 5
}
],
"output": {
- "id": 16661,
+ "id": 16665,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Hyperflurite",
+ "id": 16666,
+ "type": "simple",
+ "inputs": [{
+ "id": 16642,
+ "qt": 100
+ },
+ {
+ "id": 16652,
+ "qt": 100
+ },
+ {
+ "id": 4051,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16666,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Neo Mercurite",
+ "id": 16667,
+ "type": "simple",
+ "inputs": [{
+ "id": 16646,
+ "qt": 100
+ },
+ {
+ "id": 16651,
+ "qt": 100
+ },
+ {
+ "id": 4247,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16667,
"qt": 200
}
},
@@ -45,15 +265,15 @@
}
},
{
- "name": "Neo Mercurite",
- "id": 16667,
+ "name": "Promethium Mercurite",
+ "id": 33337,
"type": "simple",
"inputs": [{
"id": 16646,
"qt": 100
},
{
- "id": 16651,
+ "id": 16652,
"qt": 100
},
{
@@ -62,10 +282,338 @@
}
],
"output": {
- "id": 16667,
+ "id": 33337,
"qt": 200
}
},
+ {
+ "name": "Prometium",
+ "id": 17960,
+ "type": "simple",
+ "inputs": [{
+ "id": 16643,
+ "qt": 100
+ },
+ {
+ "id": 16652,
+ "qt": 100
+ },
+ {
+ "id": 4312,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 17960,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Rolled Tungsten Alloy",
+ "id": 16657,
+ "type": "simple",
+ "inputs": [{
+ "id": 16637,
+ "qt": 100
+ },
+ {
+ "id": 16644,
+ "qt": 100
+ },
+ {
+ "id": 4051,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16657,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Silicon Diborite",
+ "id": 16658,
+ "type": "simple",
+ "inputs": [{
+ "id": 16635,
+ "qt": 100
+ },
+ {
+ "id": 16636,
+ "qt": 100
+ },
+ {
+ "id": 4312,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16658,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Solerium",
+ "id": 16664,
+ "type": "simple",
+ "inputs": [{
+ "id": 16641,
+ "qt": 100
+ },
+ {
+ "id": 16647,
+ "qt": 100
+ },
+ {
+ "id": 4312,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16664,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Sulfuric Acid",
+ "id": 16661,
+ "type": "simple",
+ "inputs": [{
+ "id": 16634,
+ "qt": 100
+ },
+ {
+ "id": 16635,
+ "qt": 100
+ },
+ {
+ "id": 4051,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16661,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Thulium Hafnite",
+ "id": 33336,
+ "type": "simple",
+ "inputs": [{
+ "id": 16648,
+ "qt": 100
+ },
+ {
+ "id": 16653,
+ "qt": 100
+ },
+ {
+ "id": 4246,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 33336,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Titanium Chromide",
+ "id": 16654,
+ "type": "simple",
+ "inputs": [{
+ "id": 16638,
+ "qt": 100
+ },
+ {
+ "id": 16641,
+ "qt": 100
+ },
+ {
+ "id": 4312,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16654,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Vanadium Hafnite",
+ "id": 17959,
+ "type": "simple",
+ "inputs": [{
+ "id": 16642,
+ "qt": 100
+ },
+ {
+ "id": 16648,
+ "qt": 100
+ },
+ {
+ "id": 4246,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 17959,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Crystalline Carbonide",
+ "id": 16670,
+ "type": "complex",
+ "inputs": [{
+ "id": 16655,
+ "qt": 100
+ },
+ {
+ "id": 16659,
+ "qt": 100
+ },
+ {
+ "id": 4247,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16670,
+ "qt": 10000
+ }
+ },
+ {
+ "name": "Fermionic Condensates",
+ "id": 17317,
+ "type": "complex",
+ "inputs": [{
+ "id": 16663,
+ "qt": 100
+ },
+ {
+ "id": 16668,
+ "qt": 100
+ },
+ {
+ "id": 17769,
+ "qt": 100
+ },
+ {
+ "id": 17960,
+ "qt": 100
+ },
+ {
+ "id": 4247,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 17317,
+ "qt": 200
+ }
+ },
+ {
+ "name": "Fernite Carbide",
+ "id": 16673,
+ "type": "complex",
+ "inputs": [{
+ "id": 16656,
+ "qt": 100
+ },
+ {
+ "id": 16660,
+ "qt": 100
+ },
+ {
+ "id": 4246,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16673,
+ "qt": 10000
+ }
+ },
+ {
+ "name": "Ferrogel",
+ "id": 16683,
+ "type": "complex",
+ "inputs": [{
+ "id": 16665,
+ "qt": 100
+ },
+ {
+ "id": 16666,
+ "qt": 100
+ },
+ {
+ "id": 16669,
+ "qt": 100
+ },
+ {
+ "id": 17960,
+ "qt": 100
+ },
+ {
+ "id": 4246,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16683,
+ "qt": 400
+ }
+ },
+ {
+ "name": "Fullerides",
+ "id": 16679,
+ "type": "complex",
+ "inputs": [{
+ "id": 16659,
+ "qt": 100
+ },
+ {
+ "id": 16662,
+ "qt": 100
+ },
+ {
+ "id": 4051,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16679,
+ "qt": 3000
+ }
+ },
+ {
+ "name": "Hypersynaptic Fibers",
+ "id": 16682,
+ "type": "complex",
+ "inputs": [{
+ "id": 16664,
+ "qt": 100
+ },
+ {
+ "id": 16668,
+ "qt": 100
+ },
+ {
+ "id": 17959,
+ "qt": 100
+ },
+ {
+ "id": 4312,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16682,
+ "qt": 750
+ }
+ },
{
"name": "Nanotransistors",
"id": 16681,
@@ -91,6 +639,186 @@
"id": 16681,
"qt": 1500
}
+ },
+ {
+ "name": "Nonlinear Metamaterials",
+ "id": 33362,
+ "type": "complex",
+ "inputs": [{
+ "id": 16654,
+ "qt": 100
+ },
+ {
+ "id": 16669,
+ "qt": 100
+ },
+ {
+ "id": 4051,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 33362,
+ "qt": 300
+ }
+ },
+ {
+ "name": "Phenolic Composites",
+ "id": 16680,
+ "type": "complex",
+ "inputs": [{
+ "id": 16658,
+ "qt": 100
+ },
+ {
+ "id": 16663,
+ "qt": 100
+ },
+ {
+ "id": 17959,
+ "qt": 100
+ },
+ {
+ "id": 4312,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16680,
+ "qt": 2200
+ }
+ },
+ {
+ "name": "Photonic Metamaterials",
+ "id": 33359,
+ "type": "complex",
+ "inputs": [{
+ "id": 16655,
+ "qt": 100
+ },
+ {
+ "id": 33336,
+ "qt": 100
+ },
+ {
+ "id": 4312,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 33359,
+ "qt": 300
+ }
+ },
+ {
+ "name": "Plasmonic Metamaterials",
+ "id": 33361,
+ "type": "complex",
+ "inputs": [{
+ "id": 16656,
+ "qt": 100
+ },
+ {
+ "id": 16667,
+ "qt": 100
+ },
+ {
+ "id": 4246,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 33361,
+ "qt": 300
+ }
+ },
+ {
+ "name": "Sylramic Fibers",
+ "id": 16678,
+ "type": "complex",
+ "inputs": [{
+ "id": 16660,
+ "qt": 100
+ },
+ {
+ "id": 16665,
+ "qt": 100
+ },
+ {
+ "id": 4247,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16678,
+ "qt": 6000
+ }
+ },
+ {
+ "name": "Terahertz Metamaterials",
+ "id": 33360,
+ "type": "complex",
+ "inputs": [{
+ "id": 16657,
+ "qt": 100
+ },
+ {
+ "id": 17960,
+ "qt": 100
+ },
+ {
+ "id": 4247,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 33360,
+ "qt": 300
+ }
+ },
+ {
+ "name": "Titanium Carbide",
+ "id": 16671,
+ "type": "complex",
+ "inputs": [{
+ "id": 16654,
+ "qt": 100
+ },
+ {
+ "id": 16658,
+ "qt": 100
+ },
+ {
+ "id": 4312,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16671,
+ "qt": 10000
+ }
+ },
+ {
+ "name": "Tungsten Carbide",
+ "id": 16672,
+ "type": "complex",
+ "inputs": [{
+ "id": 16657,
+ "qt": 100
+ },
+ {
+ "id": 16661,
+ "qt": 100
+ },
+ {
+ "id": 4051,
+ "qt": 5
+ }
+ ],
+ "output": {
+ "id": 16672,
+ "qt": 10000
+ }
}
]
}
\ No newline at end of file
diff --git a/db_server/dbserver.js b/db_server/dbserver.js
index ba86344..aca559b 100644
--- a/db_server/dbserver.js
+++ b/db_server/dbserver.js
@@ -8,7 +8,9 @@ var systems = require('./systems.json');
var marketUrl = "https://market.fuzzwork.co.uk/aggregates/?region=60003760&types=";
var testMarketUrl = "https://market.fuzzwork.co.uk/aggregates/?region=60003760&types=34,35,36";
-//addDaily();
+//genItems(); //generate base item collection
+
+addDaily();
newUpdateItems();
updateCostIndex();
@@ -53,7 +55,7 @@ function updateCostIndex() {
let temp = {
"updateOne": {
"filter": {
- "_id": parseInt(systems[i].solarSystemID)
+ "_id": systems[i].solarSystemID
},
"update": {
"_id": systems[i].solarSystemID,
@@ -98,6 +100,44 @@ function split50() {
return arr
}
+function genItems() {
+ idarr = split50();
+ let itms = [];
+ async.map(idarr, function(ids, callback) {
+ request(marketUrl + ids, function(err, res, body) {
+ callback(null, JSON.parse(body));
+ });
+ }, function(err, results) {
+ let arr = [];
+ for (let i = 0; i < results.length; i++) {
+ for (var prop in results[i]) {
+ arr.push(results[i][prop]);
+ }
+ }
+ for (let ii = 0; ii < arr.length; ii++) {
+ let temp = {
+ "_id": items[ii].TypeID,
+ "name": items[ii].NAME,
+ "sell": parseFloat(arr[ii].sell.min),
+ "buy": parseFloat(arr[ii].buy.max),
+ "med": ((parseFloat(arr[ii].sell.min) + parseFloat(arr[ii].buy.max)) / 2)
+ }
+ itms.push(temp);
+ }
+ mongo.connect(svurl, function(err, db) {
+ if (err) {
+ console.log(err);
+ } else {
+ db.collection('items').insertMany(itms, function(err, result) {
+ if (err) throw err;
+ console.log("success!!");
+ db.close();
+ });
+ }
+ });
+ });
+}
+
function newUpdateItems() {
idarr = split50();
let itms = [];
@@ -116,9 +156,10 @@ function newUpdateItems() {
let temp = {
"updateOne": {
"filter": {
- _id: parseInt(items[ii].TypeID)
+ "_id": items[ii].TypeID
},
"update": {
+ "_id": items[ii].TypeID,
"name": items[ii].NAME,
"sell": parseFloat(arr[ii].sell.min),
"buy": parseFloat(arr[ii].buy.max),
@@ -138,7 +179,6 @@ function updateDB(itms) {
if (err) {
console.log(err);
} else {
- let querry = {};
db.collection('items').bulkWrite(itms, { "ordered": true, "w": 1 }, function(err, result) {
if (err) throw err;
console.log(result.modifiedCount);
diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css
index bfcb008..ffb3cdd 100644
--- a/public/stylesheets/style.css
+++ b/public/stylesheets/style.css
@@ -1,19 +1,20 @@
body {
- padding-top: 56px;
- margin-bottom: 60px;
- font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
+ padding-top: 56px;
+ padding-bottom: 60px;
+ font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
}
a {
- color: #00B7FF;
+ color: #00B7FF;
}
.footer {
- position: absolute;
- bottom: 0;
- width: 100%;
- /* Set the fixed height of the footer here */
- height: 30px;
- line-height: 30px; /* Vertically center the text there */
- background-color: #f5f5f5;
-}
+ position: fixed;
+ bottom: 0;
+ width: 100%;
+ /* Set the fixed height of the footer here */
+ height: 30px;
+ line-height: 30px;
+ /* Vertically center the text there */
+ background-color: #f5f5f5;
+}
\ No newline at end of file
diff --git a/routes/comp.js b/routes/comp.js
index 67e2bfc..bcfaf98 100644
--- a/routes/comp.js
+++ b/routes/comp.js
@@ -43,359 +43,129 @@ function getSimplePrice(data, id) {
}
}
+function getChainTax(prof, reac, id) {
+ let temp = 0;
+ for (let i = 0; i < reac.length; i++) {
+ if (reac[i].id === id) {
+ let inp = reac[i].inputs;
+ for (let ii = 0; ii < inp.length; ii++) {
+ for (let iii = 0; iii < prof.length; iii++) {
+ if (inp[ii].id === prof[iii].id) {
+ temp += prof[iii].taxes.index / 2;
+ }
+ }
+ }
+ return temp;
+ }
+ }
+}
+
/* GET comp page. */
router.get('/', function(req, res, next) {
- //querry opts
- let opt = req.query;
- if (opt.input) { var imeth = opt.input; }
- if (opt.output) { var ometh = opt.output; }
- if (opt.skill) { var skill = parseInt(opt.skill); }
- if (opt.facility) { var facility = opt.facility; }
- if (opt.rig) { var rig = parseInt(opt.rig); var rige = true; }
- if (opt.space) { var space = opt.space; }
- if (opt.indyTax) { var indyTax = opt.indyTax; }
- if (opt.system) { var syst = opt.system; }
+ //set cookies if not found
+ var ck = req.cookies;
+ //console.log(ck);
+ if (!ck.input) { res.cookie('input', 'buy'); var imeth = "buy"; }
+ if (!ck.output) { res.cookie('output', 'sell'); var ometh = "sell"; }
+ if (!ck.skill) { res.cookie('skill', 5); var skill = 5; }
+ if (!ck.facility) { res.cookie('facility', 'large'); var facility = "large"; }
+ if (!ck.rig) { res.cookie('rig', 1); var rig = 1; var rige = true; }
+ if (!ck.space) { res.cookie('space', 'null'); var space = "null"; }
+ if (!ck.indyTax) { res.cookie('indyTax', 0); var indyTax = 0; }
+ if (!ck.duration) { res.cookie('duration', 10080); var duration = 10080; }
+ if (!ck.system) { res.cookie('system', 'Basgerin'); var syst = "Basgerin" }
+
+ //set internal vars to use cookie values
+ if (ck.input.toLowerCase() === "buy" || ck.input.toLowerCase() === "sell") {
+ var imeth = ck.input.toLowerCase();
+ } else {
+ var imeth = "buy";
+ }
+ if (ck.output.toLowerCase() === "buy" || ck.output.toLowerCase() === "sell") {
+ var ometh = ck.output.toLowerCase();
+ } else {
+ var ometh = "sell";
+ }
+ if (parseInt(ck.skill) >= 0 && parseInt(ck.skill) <= 5) {
+ var skill = parseInt(ck.skill);
+ } else {
+ var skill = 5;
+ }
+ if (ck.facility.toLowerCase() === "med" || ck.facility.toLowerCase() === "large") {
+ var facility = ck.facility.toLowerCase();
+ } else {
+ var facility = "large";
+ }
+ if (parseInt(ck.rig) >= 0 && parseInt(ck.rig) <= 2) {
+ var rig = parseInt(ck.rig);
+ var rige = true;
+ } else {
+ var rig = 1;
+ var rige = true;
+ }
+ if (ck.space.toLowerCase() === "low" || ck.space.toLowerCase() === "null") {
+ var space = ck.space.toLowerCase();
+ } else {
+ var space = "null";
+ }
+ if (ck.indyTax >= 0 && ck.indyTax <= 50) {
+ var indyTax = ck.indyTax
+ } else {
+ var indyTax = 0;
+ }
+ if (ck.duration >= 1 && ck.duration <= 43200) {
+ var duration = ck.duration
+ } else {
+ var duration = 10080;
+ }
+ if (ck.system) {
+ var syst = ck.system;
+ }
+ console.log("in:", imeth, "out:", ometh, "skill:", skill, "faci:", facility, "rig:", rig, "space:", space, "tax:", indyTax, "system:", syst);
+
+ //calc bonus with opts
var matb = 1;
var time = 180;
var bonus = {};
-
- //set cookies if not found
- console.log(req.cookies);
- if (!req.cookies.input) { res.cookie('input', 'buy'); }
- if (!req.cookies.output) { res.cookie('output', 'sell'); }
- if (!req.cookies.skill) { res.cookie('skill', 5); }
- if (!req.cookies.facility) { res.cookie('facility', 'large'); }
- if (!req.cookies.rig) { res.cookie('rig', 1); }
- if (!req.cookies.space) { res.cookie('space', 'null'); }
- if (!req.cookies.indyTax) { res.cookie('indyTax', 0); }
- if (!req.cookies.system) { res.cookie('system', 'Jita'); }
-
- //calc bonus with opts
//default is Skill (Reactions) 5, Large facility & T1 rig in NullSec
- if (skill && facility && rige && space) { // S F R SPACE
- //calc material bonus
- if (rig === 1 && space === "null") {
- matb = 1 - (2 * 1.1) / 100
- } else if (rig === 1 && space === "low") {
- matb = 1 - 2 / 100
- } else if (rig === 2 && space === "null") {
- matb = 1 - (2.4 * 1.1) / 100
- } else if (rig === 2 && space === "low") {
- matb = 1 - 2.4 / 100
- } else {
- matb = 1;
- }
- //calc time bonus
- let time = 180 * (1 - (4 * skill) / 100); //skill bonus
- //facility bonus
- if (facility === "med") {
- time = time * (1 - 0)
- } else if (facility === "large") {
- time = time * (1 - (25 / 100))
- }
- //rig bonus
- if (rig === 1 && space === "null") {
- time = time * (1 - (20 * 1.1 / 100))
- } else if (rig === 1 && space === "low") {
- time = time * (1 - (20 / 100))
- } else if (rig === 2 && space === "null") {
- time = time * (1 - (24 * 1.1 / 100))
- } else if (rig === 2 && space === "low") {
- time = time * (1 - (24 / 100))
- } else {
- time = time
- }
- //final result
- bonus = {
- "mat": matb,
- "time": time
- }
- } else if (skill && facility && rige) { // S F R
- //calc material bonus
- if (rig === 1) {
- matb = 1 - (2 * 1.1) / 100
- } else if (rig === 2) {
- matb = 1 - (2.4 * 1.1) / 100
- } else {
- matb = 1;
- }
- //calc time bonus
- let time = 180 * (1 - (4 * skill) / 100); //skill bonus
- //facility bonus
- if (facility === "med") {
- time = time * (1 - 0)
- } else if (facility === "large") {
- time = time * (1 - (25 / 100))
- }
- //rig bonus
- if (rig === 1) {
- time = time * (1 - (20 * 1.1 / 100))
- } else if (rig === 2) {
- time = time * (1 - (24 * 1.1 / 100))
- } else {
- time = time
- }
- //final result
- bonus = {
- "mat": matb,
- "time": time
- }
- } else if (skill && facility && !rige) { // S F
- //calc material bonus
+ //calc material bonus
+ if (rig === 1 && space === "null") {
matb = 1 - (2 * 1.1) / 100
- //calc time bonus
- //skill bonus
- let time = 180 * (1 - (4 * skill) / 100);
- //facility bonus
- if (facility === "med") {
- time = time * (1 - 0)
- } else if (facility === "large") {
- time = time * (1 - (25 / 100))
- }
- //rig bonus
- time = time * (1 - (20 * 1.1 / 100))
- //final result
- bonus = {
- "mat": matb,
- "time": time
- }
- } else if (skill && !facility && rige && space) { // S R SPACE
- //calc material bonus
- if (rig === 1 && space === "null") {
- matb = 1 - (2 * 1.1) / 100
- } else if (rig === 1 && space === "low") {
- matb = 1 - 2 / 100
- } else if (rig === 2 && space === "null") {
- matb = 1 - (2.4 * 1.1) / 100
- } else if (rig === 2 && space === "low") {
- matb = 1 - 2.4 / 100
- } else {
- matb = 1;
- }
- //calc time bonus
- let time = 180 * (1 - (4 * skill) / 100); //skill bonus
- //facility bonus
- time = time * (1 - (25 / 100))
- //rig bonus
- if (rig === 1 && space === "null") {
- time = time * (1 - (20 * 1.1 / 100))
- } else if (rig === 1 && space === "low") {
- time = time * (1 - (20 / 100))
- } else if (rig === 2 && space === "null") {
- time = time * (1 - (24 * 1.1 / 100))
- } else if (rig === 2 && space === "low") {
- time = time * (1 - (24 / 100))
- } else {
- time = time
- }
- //final result
- bonus = {
- "mat": matb,
- "time": time
- }
- } else if (skill && !facility && rige) { // S R
- //calc material bonus
- if (rig === 1) {
- matb = 1 - (2 * 1.1) / 100
- } else if (rig === 2) {
- matb = 1 - (2.4 * 1.1) / 100
- } else {
- matb = 1;
- }
- //calc time bonus
- let time = 180 * (1 - (4 * skill) / 100); //skill bonus
- //facility bonus
- time = time * (1 - (25 / 100))
- //rig bonus
- if (rig === 1) {
- time = time * (1 - (20 * 1.1 / 100))
- } else if (rig === 2) {
- time = time * (1 - (24 * 1.1 / 100))
- } else {
- time = time
- }
- //final result
- bonus = {
- "mat": matb,
- "time": time
- }
- } else if (!skill && facility && rige && space) { // F R SPACE
- //calc material bonus
- if (rig === 1 && space === "null") {
- matb = 1 - (2 * 1.1) / 100
- } else if (rig === 1 && space === "low") {
- matb = 1 - 2 / 100
- } else if (rig === 2 && space === "null") {
- matb = 1 - (2.4 * 1.1) / 100
- } else if (rig === 2 && space === "low") {
- matb = 1 - 2.4 / 100
- } else {
- matb = 1;
- }
- //calc time bonus
- let time = 180 * (1 - (4 * 5) / 100); //skill bonus
- //facility bonus
- if (facility === "med") {
- time = time * (1 - 0)
- } else if (facility === "large") {
- time = time * (1 - (25 / 100))
- }
- //rig bonus
- if (rig === 1 && space === "null") {
- time = time * (1 - (20 * 1.1 / 100))
- } else if (rig === 1 && space === "low") {
- time = time * (1 - (20 / 100))
- } else if (rig === 2 && space === "null") {
- time = time * (1 - (24 * 1.1 / 100))
- } else if (rig === 2 && space === "low") {
- time = time * (1 - (24 / 100))
- } else {
- time = time
- }
- //final result
- bonus = {
- "mat": matb,
- "time": time
- }
- } else if (!skill && facility && rige) { // F R
- //calc material bonus
- if (rig === 1) {
- matb = 1 - (2 * 1.1) / 100
- } else if (rig === 2) {
- matb = 1 - (2.4 * 1.1) / 100
- } else {
- matb = 1;
- }
- //calc time bonus
- let time = 180 * (1 - (4 * 5) / 100); //skill bonus
- //facility bonus
- if (facility === "med") {
- time = time * (1 - 0)
- } else if (facility === "large") {
- time = time * (1 - (25 / 100))
- }
- //rig bonus
- if (rig === 1) {
- time = time * (1 - (20 * 1.1 / 100))
- } else if (rig === 2) {
- time = time * (1 - (24 * 1.1 / 100))
- } else {
- time = time
- }
- //final result
- bonus = {
- "mat": matb,
- "time": time
- }
- } else if (skill && !facility && !rige) { // S
- //calc material bonus
- matb = 1 - (2 * 1.1) / 100
- //calc time bonus
- let time = 180 * (1 - (4 * skill) / 100); //skill bonus
- //facility bonus
- time = time * (1 - (25 / 100))
- //rig bonus
- time = time * (1 - (20 * 1.1 / 100))
- //final result
- bonus = {
- "mat": matb,
- "time": time
- }
- } else if (!skill && facility && !rige) { // F
- //calc material bonus
- matb = 1 - (2 * 1.1) / 100
- //calc time bonus
- let time = 180 * (1 - (4 * 5) / 100); //skill bonus
- //facility bonus
- if (facility === "med") {
- time = time * (1 - 0)
- } else if (facility === "large") {
- time = time * (1 - (25 / 100))
- }
- //rig bonus
- time = time * (1 - (20 * 1.1 / 100))
- //final result
- bonus = {
- "mat": matb,
- "time": time
- }
- } else if (!skill && !facility && rige && space) { // R SPACE
- //calc material bonus
- if (rig === 1 && space === "null") {
- matb = 1 - (2 * 1.1) / 100
- } else if (rig === 1 && space === "low") {
- matb = 1 - 2 / 100
- } else if (rig === 2 && space === "null") {
- matb = 1 - (2.4 * 1.1) / 100
- } else if (rig === 2 && space === "low") {
- matb = 1 - 2.4 / 100
- } else {
- matb = 1;
- }
- //calc time bonus
- let time = 180 * (1 - (4 * 5) / 100); //skill bonus
- //facility bonus
- time = time * (1 - (25 / 100))
- //rig bonus
- if (rig === 1 && space === "null") {
- time = time * (1 - (20 * 1.1 / 100))
- } else if (rig === 1 && space === "low") {
- time = time * (1 - (20 / 100))
- } else if (rig === 2 && space === "null") {
- time = time * (1 - (24 * 1.1 / 100))
- } else if (rig === 2 && space === "low") {
- time = time * (1 - (24 / 100))
- } else {
- time = time
- }
- //final result
- bonus = {
- "mat": matb,
- "time": time
- }
- } else if (!skill && !facility && rige) { // R
- //calc material bonus
- if (rig === 1) {
- matb = 1 - (2 * 1.1) / 100
- } else if (rig === 2) {
- matb = 1 - (2.4 * 1.1) / 100
- } else {
- matb = 1;
- }
- //calc time bonus
- let time = 180 * (1 - (4 * 5) / 100); //skill bonus
- //facility bonus
- time = time * (1 - (25 / 100))
- //rig bonus
- if (rig === 1) {
- time = time * (1 - (20 * 1.1 / 100))
- } else if (rig === 2) {
- time = time * (1 - (24 * 1.1 / 100))
- } else {
- time = time
- }
- //final result
- bonus = {
- "mat": matb,
- "time": time
- }
- } else { // None
- //calc material bonus
- matb = 1 - (2 * 1.1) / 100
- //calc time bonus
- let time = 180 * (1 - (4 * 5) / 100); //skill bonus
- //facility bonus
- time = time * (1 - (25 / 100))
- //rig bonus
- time = time * (1 - (20 * 1.1 / 100))
- //final result
- bonus = {
- "mat": matb,
- "time": time
- }
+ } else if (rig === 1 && space === "low") {
+ matb = 1 - 2 / 100
+ } else if (rig === 2 && space === "null") {
+ matb = 1 - (2.4 * 1.1) / 100
+ } else if (rig === 2 && space === "low") {
+ matb = 1 - 2.4 / 100
+ } else {
+ matb = 1;
}
- var cycles = Math.floor(43200 / bonus.time);
- //var cycles = 1;
+ //calc time bonus
+ time = 180 * (1 - (4 * skill) / 100); //skill bonus
+ //facility bonus
+ if (facility === "med") {
+ time = time * (1 - 0)
+ } else if (facility === "large") {
+ time = time * (1 - (25 / 100))
+ }
+ //rig bonus
+ if (rig === 1 && space === "null") {
+ time = time * (1 - (20 * 1.1 / 100))
+ } else if (rig === 1 && space === "low") {
+ time = time * (1 - (20 / 100))
+ } else if (rig === 2 && space === "null") {
+ time = time * (1 - (24 * 1.1 / 100))
+ } else if (rig === 2 && space === "low") {
+ time = time * (1 - (24 / 100))
+ } else {
+ time = time;
+ }
+ //final result
+ bonus = {
+ "mat": matb,
+ "time": time
+ }
+ var cycles = Math.floor(duration / bonus.time);
//vars
let lvid = 30000891;
@@ -417,7 +187,7 @@ router.get('/', function(req, res, next) {
let bpsData = results[1];
let systems = results[2];
//get cost index
- var costIndex = getCostIndex(systems, 'l-vxtk');
+ var costIndex = getCostIndex(systems, syst);
let calc = [];
let reac = bpsData[0].reaction;
//START build new BP array with prices
@@ -443,6 +213,7 @@ router.get('/', function(req, res, next) {
ttmp = {
"id": reac[i].id,
"name": reac[i].name,
+ "type": reac[i].type,
"chain": "No",
"inputs": tempin,
"output": tempout
@@ -469,6 +240,7 @@ router.get('/', function(req, res, next) {
ttmp = {
"id": reac[i].id,
"name": reac[i].name,
+ "type": reac[i].type,
"chain": "No",
"inputs": tempin,
"output": tempout
@@ -486,6 +258,7 @@ router.get('/', function(req, res, next) {
"sell": getItem(itemData, reac[i].inputs[inp].id).sell * reac[i].inputs[inp].qt * cycles
}
} else { //look for input from other reactions
+ console.log(reac[i].inputs[inp].id, reac[i].name);
tmpPrc = {
"id": reac[i].inputs[inp].id,
"buy": getSimplePrice(calc, reac[i].inputs[inp].id).buy / 2,
@@ -502,6 +275,7 @@ router.get('/', function(req, res, next) {
ttmp = {
"id": reac[i].id,
"name": reac[i].name,
+ "type": reac[i].type,
"chain": "yes",
"inputs": tempin,
"output": tempout
@@ -513,135 +287,190 @@ router.get('/', function(req, res, next) {
//console.log(calc);
//END build new BP array with prices
//START build array with total input cost, output cost & profits
- let prof = [];
+ let sprof = [];
+ let cprof = [];
+ let chprof = [];
var temp = {};
for (let i = 0; i < calc.length; i++) {
let rin = calc[i].inputs;
let rout = calc[i].output;
let tisell = 0;
let tibuy = 0;
- var indexTax = rout.sell * costIndex;
+ var indexTax = 0;
+ //calc chain indextax
+ if (calc[i].chain === "yes") {
+ indexTax += getChainTax(sprof, reac, calc[i].id);
+ }
+ indexTax += rout.buy * costIndex;
+ //calc build tax based on cost index
+ var buildTax = indexTax * (indyTax / 100);
+ //total tax
+ var ttax = indexTax + buildTax;
+ //calc total input prices
for (let ii = 0; ii < rin.length; ii++) {
- tisell += rin[ii].sell;
- tibuy += rin[ii].buy;
+ tisell += rin[ii].sell * bonus.mat;
+ tibuy += rin[ii].buy * bonus.mat;
}
if (imeth === "buy" && ometh === "sell") {
temp = {
"id": calc[i].id,
"name": calc[i].name,
+ "type": calc[i].type,
"chain": calc[i].chain,
- "i": numeral(tibuy * bonus.mat).format('0,0.00'),
- "tax": numeral(indexTax).format('0,0.00'),
+ "i": numeral(tibuy).format('0,0.00'),
+ "taxes": {
+ "index": indexTax,
+ "build": buildTax
+ },
+ "tax": numeral(ttax).format('0,0.00'),
"o": numeral(rout.sell).format('0,0.00'),
- "prof": numeral((rout.sell - tibuy * bonus.mat) + indexTax).format('0,0.00'),
- "per": numeral((((rout.sell - tibuy * bonus.mat) + indexTax) / rout.sell)).format('0.00%')
+ "prof": numeral(rout.sell - (tibuy + ttax)).format('0,0.00'),
+ "per": numeral(((rout.sell - (tibuy + ttax)) / rout.sell)).format('0.00%')
}
- if (((rout.sell - tibuy * bonus.mat) / rout.sell) > 0) {
+ if (((rout.sell - tibuy) / rout.sell) > 0) {
temp.pos = true;
- } else if (((rout.sell - tibuy * bonus.mat) / rout.sell) < 0) {
+ } else if (((rout.sell - tibuy) / rout.sell) < 0) {
temp.neg = true;
}
} else if (imeth === "buy" && ometh === "buy") {
temp = {
"id": calc[i].id,
"name": calc[i].name,
+ "type": calc[i].type,
"chain": calc[i].chain,
- "i": numeral(tibuy * bonus.mat).format('0,0.00'),
- "tax": numeral(indexTax).format('0,0.00'),
+ "i": numeral(tibuy).format('0,0.00'),
+ "taxes": {
+ "index": indexTax,
+ "build": buildTax
+ },
+ "tax": numeral(ttax).format('0,0.00'),
"o": numeral(rout.buy).format('0,0.00'),
- "prof": numeral((rout.buy - tibuy * bonus.mat) + indexTax).format('0,0.00'),
- "per": numeral((((rout.buy - tibuy * bonus.mat) + indexTax) / rout.buy)).format('0.00%')
+ "prof": numeral(rout.buy - (tibuy + ttax)).format('0,0.00'),
+ "per": numeral(((rout.buy - (tibuy + ttax)) / rout.buy)).format('0.00%')
}
- if (((rout.buy - tibuy * bonus.mat) / rout.buy) > 0) {
+ if (((rout.buy - tibuy) / rout.buy) > 0) {
temp.pos = true;
- } else if (((rout.buy - tibuy * bonus.mat) / rout.buy) < 0) {
+ } else if (((rout.buy - tibuy) / rout.buy) < 0) {
temp.neg = true;
}
} else if (imeth === "sell" && ometh === "sell") {
temp = {
"id": calc[i].id,
"name": calc[i].name,
+ "type": calc[i].type,
"chain": calc[i].chain,
- "i": numeral(tisell * bonus.mat).format('0,0.00'),
- "tax": numeral(indexTax).format('0,0.00'),
+ "i": numeral(tisell).format('0,0.00'),
+ "taxes": {
+ "index": indexTax,
+ "build": buildTax
+ },
+ "tax": numeral(ttax).format('0,0.00'),
"o": numeral(rout.sell).format('0,0.00'),
- "prof": numeral((rout.sell - tisell * bonus.mat) + indexTax).format('0,0.00'),
- "per": numeral((((rout.sell - tisell * bonus.mat) + indexTax) / rout.sell)).format('0.00%')
+ "prof": numeral(rout.sell - (tisell + ttax)).format('0,0.00'),
+ "per": numeral(((rout.sell - (tisell + ttax)) / rout.sell)).format('0.00%')
}
- if (((rout.sell - tisell * bonus.mat) / rout.sell) > 0) {
+ if (((rout.sell - tisell) / rout.sell) > 0) {
temp.pos = true;
- } else if (((rout.sell - tisell * bonus.mat) / rout.sell) < 0) {
+ } else if (((rout.sell - tisell) / rout.sell) < 0) {
temp.neg = true;
}
} else if (imeth === "sell" && ometh === "buy") {
temp = {
"id": calc[i].id,
"name": calc[i].name,
+ "type": calc[i].type,
"chain": calc[i].chain,
- "i": numeral(tisell * bonus.mat).format('0,0.00'),
- "tax": numeral(indexTax).format('0,0.00'),
+ "i": numeral(tisell).format('0,0.00'),
+ "taxes": {
+ "index": indexTax,
+ "build": buildTax
+ },
+ "tax": numeral(ttax).format('0,0.00'),
"o": numeral(rout.buy).format('0,0.00'),
- "prof": numeral((rout.buy - tisell * bonus.mat) + indexTax).format('0,0.00'),
- "per": numeral((((rout.buy - tisell * bonus.mat) + indexTax) / rout.buy)).format('0.00%')
+ "prof": numeral(rout.buy - (tisell + ttax)).format('0,0.00'),
+ "per": numeral(((rout.buy - (tisell + ttax)) / rout.buy)).format('0.00%')
}
- if (((rout.buy - tisell * bonus.mat) / rout.buy) > 0) {
+ if (((rout.buy - tisell) / rout.buy) > 0) {
temp.pos = true;
- } else if (((rout.buy - tisell * bonus.mat) / rout.buy) < 0) {
+ } else if (((rout.buy - tisell) / rout.buy) < 0) {
temp.neg = true;
}
} else if (ometh === "buy") {
temp = {
"id": calc[i].id,
"name": calc[i].name,
+ "type": calc[i].type,
"chain": calc[i].chain,
- "i": numeral(tibuy * bonus.mat).format('0,0.00'),
- "tax": numeral(indexTax).format('0,0.00'),
+ "i": numeral(tibuy).format('0,0.00'),
+ "taxes": {
+ "index": indexTax,
+ "build": buildTax
+ },
+ "tax": numeral(ttax).format('0,0.00'),
"o": numeral(rout.buy).format('0,0.00'),
- "prof": numeral((rout.buy - tibuy * bonus.mat) + indexTax).format('0,0.00'),
- "per": numeral((((rout.buy - tibuy * bonus.mat) + indexTax) / rout.buy)).format('0.00%')
+ "prof": numeral(rout.buy - (tibuy + ttax)).format('0,0.00'),
+ "per": numeral(((rout.buy - (tibuy + ttax)) / rout.buy)).format('0.00%')
}
- if (((rout.buy - tibuy * bonus.mat) / rout.buy) > 0) {
+ if (((rout.buy - tibuy) / rout.buy) > 0) {
temp.pos = true;
- } else if (((rout.buy - tibuy * bonus.mat) / rout.buy) < 0) {
+ } else if (((rout.buy - tibuy) / rout.buy) < 0) {
temp.neg = true;
}
} else if (imeth === "sell") {
temp = {
"id": calc[i].id,
"name": calc[i].name,
+ "type": calc[i].type,
"chain": calc[i].chain,
- "i": numeral(tisell * bonus.mat).format('0,0.00'),
- "tax": numeral(indexTax).format('0,0.00'),
+ "i": numeral(tisell).format('0,0.00'),
+ "taxes": {
+ "index": indexTax,
+ "build": buildTax
+ },
+ "tax": numeral(ttax).format('0,0.00'),
"o": numeral(rout.sell).format('0,0.00'),
- "prof": numeral((rout.sell - tisell * bonus.mat) + indexTax).format('0,0.00'),
- "per": numeral((((rout.sell - tisell * bonus.mat) + indexTax) / rout.sell)).format('0.00%')
+ "prof": numeral(rout.sell - (tisell + ttax)).format('0,0.00'),
+ "per": numeral(((rout.sell - (tisell + ttax)) / rout.sell)).format('0.00%')
}
- if (((rout.sell - tisell * bonus.mat) / rout.sell) > 0) {
+ if (((rout.sell - tisell) / rout.sell) > 0) {
temp.pos = true;
- } else if (((rout.sell - tisell * bonus.mat) / rout.sell) < 0) {
+ } else if (((rout.sell - tisell) / rout.sell) < 0) {
temp.neg = true;
}
} else { //default I BUY / S SELL
temp = {
"id": calc[i].id,
"name": calc[i].name,
+ "type": calc[i].type,
"chain": calc[i].chain,
- "i": numeral(tibuy * bonus.mat).format('0,0.00'),
- "tax": numeral(indexTax).format('0,0.00'),
+ "i": numeral(tibuy).format('0,0.00'),
+ "taxes": {
+ "index": indexTax,
+ "build": buildTax
+ },
+ "tax": numeral(ttax).format('0,0.00'),
"o": numeral(rout.sell).format('0,0.00'),
- "prof": numeral((rout.sell - tibuy * bonus.mat) + indexTax).format('0,0.00'),
- "per": numeral((((rout.sell - tibuy * bonus.mat) + indexTax) / rout.sell)).format('0.00%')
+ "prof": numeral(rout.sell - (tibuy + ttax)).format('0,0.00'),
+ "per": numeral(((rout.sell - (tibuy + ttax)) / rout.sell)).format('0.00%')
}
- if (((rout.sell - tibuy * bonus.mat) / rout.sell) > 0) {
+ if (((rout.sell - tibuy) / rout.sell) > 0) {
temp.pos = true;
- } else if (((rout.sell - tibuy * bonus.mat) / rout.sell) < 0) {
+ } else if (((rout.sell - tibuy) / rout.sell) < 0) {
temp.neg = true;
}
}
- prof.push(temp);
+ if (temp.type === "simple") {
+ sprof.push(temp);
+ } else {
+ if (temp.chain === "yes") {
+ chprof.push(temp);
+ } else {
+ cprof.push(temp);
+ }
+ }
}
//END build array with total input cost, output cost & profits
- res.render('comp', { title: 'Composite Reactions', comp: true, table: prof });
+ res.render('comp', { title: 'Composite Reactions', comp: true, stable: sprof, ctable: cprof, chtable: chprof, sett: ck });
});
});
diff --git a/routes/index.js b/routes/index.js
index f60d0a4..49a8d4c 100644
--- a/routes/index.js
+++ b/routes/index.js
@@ -3,7 +3,19 @@ var router = express.Router();
/* GET home page. */
router.get('/', function(req, res, next) {
- res.render('index', { title: 'EVE Reactions Calculator', root: true});
+ //set cookies if not found
+ var ck = req.cookies;
+ if (!ck.input) { res.cookie('input', 'buy'); var imeth = "buy"; }
+ if (!ck.output) { res.cookie('output', 'sell'); var ometh = "sell"; }
+ if (!ck.skill) { res.cookie('skill', 5); var skill = 5; }
+ if (!ck.facility) { res.cookie('facility', 'large'); var facility = "large"; }
+ if (!ck.rig) { res.cookie('rig', 1); var rig = 1; var rige = true; }
+ if (!ck.space) { res.cookie('space', 'null'); var space = "null"; }
+ if (!ck.indyTax) { res.cookie('indyTax', 0); var indyTax = 0; }
+ if (!ck.duration) { res.cookie('duration', 10080); var duration = 10080; }
+ if (!ck.system) { res.cookie('system', 'Basgerin'); var syst = "Basgerin" }
+ //reply
+ res.render('index', { title: 'EVE Reactions Calculator', root: true });
});
-module.exports = router;
+module.exports = router;
\ No newline at end of file
diff --git a/routes/set.js b/routes/set.js
new file mode 100644
index 0000000..ea6ba38
--- /dev/null
+++ b/routes/set.js
@@ -0,0 +1,64 @@
+var express = require('express');
+var router = express.Router();
+
+/* GET settings page. */
+router.get('/', function(req, res, next) {
+ var ck = req.cookies;
+ //reply
+ res.render('set', { title: 'Settings', set: true, sett: ck });
+});
+
+router.get('/set', function(req, res, next) {
+
+ let ck = req.query;
+
+ if (ck.input.toLowerCase() === "buy" || ck.input.toLowerCase() === "sell") {
+ res.cookie('input', ck.input.toLowerCase());
+ } else {
+ res.cookie('input', 'buy');
+ }
+ if (ck.output.toLowerCase() === "buy" || ck.output.toLowerCase() === "sell") {
+ res.cookie('output', ck.output.toLowerCase());
+ } else {
+ res.cookie('output', 'sell');
+ }
+ if (parseInt(ck.skill) >= 0 && parseInt(ck.skill) <= 5) {
+ res.cookie('skill', parseInt(ck.skill));
+ } else {
+ res.cookie('skill', 5);
+ }
+ if (ck.facility.toLowerCase() === "med" || ck.facility.toLowerCase() === "large") {
+ res.cookie('facility', ck.facility.toLowerCase());
+ } else {
+ res.cookie('facility', 'large');
+ }
+ if (parseInt(ck.rig) >= 0 && parseInt(ck.rig) <= 2) {
+ res.cookie('rig', parseInt(ck.rig));
+ } else {
+ res.cookie('rig', 1);
+ }
+ if (ck.space.toLowerCase() === "low" || ck.space.toLowerCase() === "null") {
+ res.cookie('space', ck.space.toLowerCase());
+ } else {
+ res.cookie('space', 'null');
+ }
+ if (parseFloat(ck.indyTax) >= 0 && parseFloat(ck.indyTax) <= 50) {
+ res.cookie('indyTax', parseFloat(ck.indyTax));
+ } else {
+ res.cookie('indyTax', 0);
+ }
+ if (parseInt(ck.duration) >= 1 && parseInt(ck.duration) <= 43200) {
+ res.cookie('duration', parseInt(ck.duration));
+ } else {
+ res.cookie('duration', 10080);
+ }
+ if (ck.system) {
+ res.cookie('system', ck.system);
+ }
+
+ //reply
+ res.redirect(302, '/settings');
+ res.end();
+});
+
+module.exports = router;
\ No newline at end of file
diff --git a/routes/users.js b/routes/users.js
deleted file mode 100644
index 623e430..0000000
--- a/routes/users.js
+++ /dev/null
@@ -1,9 +0,0 @@
-var express = require('express');
-var router = express.Router();
-
-/* GET users listing. */
-router.get('/', function(req, res, next) {
- res.send('respond with a resource');
-});
-
-module.exports = router;
diff --git a/views/comp.hbs b/views/comp.hbs
index d5a025b..81bbc31 100644
--- a/views/comp.hbs
+++ b/views/comp.hbs
@@ -1,27 +1,104 @@
-
-
+
+
- Reaction |
- Chain ? |
- Inputs |
- Tax |
- Output |
- Profit |
- % prof |
+ In Method |
+ Out Method |
+ Reactions |
+ Facility |
+ Rig |
+ Space |
+ System |
+ IndyTax |
+ Build Time |
- {{#table}}
+
+ {{sett.input}} |
+ {{sett.output}} |
+ Level {{sett.skill}} |
+ {{sett.facility}} Refinery |
+ T{{sett.rig}} Rig |
+ {{sett.space}}sec |
+ {{sett.system}} |
+ {{sett.indyTax}} |
+ {{sett.duration}} Minutes |
+
+
+
+
+
+
+
+
+ Simple Reactions |
+
+
+ Reaction |
+ Inputs |
+ Tax |
+ Output |
+ Profit |
+ % prof |
+
+ {{#stable}}
{{name}} |
- {{chain}} |
- {{i}} |
- {{tax}} |
- {{o}} |
- {{prof}} |
+ {{i}} ISK |
+ {{tax}} ISK |
+ {{o}} ISK |
+ {{prof}} ISK |
{{per}} |
- {{/table}}
+ {{/stable}}
+
+ |
+
+
+ Complex Reactions |
+
+
+ Reaction |
+ Inputs |
+ Tax |
+ Output |
+ Profit |
+ % prof |
+
+ {{#ctable}}
+
+ {{name}} |
+ {{i}} ISK |
+ {{tax}} ISK |
+ {{o}} ISK |
+ {{prof}} ISK |
+ {{per}} |
+
+ {{/ctable}}
+
+ |
+
+
+ Complex Chain Reactions |
+
+
+ Reaction |
+ Inputs |
+ Tax |
+ Output |
+ Profit |
+ % prof |
+
+ {{#chtable}}
+
+ {{name}} |
+ {{i}} ISK |
+ {{tax}} ISK |
+ {{o}} ISK |
+ {{prof}} ISK |
+ {{per}} |
+
+ {{/chtable}}
diff --git a/views/layout.hbs b/views/layout.hbs
index 8e38848..5b241eb 100644
--- a/views/layout.hbs
+++ b/views/layout.hbs
@@ -1,6 +1,15 @@
+
+
+
@@ -12,6 +21,7 @@
+