mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-25 17:35:34 +00:00
圣遗物词条升级次数支持#圣遗物列表
圣遗物词条升级次数判定逻辑调整
This commit is contained in:
parent
98b6c8a2cc
commit
6f7909d3e3
@ -32,9 +32,27 @@ let ArtisMark = {
|
|||||||
formatArti (ds, markCfg = false, isMain = false) {
|
formatArti (ds, markCfg = false, isMain = false) {
|
||||||
if (ds[0] && ds[0].title) {
|
if (ds[0] && ds[0].title) {
|
||||||
let ret = []
|
let ret = []
|
||||||
|
let totalUpNum = 0
|
||||||
|
let ltArr = []
|
||||||
lodash.forEach(ds, (d) => {
|
lodash.forEach(ds, (d) => {
|
||||||
ret.push(ArtisMark.formatArti(d, markCfg, isMain))
|
let arti = ArtisMark.formatArti(d, markCfg, isMain)
|
||||||
|
totalUpNum += arti.upNum
|
||||||
|
if (arti.hasLt) {
|
||||||
|
ltArr.push(arti)
|
||||||
|
}
|
||||||
|
ret.push(arti)
|
||||||
|
delete arti.hasLt
|
||||||
|
delete arti.hasGt
|
||||||
})
|
})
|
||||||
|
ltArr = lodash.sortBy(ltArr, 'upNum').reverse()
|
||||||
|
for (let arti of ltArr) {
|
||||||
|
if (totalUpNum > 9) {
|
||||||
|
arti.upNum = arti.upNum - 1
|
||||||
|
totalUpNum--
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
let title = ds.title || ds[0]
|
let title = ds.title || ds[0]
|
||||||
@ -69,7 +87,10 @@ let ArtisMark = {
|
|||||||
value: val
|
value: val
|
||||||
}
|
}
|
||||||
if (!isMain) {
|
if (!isMain) {
|
||||||
ret.upNum = ArtisMark.getIncNum(title, value)
|
let incRet = ArtisMark.getIncNum(title, value)
|
||||||
|
ret.upNum = incRet.num
|
||||||
|
ret.hasGt = incRet.hasGt
|
||||||
|
ret.hasLt = incRet.hasLt
|
||||||
}
|
}
|
||||||
|
|
||||||
if (markCfg) {
|
if (markCfg) {
|
||||||
@ -85,13 +106,21 @@ let ArtisMark = {
|
|||||||
|
|
||||||
getIncNum (title, value) {
|
getIncNum (title, value) {
|
||||||
let cfg = attrNameMap[title] && attrMap[attrNameMap[title]]
|
let cfg = attrNameMap[title] && attrMap[attrNameMap[title]]
|
||||||
if (cfg && cfg.value && cfg.valueMin) {
|
if (!value || !cfg || !cfg.value || !cfg.valueMin) {
|
||||||
let min = Math.ceil((value / cfg.value).toFixed(1) * 1)
|
return { num: 0 }
|
||||||
let max = Math.floor((value / cfg.valueMin).toFixed(1) * 1)
|
}
|
||||||
let avg = Math.round(value / (cfg.value + cfg.valueMin) * 2)
|
let maxNum = Math.min(5, Math.floor((value / cfg.valueMin).toFixed(1) * 1))
|
||||||
return Math.max(min, Math.min(max, avg))
|
let minNum = Math.max(1, Math.ceil((value / cfg.value).toFixed(1) * 1))
|
||||||
|
// 相等时直接返回
|
||||||
|
if (maxNum === minNum) {
|
||||||
|
return { num: minNum }
|
||||||
|
}
|
||||||
|
let avg = Math.round(value / (cfg.value + cfg.valueMin) * 2)
|
||||||
|
return {
|
||||||
|
num: avg,
|
||||||
|
hasGt: maxNum > avg,
|
||||||
|
hasLt: minNum < avg
|
||||||
}
|
}
|
||||||
return 0
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getMarkClass (mark) {
|
getMarkClass (mark) {
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
{{each ds.attrs attr}}
|
{{each ds.attrs attr}}
|
||||||
{{if attr.title}}
|
{{if attr.title}}
|
||||||
<li class="{{ds.usefulMark[attr.title]*1 > 79.9 ?`great`:(ds.usefulMark[attr.title]*1>0 ? `useful`:`nouse`)}}">
|
<li class="{{ds.usefulMark[attr.title]*1 > 79.9 ?`great`:(ds.usefulMark[attr.title]*1>0 ? `useful`:`nouse`)}}">
|
||||||
<span class="title">{{attr.title}}</span><span
|
<span class="title"> {{if attr.upNum}}<i class="up-num up-{{attr.upNum}}"></i>{{/if}}{{attr.title}}</span>
|
||||||
class="val">+{{attr.value}}</span></li>
|
<span class="val">+{{attr.value}}</span></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user