抽卡:修复拜访、引导抽卡、转盘bug
This commit is contained in:
@@ -4,7 +4,7 @@ import { STATUS, GACHA_TYPE, HERO_QUALITY_TYPE, TASK_TYPE, ITEM_CHANGE_REASON, }
|
|||||||
import { gameData } from "../../../pubUtils/data";
|
import { gameData } from "../../../pubUtils/data";
|
||||||
import { GachaData, GachaResultIndb } from "../../../domain/activityField/gachaField";
|
import { GachaData, GachaResultIndb } from "../../../domain/activityField/gachaField";
|
||||||
import { SimpleResult, UserGachaModel } from "../../../db/UserGacha";
|
import { SimpleResult, UserGachaModel } from "../../../db/UserGacha";
|
||||||
import { refreshGacha, getGachaList, getVisitedHeroList, GachaPull, getGuideGachaId, GachaResults, getDicGachaByGachaCnt } from "../../../services/activity/gachaService";
|
import { refreshGacha, getGachaList, getVisitedHeroList, GachaPull, getGuideGachaId, GachaResults, getDicGachaByGachaCnt, getNormalGachaId } from "../../../services/activity/gachaService";
|
||||||
import { RoleModel } from "../../../db/Role";
|
import { RoleModel } from "../../../db/Role";
|
||||||
import { HeroModel } from "../../../db/Hero";
|
import { HeroModel } from "../../../db/Hero";
|
||||||
import { handleCost, addItems } from "../../../services/role/rewardService";
|
import { handleCost, addItems } from "../../../services/role/rewardService";
|
||||||
@@ -291,7 +291,8 @@ export class GachaHandler {
|
|||||||
if (index == -1) return resResult(STATUS.GACHA_CAN_NOT_PICK);
|
if (index == -1) return resResult(STATUS.GACHA_CAN_NOT_PICK);
|
||||||
let { pieceId } = dicHero;
|
let { pieceId } = dicHero;
|
||||||
|
|
||||||
let { visitedHero, refVisitedTime } = await UserGachaModel.findByRole(roleId, GACHA_TYPE.NORMAL, 0);
|
let gachaId = getNormalGachaId();
|
||||||
|
let { visitedHero, refVisitedTime } = await UserGachaModel.findByRole(roleId, gachaId, 0);
|
||||||
if (shouldRefresh(refVisitedTime, new Date())) {
|
if (shouldRefresh(refVisitedTime, new Date())) {
|
||||||
visitedHero = [];
|
visitedHero = [];
|
||||||
refVisitedTime = getZeroPointD();
|
refVisitedTime = getZeroPointD();
|
||||||
@@ -304,7 +305,7 @@ export class GachaHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
visitedHero.push(hid);
|
visitedHero.push(hid);
|
||||||
let userGacha = await UserGachaModel.updateInfo(roleId, GACHA_TYPE.NORMAL, 0, { visitedHero, refVisitedTime });
|
let userGacha = await UserGachaModel.updateInfo(roleId, gachaId, 0, { visitedHero, refVisitedTime });
|
||||||
let goods = await addItems(roleId, roleName, sid, [{ id: pieceId, count: RECRUIT.RECRUIT_SHARD_LIMIT }], ITEM_CHANGE_REASON.VISIT_HERO);
|
let goods = await addItems(roleId, roleName, sid, [{ id: pieceId, count: RECRUIT.RECRUIT_SHARD_LIMIT }], ITEM_CHANGE_REASON.VISIT_HERO);
|
||||||
|
|
||||||
return resResult(STATUS.SUCCESS, {
|
return resResult(STATUS.SUCCESS, {
|
||||||
@@ -325,7 +326,8 @@ export class GachaHandler {
|
|||||||
let { gachaHasGuide } = await RoleModel.findByRoleId(roleId, 'gachaHasGuide');
|
let { gachaHasGuide } = await RoleModel.findByRoleId(roleId, 'gachaHasGuide');
|
||||||
let guideCount = 0, guideResultList = [], candidates = [];
|
let guideCount = 0, guideResultList = [], candidates = [];
|
||||||
if(!gachaHasGuide) {
|
if(!gachaHasGuide) {
|
||||||
const userGacha = await UserGachaModel.findByRole(roleId, GACHA_TYPE.NORMAL);
|
let gachaId = getGuideGachaId();
|
||||||
|
const userGacha = await UserGachaModel.findByRole(roleId, gachaId);
|
||||||
({ guideCount = 0, guideResultList = [], candidates = [] } = userGacha);
|
({ guideCount = 0, guideResultList = [], candidates = [] } = userGacha);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,7 +352,7 @@ export class GachaHandler {
|
|||||||
const gachaId = getGuideGachaId();
|
const gachaId = getGuideGachaId();
|
||||||
const dicGacha = gameData.gacha.get(gachaId);
|
const dicGacha = gameData.gacha.get(gachaId);
|
||||||
|
|
||||||
let userGacha = await UserGachaModel.findByRole(roleId, GACHA_TYPE.NORMAL);
|
let userGacha = await UserGachaModel.findByRole(roleId, gachaId);
|
||||||
let { guideCount = 0 } = userGacha;
|
let { guideCount = 0 } = userGacha;
|
||||||
if(guideCount >= RECRUIT.RECRUIT_FIRST_RECRUIT) return resResult(STATUS.GACHA_GUIDE_PULL_CNT_LACK);
|
if(guideCount >= RECRUIT.RECRUIT_FIRST_RECRUIT) return resResult(STATUS.GACHA_GUIDE_PULL_CNT_LACK);
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,11 @@ export function getGuideGachaId() {
|
|||||||
return ids[0];
|
return ids[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getNormalGachaId() {
|
||||||
|
let ids = gameData.gachaByType.get(GACHA_TYPE.NORMAL);
|
||||||
|
return ids[0];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 刷新免费次数
|
* 刷新免费次数
|
||||||
* @param dicGacha
|
* @param dicGacha
|
||||||
|
|||||||
Reference in New Issue
Block a user