全局:加载json方法全部改为最新

This commit is contained in:
luying
2021-05-06 20:25:05 +08:00
parent 2ef00e8179
commit 0315269387
36 changed files with 401 additions and 920 deletions

View File

@@ -1,7 +1,6 @@
import { Service } from 'egg';
import { addSkins, addBags, addEquips } from '@pubUtils/itemUtils';
import * as pubUtils from '@pubUtils/util';
import * as pubGamedata from '@pubUtils/gamedata'
import { BagInter, EquipInter } from '@pubUtils/interface';
const csprng = require('csprng');
@@ -22,25 +21,6 @@ export default class Utils extends Service {
return pubUtils.genCode(len)
}
public getGamedata(key: string) {
return pubGamedata.getGamedata(key);
}
public getHeroById(hid: number) {
return pubGamedata.getHeroInfoById(hid);
}
public getWarById(warid: number) {
return pubGamedata.getWarById(warid);
}
public getGoodById(gid: number) {
return pubGamedata.getGoodById(gid);
}
public getExpByLv(lv: number) {
return pubGamedata.getExpByLv(lv);
}
public resResult(status: {code: number, simStr: string}, data?, customMsg?: string) {
return pubUtils.resResult(status, data, customMsg);
}

View File

@@ -23,7 +23,7 @@ import Counter from '@db/Counter';
import { STATUS, HERO_SYSTEM_TYPE } from '@consts';
import { ITID, COUNTER } from '@consts';
import { ItemModel } from '@db/Item';
import { gameData, getHeroExpByLv } from '@pubUtils/data';
import { gameData, getHeroExpByLv, getExpByLv } from '@pubUtils/data';
import { calPlayerCeAndSave, calculatetopLineup, calEquipSeids } from '@pubUtils/playerCe';
import { SchoolModel } from '@db/School';
import { Attribute } from '@domain/roleField/attribute';
@@ -250,7 +250,7 @@ export default class GMUsers extends Service {
for(let hid of hids) {
let hero = await HeroModel.findByHidAndRole(hid, roleId);
if(hero) continue;
let dicHero = ctx.service.utils.getHeroById(hid);
let dicHero = gameData.hero.get(hid);
if(!dicHero) continue;
const heroInfo = {
roleId, roleName: role.roleName, hid, serverId: role.serverId,
@@ -389,7 +389,7 @@ export default class GMUsers extends Service {
let lv = parseInt(_lv);
if(isNaN(lv)) return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
for(let roleId of uids) {
let exp = ctx.service.utils.getExpByLv(lv - 1);
let exp = getExpByLv(lv - 1);
await RoleModel.levelup(roleId, lv, exp?exp.sum:0);
}
@@ -438,7 +438,7 @@ export default class GMUsers extends Service {
let { attr: roleAttrs } = role;
let dicHero = ctx.service.utils.getHeroById(hid);
let dicHero = gameData.hero.get(hid);
let attribute = new Attribute();
attribute.setByDbData(roleAttrs, heroAttrs);