500抽:活动格式

This commit is contained in:
luying
2022-07-28 20:27:08 +08:00
parent dbcbabfda6
commit 2806fdd9b1
10 changed files with 205 additions and 200 deletions

View File

@@ -1,47 +1,9 @@
import { ActivityModelType } from '../../db/Activity';
import { ActivityBase } from './activityField';
import { prop } from '@typegoose/typegoose';
import { UserGachaType } from '../../db/UserGacha';
import { getTimeFun } from '../../pubUtils/timeUtil';
import { DicGacha } from '../../pubUtils/dictionary/DicGacha';
import { gameData } from '../../pubUtils/data';
import { getGachaRemainFloor } from '../../pubUtils/util';
// 抽卡数据
export class GachaData extends ActivityBase {
gachaId: number = 0;
heroes: Array<number> = [];
pickHero: number;
freeCount: number;
refFreeTime: number = 0;
count: number;
floor: Floor[];
public initData(data: string) {
let obj = JSON.parse(data);
this.gachaId = obj.gachaId;
this.heroes = obj.heroes;
}
public setUserGacha(userGacha: UserGachaType) {
let dicGacha = gameData.gacha.get(this.gachaId);
this.pickHero = userGacha.pickHero;
this.freeCount = userGacha.freeCount;
if (dicGacha.free.count > 0) {
let f = getTimeFun(userGacha.refFreeTime);
this.refFreeTime = <number>f.getAfterDayWithHour(dicGacha.free.day);
}
this.count = userGacha.count;
this.floor = userGacha.floor;
}
constructor(activityData: ActivityModelType, createTime: number, serverTime: number) {
super(activityData, createTime, serverTime)
}
}
/**
* @description 保底记录
* @memberof UserGacha
@@ -88,7 +50,6 @@ export class GachaListReturn {
freeCount: number = 0; // 免费次数
refFreeTime: number = 0; // 免费次数下次刷新时间
count: number = 0; // 整体已抽卡次数
guideResultCount: number = 0; // 引导已抽卡次数
remainFloor: number = 0; // 还剩多少次可以保底
hope: Hope[] = []; // 心愿单
point: number = 0; // 积分
@@ -110,7 +71,6 @@ export class GachaListReturn {
this.point = userGacha.point;
this.turntable = userGacha.turntable;
this.pickHero = userGacha.pickHero;
this.guideResultCount = userGacha.guideResultCount||0;
}
this.remainFloor = getGachaRemainFloor(this.gachaId, userGacha?.floor||[]);
}