// ==UserScript==
// @name E7FlatStat
// @namespace https://us.kss.su/
// @version 1.3
// @description flat stat info
// @author vrnehot@ya.ru
// @downloadURL https://us.kss.su/epic7x.com/flatstat.user.js
// @updateURL https://us.kss.su/epic7x.com/flatstat.meta.js
// @icon https://us.kss.su/epic7x.com/flatstat.png
// @match https://epic7x.com/character/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const stats = document.getElementById('Stats');
const baseStats = stats.querySelector('.pure-g .pure-u-1:first-child .stats-table');
const awStats = stats.querySelector('.pure-g .pure-u-1:nth-child(2) .stats-table');
const charStats = {
base: getStats(baseStats),
aw: getStats(awStats)
};
const el = document.createElement('div');
el.id = 'ehot-flat-stats';
stats.insertAdjacentElement('beforeend', el);
new Vue({
el: '#ehot-flat-stats',
template: `
Items Flat Stats
Item Level |
Atk |
HP |
Def |
{{ item.substr(1) }} |
{{ row.a.value }} |
{{ row.h.value }} |
{{ row.d.value }} |
`,
data: {
flat: {
l55: {
a: 330,
h: 1760,
d: 190
},
l70: {
a: 440,
h: 2360,
d: 260
},
l85: {
a: 500,
h: 2700,
d: 300
},
l88: {
a: 515,
h: 2765,
d: 310
}
},
perc: {
l55: 0.4,
l70: 0.5,
l85: 0.6,
l88: 0.65
},
levels: ['l50', 'l60'],
char: charStats,
level: 'l60',
aw: true
},
computed: {
base: function(){
return this.aw ? this.char.aw : this.char.base
},
table: function(){
let res = {};
for(let item in this.perc){
let p = this.perc[item];
let a = this.flat[item].a - parseInt(this.base[this.level].a * p);
let h = this.flat[item].h - parseInt(this.base[this.level].h * p);
let d = this.flat[item].d - parseInt(this.base[this.level].d * p);
res[item] = {
a: {value: a, style: this.getStyle(a, 30)},
h: {value: h, style: this.getStyle(h, 150)},
d: {value: d, style: this.getStyle(d, 20)}
}
}
return res
}
},
methods: {
getStyle(diff, delta){
let style = '';
if(diff > 0){
style = 'font-weight: 900';
}
else if(diff < -delta){
style = 'opacity: 0.5; font-size: 0.9em';
}
else{
style = 'opacity: 0.9; font-size: 0.9em';
}
return style;
}
}
});
function getStats(table){
const s50 = table.querySelector('tbody tr:nth-last-of-type(2)');
const s60 = table.querySelector('tbody tr:nth-last-of-type(1)');
return {
l50: {
a: +s50.querySelector('td:nth-child(4)').innerHTML,
h: +s50.querySelector('td:nth-child(5)').innerHTML,
d: +s50.querySelector('td:nth-child(6)').innerHTML
},
l60: {
a: +s60.querySelector('td:nth-child(4)').innerHTML,
h: +s60.querySelector('td:nth-child(5)').innerHTML,
d: +s60.querySelector('td:nth-child(6)').innerHTML
}
};
}
})();