mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-21 14:38:30 +00:00
增加角色Character相关操作方法
This commit is contained in:
parent
8b99085065
commit
8e641fe0bb
@ -1,5 +1,5 @@
|
||||
/*
|
||||
import Character from "./models/Character";
|
||||
|
||||
export {Character};
|
||||
*/
|
||||
import Character from "./models/Character.js";
|
||||
|
||||
export {Character};
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
export default class Base{}
|
@ -1,22 +1,60 @@
|
||||
import Base from "./Base.js";
|
||||
import {roleId} from "../../../config/roleId.js"
|
||||
let CharacterMap = {};
|
||||
import { roleId, abbr } from "../../../config/genshin/roleId.js";
|
||||
import lodash from "lodash";
|
||||
import fs from "fs";
|
||||
|
||||
let characterMap = {};
|
||||
let characterAttr = {};
|
||||
|
||||
class Character extends Base{
|
||||
constructor(name){
|
||||
super();
|
||||
const characterMeta = JSON.parse(fs.readFileSync("../meta/characters.json", "utf8"));
|
||||
|
||||
}
|
||||
get sortName(){
|
||||
return characterAttr[this.name] || this.name;
|
||||
}
|
||||
|
||||
lodash.forEach(characterMeta, (meta)=>{
|
||||
characterMap[meta.Name] = new Character(name, meta)
|
||||
});
|
||||
|
||||
lodash.forEach(roleId, function(names, id){
|
||||
if(characterMap[names[0]]){
|
||||
characterMap[names[0]].id = id;
|
||||
}
|
||||
});
|
||||
|
||||
class Character extends Base {
|
||||
|
||||
constructor(name, meta) {
|
||||
super();
|
||||
let key = "".split();
|
||||
this._meta = meta;
|
||||
}
|
||||
get sortName() {
|
||||
return characterAttr[this.name] || this.name;
|
||||
}
|
||||
|
||||
get id(){
|
||||
for(let id in roleId){
|
||||
if(roleId[id] && role[id][0] === this.name){
|
||||
return id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getData(key){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Character.get= function(val){
|
||||
console.log(roleId)
|
||||
|
||||
Character.get = function (val) {
|
||||
let name = YunzaiApps.mysInfo.roleIdToName(val);
|
||||
if(!name){
|
||||
return false;
|
||||
}
|
||||
if(!characterMap[name]){
|
||||
//characterMap[name] =
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
export default Character;
|
||||
|
Loading…
Reference in New Issue
Block a user