全局:加载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
+5 -15
View File
@@ -1,7 +1,6 @@
import { ITID, CONSUME_TYPE, getCurNameById, ITEM_TABLE, HERO_SYSTEM_TYPE, CURRENCY_BY_TYPE, FIGURE_UNLOCK_CONDITION, REDIS_KEY } from './../consts';
import { EquipModel } from './../db/Equip';
import { resResult, parseGoodStr } from '../pubUtils/util';
import { getGoodById } from '../pubUtils/gamedata';
import { resResult } from '../pubUtils/util';
import { RoleModel, RoleType } from '../db/Role';
import { setAp } from './actionPointService';
import { calAllHeroCe, pushCalPlayerCe, pushCalAllHeroCe } from './playerCeService';
@@ -9,24 +8,15 @@ import { ItemModel } from '../db/Item';
import { STATUS } from '../consts/statusCode';
import { pinus } from 'pinus';
import { addEquips, addBags, addSkins, addFigure, unlockFigure as pubUnlockFigure, createHeroes as pubCreateHeroes, transPiece } from '../pubUtils/itemUtils';
import { EquipInter, ItemInter, BagInter, RewardInter } from '../pubUtils/interface';
import { EquipInter, ItemInter, BagInter } from '../pubUtils/interface';
import { gameData } from '../pubUtils/data';
import { uniq, indexOf, findIndex } from 'underscore';
import { HeroModel, HeroUpdate, HeroType } from '../db/Hero';
import { HeroModel, HeroType } from '../db/Hero';
import { Figure } from '../domain/dbGeneral';
import { Rank } from './rankService';
import { pushTaskUpdate } from './taskService';
import { CreateHeroParam } from '../domain/roleField/hero';
export async function handleFixedReward(roleId: string, roleName: string, sid: string, rewardStr: string, multi: number) {
let reward = parseGoodStr(rewardStr);
let rewards = [];
for (let obj of reward)
rewards.push({ ...obj, count: Math.ceil(obj.count * multi) });
const result = await addItems(roleId, roleName, sid, reward);
return result;
}
export async function handleCost(roleId: string, sid: string, goods: Array<ItemInter>) {
let currencysMap: any = {};
let equips: Array<number> = [];
@@ -75,7 +65,7 @@ export async function handleCost(roleId: string, sid: string, goods: Array<ItemI
function sortConsumes(goods: Array<ItemInter>, bags: Array<ItemInter>, currencysMap: any, equips: Array<number>) {
for (let good of goods) {
if(good.count == 0) continue;
let goodInfo = getGoodById(good.id);
let goodInfo = gameData.goods.get(good.id);
let { type, table } = ITID.get(goodInfo.itid);
if (table == ITEM_TABLE.EQUIP) {
@@ -256,7 +246,7 @@ export async function checkGoods(roleId: string, goodIds: Array<number>) {
let hids: Array<number> = [];
goodIds = uniq(goodIds);
for (let goodId of goodIds) {
let goodInfo = getGoodById(goodId);
let goodInfo = gameData.goods.get(goodId);
if (!!goodInfo) {
let { table } = ITID.get(goodInfo.itid);
if (table == ITEM_TABLE.EQUIP) {