HJ_Server/src/public/qjzzd.ts
2023-12-13 20:51:17 +08:00

60 lines
2.0 KiB
TypeScript

import { number } from 'mathjs';
import { ApiCall } from 'tsrpc';
import { ReqAddHuoDong } from '../monopoly/protocols/PtlAddHuoDong';
import { PublicShared } from '../shared/public/public';
import { UserFun } from './user';
export class QjzzdFun {
/**获取boss id 偏差值*/
static async getBoosId(val: number = 1): Promise<string> {
let _con = Object.values(G.gc.qjzzd.bossTime)
let _day = PublicShared.getWeek(G.time) + val
_day = _day == 0 ? 7 : _day
for (let index = 0; index < _con.length; index++) {
const element = _con[index];
if (element[0] <= _day && _day <= element[1]) {
return G.gc.qjzzd.boss[index]
}
}
return G.gc.qjzzd.boss[0];
}
/**是否换boss */
static async chkSetBoosId(): Promise<boolean> {
let _con = Object.values(G.gc.qjzzd.bossTime)
let _day = PublicShared.getWeek(G.time)
_day = _day == 0 ? 7 : _day
for (let index = 0; index < _con.length; index++) {
const element = _con[index];
if (_day == element[1]) {
return true
}
}
return false
}
/**获取排行奖励 */
static async getphPrize() {
let _con = Object.values(G.gc.qjzzd.bossTime)
let _day = PublicShared.getWeek(G.time)
_day = _day == 0 ? 7 : _day
for (let index = 0; index < _con.length; index++) {
const element = _con[index];
if (_day == element[1]) {
return G.gc.qjzzd.rankphPrize[index]
}
}
return G.gc.qjzzd.rankphPrize[0]
}
/**获取挑战次数奖励 */
static async getFightPrize(fightNum: number) {
let _prize = []
let _con = G.gc.qjzzd.fightPirze[fightNum]
if (!_con) return _prize
_prize = _con.prize.concat(_con.dlz ? _con.dlz.map(dlz => PublicShared.randomDropGroup(dlz)).reduce((a, b) => a.concat(b)) : [])
return _prize
}
}