diff --git a/apps/admin.js b/apps/admin.js index fe395e40..8cfa3429 100644 --- a/apps/admin.js +++ b/apps/admin.js @@ -71,6 +71,8 @@ async function sysCfg (e) { let cfgSchema = cfgSchemaMap[regRet[1]] if (cfgSchema.input) { val = cfgSchema.input(val) + } else if (cfgSchema.type === 'str') { + val = (val || cfgSchema.def) + '' } else { val = cfgSchema.type === 'num' ? (val * 1 || cfgSchema.def) : !/关闭/.test(val) } diff --git a/apps/wiki/Calendar.js b/apps/wiki/Calendar.js index c9b84cb3..abc3e758 100644 --- a/apps/wiki/Calendar.js +++ b/apps/wiki/Calendar.js @@ -218,11 +218,11 @@ let Cal = { // 遍历角色数据 Character.forEach((char) => { if (charBirth[char.birth] && (char.isRelease || char.birth !== '1-1')) { - charBirth[char.birth].push(char.getData('id,name:sName,star,face')) + charBirth[char.birth].push(char.getData('id,name:abbr,star,face')) } let t = char.materials?.talent if (t && charTalent[t] && !char.isTraveler) { - let data = char.getData('id,name:sName,star,face') + let data = char.getData('id,name:abbr,star,face') data.weekly = char.getMaterials('weekly')?.icon charTalent[t].chars.push(data) } diff --git a/components/cfg/CfgData.js b/components/cfg/CfgData.js index a5dbd2e6..41ce9eab 100644 --- a/components/cfg/CfgData.js +++ b/components/cfg/CfgData.js @@ -14,7 +14,11 @@ let cfgData = { if (cfgItem.input) { val = cfgItem.input(val) } - ret.push(`export const ${cfgKey} = ${val.toString()}`, '') + if (cfgItem.type === 'str') { + ret.push(`export const ${cfgKey} = '${val.toString()}'`, '') + } else { + ret.push(`export const ${cfgKey} = ${val.toString()}`, '') + } }) }) fs.writeFileSync(`${process.cwd()}/plugins/miao-plugin/config/cfg.js`, ret.join('\n'), 'utf8') diff --git a/config/system/cfg_system.js b/config/system/cfg_system.js index b9250a8a..c28769b7 100644 --- a/config/system/cfg_system.js +++ b/config/system/cfg_system.js @@ -82,17 +82,17 @@ export const cfgSchema = { profileServer: { title: '面板服务', key: '面板服务', - type: 'num', - def: 0, - input: (n) => /[0-4]{1,3}/.test(n) ? n : 0, + def: '0', + type: 'str', + input: (n) => /[0-4]{1,3}/.test(n) ? n : '0', desc: '面板服务选择:0:自动,1:喵Api(需具备Token), 2:Enka-API, 3:MiniGG-Api, 4:Hutao-Enka代理。如设置三位数字则为分服务器设置,按顺序分别为 国服/B服/外服,例如112代表国服B服Miao,国外Enka' }, srProfileServer: { title: '星铁面板服务', key: '星铁面板服务', - type: 'num', - def: 0, - input: (n) => /[0-4]{1,3}/.test(n) ? n : 0, + def: '0', + type: 'str', + input: (n) => /[0-4]{1,3}/.test(n) ? n : '0', desc: '星铁面板服务选择:0:自动,1:喵Api(需具备Token), 2:Mihomo, 3:Avocado(鳄梨), 4:EnkaHSR。如设置三位数字则为分服务器设置,按顺序分别为 国服/B服/外服,例如114代表国服B服Miao,国外Enka' }, costumeSplash: { diff --git a/models/Character.js b/models/Character.js index e3457984..b8095864 100644 --- a/models/Character.js +++ b/models/Character.js @@ -69,7 +69,6 @@ class Character extends Base { } _get (key) { - if (metaKey.includes(key)) { return this.meta[key] } @@ -181,6 +180,11 @@ class Character extends Base { return new Character(id) } + static sample (game = 'gs') { + let id = CharId.getRandomId(game) + return Character.get(id) + } + static forEach (fn, type = 'all', game = 'gs') { let ids = Meta.getIds(game, 'char') lodash.forEach(ids, (id) => { diff --git a/models/ProfileDmg.js b/models/ProfileDmg.js index ce2916b4..4fa85e51 100644 --- a/models/ProfileDmg.js +++ b/models/ProfileDmg.js @@ -134,7 +134,7 @@ export default class ProfileDmg extends Base { trees: this.trees() } - let { id, weapon, attr } = profile + let { id, weapon, attr, artis } = profile defParams = defParams || {} @@ -142,7 +142,7 @@ export default class ProfileDmg extends Base { buffs = this.getBuffs(buffs) - let { msg } = DmgAttr.calcAttr({ originalAttr, buffs, meta, params: defParams || {}, game }) + let { msg } = DmgAttr.calcAttr({ originalAttr, buffs, artis, meta, params: defParams || {}, game }) let msgList = [] let ret = [] @@ -172,22 +172,24 @@ export default class ProfileDmg extends Base { } if (lodash.isFunction(detail)) { - let { attr } = DmgAttr.calcAttr({ originalAttr, buffs, meta }) + let { attr } = DmgAttr.calcAttr({ originalAttr, artis, buffs, meta }) let ds = lodash.merge({ talent }, DmgAttr.getDs(attr, meta)) detail = detail({ ...ds, attr, profile }) } let params = lodash.merge({}, defParams, detail?.params || {}) - let { attr, msg } = DmgAttr.calcAttr({ originalAttr, buffs, meta, params, talent: detail.talent || '', game }) + let { attr, msg } = DmgAttr.calcAttr({ originalAttr, buffs, artis, meta, params, talent: detail.talent || '', game }) if (detail.isStatic) { return } - if (detail.check && !detail.check(DmgAttr.getDs(attr, meta, params))) { + + let ds = lodash.merge({ talent }, DmgAttr.getDs(attr, meta, params)) + ds.artis = artis + if (detail.check && !detail.check(ds)) { return } if (detail.cons && meta.cons < detail.cons * 1) { return } - let ds = lodash.merge({ talent }, DmgAttr.getDs(attr, meta, params)) let dmg = DmgCalc.getDmgFn({ ds, attr, level: profile.level, enemyLv, showDetail: detail.showDetail, game }) let basicDmgRet @@ -218,7 +220,7 @@ export default class ProfileDmg extends Base { } if (lodash.isFunction(detail)) { - let { attr } = DmgAttr.calcAttr({ originalAttr, buffs, meta }) + let { attr } = DmgAttr.calcAttr({ originalAttr, buffs, artis, meta }) let ds = lodash.merge({ talent }, DmgAttr.getDs(attr, meta)) detail = detail({ ...ds, attr, profile }) } @@ -246,6 +248,7 @@ export default class ProfileDmg extends Base { let { attr } = DmgAttr.calcAttr({ originalAttr, buffs, + artis, meta, params, incAttr, diff --git a/models/character/CharId.js b/models/character/CharId.js index 384423fa..842fc56e 100644 --- a/models/character/CharId.js +++ b/models/character/CharId.js @@ -64,6 +64,15 @@ const CharId = { return false }, + getRandomId (game = 'gs') { + let meta = Meta.create(game, 'char') + let ids = meta.getIds() + if (game === 'gs') { + ids = lodash.filter(ids, (id) => /^\d+$/.test(id)) + } + return lodash.sample(ids) + }, + isTraveler (id) { if (id) { return [10000007, 10000005, 20000000].includes(id * 1) diff --git a/models/dmg/DmgAttr.js b/models/dmg/DmgAttr.js index 70b9366c..c4bb24d6 100644 --- a/models/dmg/DmgAttr.js +++ b/models/dmg/DmgAttr.js @@ -117,7 +117,7 @@ let DmgAttr = { }, // 计算属性 - calcAttr ({ originalAttr, buffs, meta, params = {}, incAttr = '', reduceAttr = '', talent = '', game = 'gs' }) { + calcAttr ({ originalAttr, buffs, meta, artis, params = {}, incAttr = '', reduceAttr = '', talent = '', game = 'gs' }) { let attr = DmgAttr.getAttr({ originalAttr, game }) let msg = [] let { attrMap } = Meta.getMeta(game, 'arti') @@ -135,6 +135,7 @@ let DmgAttr = { let ds = DmgAttr.getDs(attr, meta, params) ds.currentTalent = talent + ds.artis = artis if (buff.isStatic) { return diff --git a/resources/admin/index.html b/resources/admin/index.html index 21cfa456..cc0d931e 100644 --- a/resources/admin/index.html +++ b/resources/admin/index.html @@ -23,7 +23,7 @@ {{if cfgItem.type==='num'}} {{cfgItem.def}}{{else}} 开启/关闭{{/if}} {{/if}} - {{if cfgItem.type === 'num'}} + {{if cfgItem.type === 'num' || cfgItem.type === 'str'}}
{{cfg[cfgKey]}}
{{else}} {{if cfg[cfgKey] || (cfgItem.miao && isMiao)}} @@ -58,4 +58,4 @@ -{{/block}} \ No newline at end of file +{{/block}} diff --git a/resources/meta-gs/character/alias.js b/resources/meta-gs/character/alias.js index 73b0d697..daaee8f8 100644 --- a/resources/meta-gs/character/alias.js +++ b/resources/meta-gs/character/alias.js @@ -81,7 +81,7 @@ export const alias = { 菲米尼: 'Freminet,非米尼,潜水员', 莱欧斯利: 'Wriothesley,莱欧,枫丹桑博,公爵', 那维莱特: 'Neuvillette,那维,水龙王,水龙,审判官,海獭,龙王,最高审判官,水之龙王', - 夏洛蒂: 'Charlotte,夏洛,夏洛帝,记者,小记者', + 夏洛蒂: 'Charlotte,夏洛,夏洛帝,记者,小记者,佳能400D,400D', 芙宁娜: 'Furina,Focalors,水神,芙芙,芙卡洛斯,傻芙芙', 娜维娅: 'navia,大小姐,刺玫会,黄豆,流汗黄豆,黄豆姐', 夏沃蕾: 'chevreuse,夏沃雷', diff --git a/resources/wiki/calendar.css b/resources/wiki/calendar.css index 186eda8e..9332e394 100644 --- a/resources/wiki/calendar.css +++ b/resources/wiki/calendar.css @@ -292,7 +292,7 @@ body { } .cal-abyss-cont .cal-item { border-radius: 0; - background: url("imgs/abyss.jpg") #333465 top right no-repeat; + background: url("./imgs/abyss.jpg") #333465 top right no-repeat; position: absolute; } .cal-abyss-cont .cal-item .info { @@ -450,3 +450,4 @@ body { .daily-talent .card .banner.city-5 .line { background: #557dd6; } +/*# sourceMappingURL=calendar.css.map */ \ No newline at end of file diff --git a/resources/wiki/character-talent.html b/resources/wiki/character-talent.html index d16fccbe..0c91f6ad 100644 --- a/resources/wiki/character-talent.html +++ b/resources/wiki/character-talent.html @@ -28,7 +28,7 @@ {{ if line[0]?.num !== 'NaN'}}
-
90级基础数据
+
{{game === 'gs' ? '90' : '80'}}级基础数据
{{each line item}}
diff --git a/resources/wiki/character-wiki.css b/resources/wiki/character-wiki.css index 3c179540..c766a0e6 100644 --- a/resources/wiki/character-wiki.css +++ b/resources/wiki/character-wiki.css @@ -34,6 +34,10 @@ body { .char-meta { padding-left: 370px; } +.wiki-cont { + padding: 0 10px; + margin-right: 5px; +} .detail { right: 18px; } diff --git a/resources/wiki/character-wiki.html b/resources/wiki/character-wiki.html index f6ec8547..371323ee 100644 --- a/resources/wiki/character-wiki.html +++ b/resources/wiki/character-wiki.html @@ -55,75 +55,76 @@
-{{if holding.num}} -{{set cNum ='零一二三四五满'.split('')}} -
-
-
- {{holding.num}} -
角色持有率
-
-
- {{each holding.cons cons}} -
-
- {{if cons.cons > 0}} -
- {{else}} -
- {{/if}} -
-
{{cons.num}}
-
{{cNum[cons.cons]}}命
+
+ {{if holding.num}} + {{set cNum ='零一二三四五满'.split('')}} +
+
+
+ {{holding.num}} +
角色持有率
+
+ {{each holding.cons cons}} +
+
+ {{if cons.cons > 0}} +
+ {{else}} +
+ {{/if}} +
+
{{cons.num}}
+
{{cNum[cons.cons]}}命
+
+ {{/each}} +
+
+
+ {{/if}} + +
输入#{{data.abbr}}天赋、#{{data.abbr}}命座可查看详细天赋/命座信息
+ {{set weapons = usage.weapons || [] }} + {{if weapons.length >0}} +
+
常用武器
+
+ {{each weapons weapon idx}} + {{if idx < 7}} +
+
+
+
+
{{weapon.value}}
+
{{weapon.abbr}}
+
+ {{/if}} {{/each}}
-
-{{/if}} - -
输入#{{data.abbr}}天赋、#{{data.abbr}}命座可查看详细天赋/命座信息
-{{set weapons = usage.weapons || [] }} -{{if weapons.length >0}} -
-
常用武器
-
- {{each weapons weapon idx}} - {{if idx <7}} -
-
-
+ {{/if}} + {{set artis = usage.artis || [] }} + {{if artis.length >0}} +
+
常用圣遗物持有率、武器、圣遗物统计来自胡桃API,未经允许请勿使用此数据
+
+ {{each artis arti idx}} + {{if idx < 7}} +
+
+ {{each arti.imgs img idx}} +
+ {{/each}} +
+
{{arti.value}}
+
{{arti.title}}
-
{{weapon.value}}
-
{{weapon.abbr}}
+ {{/if}} + {{/each}}
- {{/if}} - {{/each}}
+
+ {{/if}}
-{{/if}} -{{set artis = usage.artis || [] }} -{{if artis.length >0}} -
-
常用圣遗物持有率、武器、圣遗物统计来自胡桃API,未经允许请勿使用此数据
-
- {{each artis arti idx}} - {{if idx <7}} -
-
- {{each arti.imgs img idx}} -
- {{/each}} -
-
{{arti.value}}
-
{{arti.title}}
-
- {{/if}} - {{/each}} -
-
-
-{{/if}} - -{{/block}} \ No newline at end of file +{{/block}} diff --git a/resources/wiki/character-wiki.less b/resources/wiki/character-wiki.less index dc2ad3a3..8ffc04f6 100644 --- a/resources/wiki/character-wiki.less +++ b/resources/wiki/character-wiki.less @@ -51,6 +51,11 @@ body { } } +.wiki-cont { + padding: 0 10px; + margin-right: 5px; +} + .detail { right: 18px; @@ -282,4 +287,4 @@ body { } } } -} \ No newline at end of file +}