✨ feat(gvg): 准备期征战中原初始
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
// 征战中原相关
|
||||
|
||||
import { GVG_PERIOD } from "../../consts";
|
||||
import { GVGVestigeModel } from "../../db/GVGVestige";
|
||||
import { gameData } from "../../pubUtils/data";
|
||||
import { getTimeFun } from "../../pubUtils/timeUtil";
|
||||
import { getRandEelm } from "../../pubUtils/util";
|
||||
import { getGroupIdOfServer, getGVGServerType } from "./gvgService";
|
||||
|
||||
// 备战期的遗迹和激战期的开始结束战斗时间
|
||||
export function getFightTimeByPeriod(period: GVG_PERIOD) {
|
||||
let dicPeriod = gameData.gvgPeriod.get(period);
|
||||
if(!dicPeriod) return { startFightTime: 0, endFightTime: 0 };
|
||||
|
||||
return {
|
||||
startFightTime: <number>getTimeFun().getTimeWithHour(dicPeriod.startHour, dicPeriod.startMinute, dicPeriod.startSecond),
|
||||
endFightTime: <number>getTimeFun().getTimeWithHour(dicPeriod.endHour, dicPeriod.endMinute, dicPeriod.endSecond),
|
||||
}
|
||||
}
|
||||
|
||||
// 征战中原每天随机的遗迹点
|
||||
export async function getVestiges(serverId: number) {
|
||||
let groupId = await getGroupIdOfServer(serverId);
|
||||
let serverType = await getGVGServerType(serverId);
|
||||
let vestige = await GVGVestigeModel.getVestigate(groupId);
|
||||
if(!vestige) {
|
||||
let dicGVGVestige = gameData.gvgVestigeByServerType.get(serverType)||[];
|
||||
let cnt = gameData.gvgVestigeCntByServerType.get(serverType)||0;
|
||||
let randResult = getRandEelm(dicGVGVestige, cnt);
|
||||
vestige = await GVGVestigeModel.initTodayVestigate(groupId, serverType, randResult);
|
||||
}
|
||||
return vestige.vestiges||[];
|
||||
}
|
||||
Reference in New Issue
Block a user