抽卡
This commit is contained in:
@@ -4,7 +4,7 @@ import { prop } from '@typegoose/typegoose';
|
||||
import { UserGachaType } from '../../db/UserGacha';
|
||||
import { getTimeFun } from '../../pubUtils/timeUtil';
|
||||
import { DicGacha } from '../../pubUtils/dictionary/DicGacha';
|
||||
import { GACHA_OCCUPY_HID, } from '../../consts';
|
||||
import { GACHA_CONTENT_TYPE, } from '../../consts';
|
||||
import { gameData } from '../../pubUtils/data';
|
||||
import { getFloorStatus } from '../../pubUtils/util';
|
||||
|
||||
@@ -52,6 +52,8 @@ export class Floor {
|
||||
id: number; // 保底类型 1-紫将保底 2-金将保底 3-指定将保底
|
||||
@prop({ required: true })
|
||||
count: number; // 抽卡次数
|
||||
@prop({ required: true })
|
||||
hasGetFloor: boolean; // 是否抽到保底了
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +89,7 @@ export class GachaListReturn {
|
||||
refFreeTime: number = 0; // 免费次数下次刷新时间
|
||||
count: number = 0; // 整体已抽卡次数
|
||||
guideResultCount: number = 0; // 引导已抽卡次数
|
||||
floor: Floor[] = []; // 整体保底
|
||||
floor: {id: number, count: number}[] = []; // 整体保底
|
||||
hope: Hope[] = []; // 心愿单
|
||||
point: number = 0; // 积分
|
||||
turntable: Turntable[] = []; // 转盘记录
|
||||
@@ -126,14 +128,26 @@ export class GachaResult {
|
||||
id: number = 0; // 道具id
|
||||
@prop({ required: true })
|
||||
count: number = 0; // 道具数量
|
||||
pickHero: number = 0;
|
||||
|
||||
constructor(contentId: number) {
|
||||
constructor(contentId: number, id?: number) {
|
||||
this.contentId = contentId;
|
||||
if(id) this.pickHero = id;
|
||||
}
|
||||
|
||||
setSetPickHero(hid: number) {
|
||||
if (hid > 0 && this.hid == GACHA_OCCUPY_HID) {
|
||||
this.hid = hid;
|
||||
setContentId(contentId: number, id?: number) {
|
||||
this.contentId = contentId;
|
||||
if(id) this.pickHero = id;
|
||||
}
|
||||
|
||||
setHidOrGid(id: number, count?: number) {
|
||||
let dicGachaContent = gameData.gachaContent.get(id);
|
||||
if(!dicGachaContent) return;
|
||||
|
||||
if(dicGachaContent.type == GACHA_CONTENT_TYPE.HERO) {
|
||||
this.setHero(id);
|
||||
} else {
|
||||
this.setItem(id, count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +158,7 @@ export class GachaResult {
|
||||
|
||||
setItem(id: number, count: number) {
|
||||
this.id = id;
|
||||
this.count = count;
|
||||
if(count) this.count = count;
|
||||
}
|
||||
|
||||
transferToPiece(id: number, count: number) {
|
||||
|
||||
Reference in New Issue
Block a user