feat:黄旗酒馆

This commit is contained in:
xichaoyin 2024-01-10 18:56:33 +08:00
parent 950a048742
commit 1c18a5b7fd
2 changed files with 74 additions and 33 deletions

View File

@ -9,7 +9,7 @@ export interface Data {
show: 1
task: {
[k: `day${number}`]: {
[k: string]: { pval: number, stype: string, cond: string[], tiaozhuan: number, prize: atn[], des: string }
[k: string]: { pval: number, stype: number, cond: string[], tiaozhuan: number, prize: atn[], des: string }
}
}
@ -331,6 +331,44 @@ export default class HQJGFun {
"黄旗酒馆 最大伤害排行奖励结算 执行结束!!!"
)
}
/**设置任务 */
static async setTaskVal(call: ApiCall, stype: number, val: number, chkCall: Function, chkval: number = 0, isinc: number = 0, alchangeVal: Function, arg) {
// 活动过期,不计数
let hd = await this.HdInfo(call)
if (!hd) return
let today = this.today(hd);
await this.getMydata(call, hd.hdid)
let isset = 0;
let setData = {
$inc: {},
$set: {}
};
let tasks = hd.data.task[`day${today}`];
for (let taskCon of Object.values(tasks)) {
if (taskCon.stype != stype) continue
// 不符合任务要求
if (!(await chkCall(taskCon["cond"], chkval, arg))) continue
// 根据需求改写
val = await alchangeVal(call, taskCon, val, arg)
isset = 1
if (isinc == 1) { // 累加
setData["$inc"][`task.val.day${today}`] = val
} else {
setData["$set"][`task.val.day${today}`] = val
}
}
// 设置任务
if (isset == 1) {
await G.mongodb.collection('event').updateOne({ uid: call.uid, type: this.dataType(hd.hdid) }, setData)
}
}
}
G.on("NEW_DAY", HQJGFun.dayDpsLvPrize.bind(HQJGFun));

View File

@ -14,6 +14,7 @@ import {FunWeiXiuChang} from "./weixiuchang";
import { JJCFun } from "./jjc";
import { getGud } from "./gud";
import { Yuandanfun } from "../api_s2c/event/yuandan/fun";
import HQJGFun from "../api_s2c/event/huangqijiuguan/fun"
let _classNameFunc = {}
/**
@ -72,13 +73,15 @@ export module manager {
// 设置数据
async setVal(call: ApiCall, val: number, chkval, arg) {
TaskFun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg)
TaskFun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg);
// 养成目标任务计数
YangChengMuBiaofun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg)
YangChengMuBiaofun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg);
// 圣诞活动任务计数
Christmasfun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg)
Christmasfun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg);
// 元旦活动任务计数
Yuandanfun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg)
Yuandanfun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg);
// 黄旗酒馆
HQJGFun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg);
}
// 任务数值, 和检测值,看情况需要上层复写