增加角色Character相关操作方法

This commit is contained in:
yoimiya-kokomi 2022-03-24 22:40:59 +08:00
parent 8b99085065
commit 8e641fe0bb
3 changed files with 54 additions and 15 deletions

View File

@ -1,5 +1,5 @@
/*
import Character from "./models/Character";
export {Character};
*/
import Character from "./models/Character.js";
export {Character};

View File

@ -0,0 +1 @@
export default class Base{}

View File

@ -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;