v1.0 Public

- It's done!
This commit is contained in:
José Valdiviesso 2017-11-16 19:51:27 +00:00
parent c6e8cd3fd1
commit 7d8780270b
11 changed files with 1398 additions and 445 deletions

10
app.js
View File

@ -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) {

View File

@ -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
}
}
]
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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 });
});
});

View File

@ -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;

64
routes/set.js Normal file
View File

@ -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;

View File

@ -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;

View File

@ -1,27 +1,104 @@
<div class="container">
<div class="row mt-5">
<table class="table">
<div class="row mt-4">
<table class="table table-sm table-bordered text-center">
<thead>
<th scope="col">Reaction</th>
<th scope="col">Chain ?</th>
<th scope="col">Inputs</th>
<th scope="col">Tax</th>
<th scope="col">Output</th>
<th scope="col">Profit</th>
<th scope="col">% prof</th>
<th>In Method</th>
<th>Out Method</th>
<th>Reactions</th>
<th>Facility</th>
<th>Rig</th>
<th>Space</th>
<th>System</th>
<th>IndyTax</th>
<th>Build Time</th>
</thead>
<tbody>
{{#table}}
<tr class="">
<td>{{sett.input}}</td>
<td>{{sett.output}}</td>
<td>Level {{sett.skill}}</td>
<td>{{sett.facility}} Refinery</td>
<td>T{{sett.rig}} Rig</td>
<td>{{sett.space}}sec</td>
<td>{{sett.system}}</td>
<td>{{sett.indyTax}}</td>
<td>{{sett.duration}} Minutes</td>
</tr>
</tbody>
</table>
</div>
<div class="row mt-3">
<table class="table table-bordered text-center">
<tbody>
<tr>
<td class="bg-info text-white text-center" id="simple" colspan="7">Simple Reactions</td>
</tr>
<tr>
<th scope="col">Reaction</th>
<th scope="col">Inputs</th>
<th scope="col">Tax</th>
<th scope="col">Output</th>
<th scope="col">Profit</th>
<th scope="col">% prof</th>
</tr>
{{#stable}}
<tr class="text-white {{#if pos}}bg-success{{/if}}{{#if neg}}bg-danger{{/if}}">
<td>{{name}}</td>
<td>{{chain}}</td>
<td>{{i}}</td>
<td>{{tax}}</td>
<td>{{o}}</td>
<td>{{prof}}</td>
<td>{{i}} ISK</td>
<td>{{tax}} ISK</td>
<td>{{o}} ISK</td>
<td>{{prof}} ISK</td>
<td>{{per}}</td>
</tr>
{{/table}}
{{/stable}}
<tr>
<td class="" colspan="7"></td>
</tr>
<tr>
<td class="bg-info text-white text-center" id="complex" colspan="7">Complex Reactions</td>
</tr>
<tr>
<th scope="col">Reaction</th>
<th scope="col">Inputs</th>
<th scope="col">Tax</th>
<th scope="col">Output</th>
<th scope="col">Profit</th>
<th scope="col">% prof</th>
</tr>
{{#ctable}}
<tr class="text-white {{#if pos}}bg-success{{/if}}{{#if neg}}bg-danger{{/if}}">
<td>{{name}}</td>
<td>{{i}} ISK</td>
<td>{{tax}} ISK</td>
<td>{{o}} ISK</td>
<td>{{prof}} ISK</td>
<td>{{per}}</td>
</tr>
{{/ctable}}
<tr>
<td class="" colspan="7"></td>
</tr>
<tr>
<td class="bg-info text-white text-center" id="chain" colspan="7">Complex Chain Reactions</td>
</tr>
<tr>
<th scope="col">Reaction</th>
<th scope="col">Inputs</th>
<th scope="col">Tax</th>
<th scope="col">Output</th>
<th scope="col">Profit</th>
<th scope="col">% prof</th>
</tr>
{{#chtable}}
<tr class="text-white {{#if pos}}bg-success{{/if}}{{#if neg}}bg-danger{{/if}}">
<td>{{name}}</td>
<td>{{i}} ISK</td>
<td>{{tax}} ISK</td>
<td>{{o}} ISK</td>
<td>{{prof}} ISK</td>
<td>{{per}}</td>
</tr>
{{/chtable}}
</tbody>
</table>
</div>

View File

@ -1,6 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-109766629-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-109766629-1');
</script>
<meta charset="UTF-8">
<meta name="description" content="EVE Online Reactions profit calculator for the POST-Lifeblood era">
<meta name="keywords" content="eve,reactions,lifeblood,profit,money,isk">
@ -12,6 +21,7 @@
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
<link rel="stylesheet" href="/stylesheets/style.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
@ -36,6 +46,9 @@
<li class="nav-item {{#if hyb}}active{{/if}}">
<a class="nav-link" href="/hybrid">Hybrid</a>
</li>
<li class="nav-item {{#if set}}active{{/if}}">
<a class="nav-link" href="/settings">Settings</a>
</li>
</ul>
</div>
</div>

188
views/set.hbs Normal file
View File

@ -0,0 +1,188 @@
<div class="container">
<div class="row mt-4">
<div class="col-lg-8">
<h4 class="">New Settings:</h3>
<form class="mt-4" action="/settings/set" method="get">
<div class="form-group row">
<label class="col-4">Input Method</label>
<div class="col-8">
<label class="custom-control custom-radio">
<input name="input" type="radio" class="custom-control-input" value="sell" aria-describedby="inputHelpBlock" required="required" {{#ifCond sett.input 'sell'}}checked{{/ifCond}}>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Sell order</span>
</label>
<label class="custom-control custom-radio">
<input name="input" type="radio" class="custom-control-input" value="buy" aria-describedby="inputHelpBlock" required="required" {{#ifCond sett.input 'buy'}}checked{{/ifCond}}>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Buy order</span>
</label>
<span id="inputHelpBlock" class="form-text text-muted">How you are getting your input materials</span>
</div>
</div>
<div class="form-group row">
<label class="col-4">Output Method</label>
<div class="col-8">
<label class="custom-control custom-radio">
<input name="output" type="radio" class="custom-control-input" value="sell" aria-describedby="outputHelpBlock" required="required" {{#ifCond sett.output 'sell'}}checked{{/ifCond}}>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Sell order</span>
</label>
<label class="custom-control custom-radio">
<input name="output" type="radio" class="custom-control-input" value="buy" aria-describedby="outputHelpBlock" required="required" {{#ifCond sett.output 'buy'}}checked{{/ifCond}}>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Buy order</span>
</label>
<span id="outputHelpBlock" class="form-text text-muted">How you are selling your output materials</span>
</div>
</div>
<div class="form-group row">
<label for="skill" class="col-4 col-form-label">Reactions Skill Level</label>
<div class="col-8">
<select id="skill" name="skill" class="custom-select" aria-describedby="skillHelpBlock" required="required">
<option value="0" {{#ifCond sett.skill '0'}}selected="selected"{{/ifCond}}>0</option>
<option value="1" {{#ifCond sett.skill '1'}}selected="selected"{{/ifCond}}>1</option>
<option value="2" {{#ifCond sett.skill '2'}}selected="selected"{{/ifCond}}>2</option>
<option value="3" {{#ifCond sett.skill '3'}}selected="selected"{{/ifCond}}>3</option>
<option value="4" {{#ifCond sett.skill '4'}}selected="selected"{{/ifCond}}>4</option>
<option value="5" {{#ifCond sett.skill '5'}}selected="selected"{{/ifCond}}>5</option>
</select>
<span id="skillHelpBlock" class="form-text text-muted">What is your reactions skill level at</span>
</div>
</div>
<div class="form-group row">
<label class="col-4">Facility Size</label>
<div class="col-8">
<label class="custom-control custom-radio">
<input name="facility" type="radio" class="custom-control-input" value="med" aria-describedby="facilityHelpBlock" required="required" {{#ifCond sett.facility 'med'}}checked{{/ifCond}}>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Medium</span>
</label>
<label class="custom-control custom-radio">
<input name="facility" type="radio" class="custom-control-input" value="large" aria-describedby="facilityHelpBlock" required="required" {{#ifCond sett.facility 'large'}}checked{{/ifCond}}>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Large</span>
</label>
<span id="facilityHelpBlock" class="form-text text-muted">Are you using a med or large refinery</span>
</div>
</div>
<div class="form-group row">
<label class="col-4">Rigs installed</label>
<div class="col-8">
<label class="custom-control custom-radio">
<input name="rigs" type="radio" class="custom-control-input" value="0" aria-describedby="rigsHelpBlock" required="required" {{#ifCond sett.rig '0'}}checked{{/ifCond}}>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">None</span>
</label>
<label class="custom-control custom-radio">
<input name="rigs" type="radio" class="custom-control-input" value="1" aria-describedby="rigsHelpBlock" required="required" {{#ifCond sett.rig '1'}}checked{{/ifCond}}>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Tech 1</span>
</label>
<label class="custom-control custom-radio">
<input name="rigs" type="radio" class="custom-control-input" value="2" aria-describedby="rigsHelpBlock" required="required" {{#ifCond sett.rig '2'}}checked{{/ifCond}}>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Tech 2</span>
</label>
<span id="rigsHelpBlock" class="form-text text-muted">Does your facility have any rigs for reactions?</span>
</div>
</div>
<div class="form-group row">
<label class="col-4">Type of space?</label>
<div class="col-8">
<label class="custom-control custom-radio">
<input name="space" type="radio" class="custom-control-input" value="null" aria-describedby="spaceHelpBlock" required="required" {{#ifCond sett.space 'null'}}checked{{/ifCond}}>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Nullsec</span>
</label>
<label class="custom-control custom-radio">
<input name="space" type="radio" class="custom-control-input" value="low" aria-describedby="spaceHelpBlock" required="required" {{#ifCond sett.space 'sell'}}checked{{/ifCond}}>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Lowsec</span>
</label>
<span id="spaceHelpBlock" class="form-text text-muted">Are you doing reactions in Nullsec or Lowsec?</span>
</div>
</div>
<div class="form-group row">
<label for="system" class="col-4 col-form-label">System</label>
<div class="col-8">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-home"></i>
</div>
<input id="system" name="system" placeholder="Basgerin" type="text" value="{{sett.system}}" class="form-control here" aria-describedby="systemHelpBlock" required="required">
</div>
<span id="systemHelpBlock" class="form-text text-muted">What system are you doing reactions in? used to calculate cost index</span>
</div>
</div>
<div class="form-group row">
<label for="indyTax" class="col-4 col-form-label">Industry Tax</label>
<div class="col-8">
<div class="input-group">
<input id="indyTax" name="indyTax" placeholder="0" type="number" value="{{sett.indyTax}}" class="form-control here" aria-describedby="indyTaxHelpBlock" required="required">
<div class="input-group-addon append">%</div>
</div>
<span id="indyTaxHelpBlock" class="form-text text-muted">What's your industry tax % ?</span>
</div>
</div>
<div class="form-group row">
<label for="duration" class="col-4 col-form-label">Batch build time</label>
<div class="col-8">
<div class="input-group">
<input id="duration" name="duration" placeholder="10080" type="number" value="{{sett.duration}}" class="form-control here" aria-describedby="durationHelpBlock" required="required">
<div class="input-group-addon append">Minutes</div>
</div>
<span id="durationHelpBlock" class="form-text text-muted">Time in minutes each of your jobs is going to run for</span>
</div>
</div>
<div class="form-group row">
<div class="offset-4 col-8">
<button name="submit" type="submit" class="btn btn-primary">Save Settings</button>
</div>
</div>
</form>
</div>
<div class="col-lg-4">
<h4 class="">Current Settings:</h4>
<table class="table table-sm table-bordered mt-4">
<tbody>
<tr>
<th>In Method</th>
<td>{{sett.input}}</td>
</tr>
<tr>
<th>Out Method</th>
<td>{{sett.output}}</td>
</tr>
<tr>
<th>Reactions</th>
<td>Level {{sett.skill}}</td>
</tr>
<tr>
<th>Facility</th>
<td>{{sett.facility}} Refinery</td>
</tr>
<tr>
<th>Rig</th>
<td>T{{sett.rig}} Rig</td>
</tr>
<tr>
<th>Space</th>
<td>{{sett.space}}sec</td>
</tr>
<tr>
<th>System</th>
<td>{{sett.system}}</td>
</tr>
<tr>
<th>IndyTax</th>
<td>{{sett.indyTax}}</td>
</tr>
<tr>
<th>Build Time</th>
<td>{{sett.duration}} Minutes</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>