修正一些默认值错误的问题,增加女士的角色配置

This commit is contained in:
yoimiya-kokomi 2022-07-01 02:53:05 +08:00
parent 93f7ebf450
commit 485fe9b3ac
9 changed files with 46 additions and 25 deletions

View File

@ -1,8 +1,7 @@
import { Artifact, Character } from "../../components/models.js";
import { Cfg } from "../../components/index.js";
import { Cfg, Data, Common, Profile } from "../../components/index.js";
import lodash from "lodash";
import { segment } from "oicq";
import { Common, Profile } from "../../components/index.js";
//角色昵称
let nameID = "";
@ -104,7 +103,6 @@ async function renderCard(e, avatar, render, renderType = "card") {
//获取角色技能数据
async function getTalent(e, avatars) {
let talent = {}, cons = 0, char = Character.get(avatars.id), mode = "level";
console.log('isCustom', char.isCustom, char.id);
if (char.isCustom) {
return {}
}
@ -225,9 +223,9 @@ function getCharacterData(avatars) {
return {
name: avatars.name,
showName: genshin.abbr[avatars.name] ? genshin.abbr[avatars.name] : avatars.name,
level: avatars.lv || avatars.level,
level: Data.def(avatars.lv, avatars.level),
fetter: avatars.fetter,
cons: avatars.cons || avatars.actived_constellation_num,
cons: Data.def(avatars.cons, avatars.actived_constellation_num),
weapon,
artiEffect,
reliquaries

View File

@ -186,6 +186,25 @@ let Data = {
sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
},
def() {
for (let idx in arguments) {
if (!lodash.isUndefined(arguments[idx])) {
return arguments[idx];
}
}
},
eachStr: (arr, fn) => {
if (lodash.isString(arr)) {
arr = arr.replace(/\s*(;||、|)\s*/, ",");
arr = arr.split(",");
}
lodash.forEach(arr, (str, idx) => {
if (!lodash.isUndefined(str)) {
fn(str.trim ? str.trim() : str, idx)
}
});
}
}

View File

@ -15,7 +15,7 @@ async function init() {
charCfg = await Data.importModule(`plugins/miao-plugin/config`, 'character_default.js'),
custom = await Data.importModule(`plugins/miao-plugin/config`, 'character.js');
lodash.forEach([charCfg.customCharacters, custom.customCharacters, sysCfg.roleId], (roleIds) => {
lodash.forEach([custom.customCharacters, charCfg.customCharacters, sysCfg.roleId], (roleIds) => {
lodash.forEach(roleIds || {}, (aliases, id) => {
aliases = aliases || [];
if (aliases.length === 0) {
@ -32,11 +32,11 @@ async function init() {
lodash.forEach([sysCfg.wifeData, charCfg.wifeData, custom.wifeData], (wifeData) => {
lodash.forEach(wifeData || {}, (ids, type) => {
type = { girlfriend: 0, boyfriend: 1, daughter: 2, son: 3 }[type] || type;
type = Data.def({ girlfriend: 0, boyfriend: 1, daughter: 2, son: 3 }[type], type);
if (!wifeMap[type]) {
wifeMap[type] = {};
}
lodash.forEach(ids, (id) => {
Data.eachStr(ids, (id) => {
id = aliasMap[id];
if (id) {
wifeMap[type][id] = true;

View File

@ -1,23 +1,28 @@
/*
* 请不要直接修改此文件防止后续冲突
* 如需编辑可复制此文件改名为character.js自行编辑
* character.js character_default.js两份配置会叠加生效
* 请不要直接修改此或删除此文件防止后续更新冲突
* 如需新增自定义角色可复制此文件改名为character.js
* 复制的character.js中可按格式及自己需求进行配置
* 最终character.js character_default.js两份配置会叠加生效
*
* 暂未做热更新修改完毕请重启yunzai
* */
// 角色列表,首位需要是标准名字
// 实装的角色需要以roleid为key非实装请以英文为key
/*
* 角色列表别名的第一个是标准名字后面的为别名
* 实装的角色需要以数字roleid为key自定义的角色及非实装角色请以英文为key
* */
export const customCharacters = {
// 已有角色添加别名示例:为魈增加新的别名
// roleid请参见Yunzai roleId.js
10000026: ["魈", "风夜叉"],
// 以下为新增自定义角色角色id请以小写英文定义
paimon: ["派蒙", "应急食物", "应急食品", "吉祥物", "宠物", "外置器官", "会说话的动物", "矮堇瓜", "飞行矮堇瓜", "最好的伙伴"],
// 啊, 原谅英语白痴。。
sb: ["散兵", "国崩", "雷电国崩", "大炮", "雷电大炮", "逆子"],
sb: ["散兵", "国崩", "雷电国崩", "大炮", "雷电大炮", "雷大炮", "伞兵"],
nvshi: ["女士", "炽热的炎之魔女", "炎之魔女"],
baizhu: ["白术", "长生"],
yaoyao: ["瑶瑶", "遥遥无期"],
yaoyao: ["瑶瑶", "遥遥", "遥遥无期"],
fanan: ["伐难", "水夜叉"]
}
@ -27,14 +32,13 @@ export const customCharacters = {
* */
export const wifeData = {
// 老婆&女朋友:成女、少女
girlfriend: ['伐难'],
girlfriend: "伐难, 女士",
// 老公&男朋友:成男、少男
boyfriend: ['散兵', '白术'],
boyfriend: "散兵, 白术",
// 女儿:萝莉
daughter: ['派蒙', '瑶瑶'],
daughter: "派蒙, 瑶瑶",
// 儿子:正太
son: []
son: ""
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB