全局:加载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,15 +1,15 @@
import { Application, BackendSession } from "pinus";
import { resResult, getRandomWithWeight, getRandEelm, shouldRefresh } from "../../../pubUtils/util";
import { resResult, getRandEelmWithWeight, shouldRefresh, getRandSingleEelm } from "../../../pubUtils/util";
import { STATUS, GACHA_ID, HERO_QUALITY_TYPE, TASK_TYPE, REFRESH_HOUR } from "../../../consts";
import { gameData } from "../../../pubUtils/data";
import { GachaListReturn, GachaResult, GachaData } from "../../../domain/activityField/gachaField";
import { UserGachaModel } from "../../../db/UserGacha";
import { refreshGacha, getFloorResult, getResultFromContentId } from "../../../services/gachaService";
import { RoleModel } from "../../../db/Role";
import { HeroModel, HeroUpdate } from "../../../db/Hero";
import { HeroModel } from "../../../db/Hero";
import { RewardInter } from "../../../pubUtils/interface";
import { handleCost, createHeroes, addItems } from "../../../services/rewardService";
import { getAfterDateByDay, getTodayZeroDate, getZeroDate } from "../../../pubUtils/timeUtil";
import { getAfterDateByDay, getTodayZeroDate } from "../../../pubUtils/timeUtil";
import { UserGachaRecModel } from "../../../db/UserGachaRec";
import { ActivityModel } from "../../../db/Activity";
import { checkTask } from "../../../services/taskService";
@@ -17,7 +17,6 @@ import { RECRUIT } from "../../../pubUtils/dicParam";
import { getAllHeroByQuality } from "../../../services/gachaService";
import { transPiece } from "../../../pubUtils/itemUtils";
import { CreateHeroParam } from "../../../domain/roleField/hero";
import roleHandler from "../../role/handler/roleHandler";
export default function (app: Application) {
return new GachaHandler(app);
@@ -82,7 +81,7 @@ export class GachaHandler {
let items: RewardInter[] = [], heroInfo: CreateHeroParam[] = [], resultList: GachaResult[] = [];
for (let i = 0; i < count; i++) {
// 按照一般概率抽出
let { dic: { id: base } } = getRandomWithWeight(dicGacha.percent);
let { dic: { id: base } } = getRandEelmWithWeight(dicGacha.percent);
let contentId = getFloorResult(gachaId, base, floor);
if (contentId == false) return resResult(STATUS.DIC_DATA_NOT_FOUND);
let result = getResultFromContentId(contentId, lv, hope);
@@ -184,7 +183,6 @@ export class GachaHandler {
let userGacha = await UserGachaModel.findByRole(roleId, gachaId, 0);
let { point, turntable, costPoint } = userGacha;
console.log('***drawTurnTable', point)
if (point < RECRUIT.RECRUIT_BONUS_RECRUIT) return resResult(STATUS.GACHA_TURNTABLE_POINT_NOT_ENOUGH);
let turntablePool: { quality: number, count: number }[] = [];
@@ -198,13 +196,13 @@ export class GachaHandler {
turntable = []; turntablePool = gameData.gachaTurntable;
}
let randTurntable = getRandEelm(turntablePool);
let { quality, count } = randTurntable[0];
let randTurntable = getRandSingleEelm(turntablePool);
let { quality, count } = randTurntable;
// 根据品质查武将
let pool = getAllHeroByQuality(quality);
let hero = getRandEelm(pool);
let contentId = gameData.gachaContentHero.get(hero[0]);
let hero = getRandSingleEelm(pool);
let contentId = gameData.gachaContentHero.get(hero);
// 获得或者转成碎片
let heroInfo: { hid: number, count: number }[] = [];