diff --git a/src/api_s2c/event/huangqijiuguan/ApiFight.ts b/src/api_s2c/event/huangqijiuguan/ApiFight.ts index fa547a2..41974cd 100644 --- a/src/api_s2c/event/huangqijiuguan/ApiFight.ts +++ b/src/api_s2c/event/huangqijiuguan/ApiFight.ts @@ -6,7 +6,7 @@ import { fightResult } from "../../../shared/fightControl/fightType"; import { FightFun } from "../../../public/fight"; export default async function (call: ApiCall) { - let hd = await HuoDongFun.getHdidInfo(call, call.req.hdid); + let hd = await HQJGFun.HdInfo(call, call.req.hdid); if (!hd) { // 无此活动 @@ -17,7 +17,7 @@ export default async function (call: ApiCall) { let mydata = await HQJGFun.getMydata(call, call.req.hdid); // 开始战斗 - let result: fightResult = await FightFun.fightNpc(call, hd.data.bossId, 'hqjg'); + let result: fightResult = await FightFun.fightNpc(call, hd.data.boss.npcId, 'hqjg'); let up = false; let today = HQJGFun.today(hd); diff --git a/src/api_s2c/event/huangqijiuguan/ApiGiftRec.ts b/src/api_s2c/event/huangqijiuguan/ApiGiftRec.ts new file mode 100644 index 0000000..741c88c --- /dev/null +++ b/src/api_s2c/event/huangqijiuguan/ApiGiftRec.ts @@ -0,0 +1,42 @@ +import { ApiCall } from "tsrpc"; +import { ReqGiftRec, ResGiftRec } from "../../../shared/protocols/event/huangqijiuguan/PtlGiftRec"; +import HQJGFun from "./fun"; + +export default async function (call: ApiCall) { + let hd = await HQJGFun.HdInfo(call, call.req.hdid); + if (!hd || Object.keys(hd).length <= 0) { + // 无此活动 + return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 }) + } + + let gift = hd.data.gift.filter(i => i.id == call.req.giftid)[0]; + if (!gift || !gift.free) { + return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 }) + } + + let mydata = await HQJGFun.getMydata(call, call.req.hdid); + if ((mydata.giftbuy[call.req.giftid] || { num: 0 }).num + 1 > gift.buynum) { + return call.error("", { code: -2, message: globalThis.lng.hqjgtips_28 }) + } + + let prize: atn[] = [].concat(gift.prize); + if (!mydata.giftbuy[call.req.giftid]) { + mydata.giftbuy[call.req.giftid] = { num: 0, select: [] }; + } + + if (gift.dlz) { + for (let i = 0; i < gift.dlz.length; i++) { + if (!mydata.giftbuy[call.req.giftid].select[i]) { + let ids = Object.keys(gift.dlz[i]) + prize.push(gift.dlz[i][ids[0]]); + mydata.giftbuy[call.req.giftid].select[i] = Number(ids[0]); + } else { + prize.push(gift.dlz[i][mydata.giftbuy[call.req.giftid].select[i]]); + } + } + } + mydata.giftbuy[call.req.giftid].num++; + await HQJGFun.setMyData(call.uid, call.req.hdid, { giftbuy: mydata.giftbuy }); + + call.succ({ data: mydata, prize: prize }) +} diff --git a/src/api_s2c/event/huangqijiuguan/ApiGiftSelect.ts b/src/api_s2c/event/huangqijiuguan/ApiGiftSelect.ts new file mode 100644 index 0000000..40df551 --- /dev/null +++ b/src/api_s2c/event/huangqijiuguan/ApiGiftSelect.ts @@ -0,0 +1,35 @@ +import { ApiCall } from "tsrpc"; +import { ReqGiftSelect, ResGiftSelect } from "../../../shared/protocols/event/huangqijiuguan/PtlGiftSelect"; +import HQJGFun from "./fun"; + +export default async function (call: ApiCall) { + let hd = await HQJGFun.HdInfo(call, call.req.hdid); + if (!hd || Object.keys(hd).length <= 0) { + // 无此活动 + return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 }) + } + + let gift = hd.data.gift.filter(i => i.id == call.req.giftid)[0]; + if (!gift || !gift.dlz) { + return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 }) + } + + for (let i = 0; i < call.req.seletc.length; i++) { + if (!gift.dlz[i] || !gift.dlz[i][call.req.seletc[i]]) { + return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 }) + } + } + + let mydata = await HQJGFun.getMydata(call, call.req.hdid); + if (!mydata.giftbuy[call.req.giftid]) { + mydata.giftbuy[call.req.giftid] = { + num: 0, select: call.req.seletc + } + } else { + mydata.giftbuy[call.req.giftid].select = call.req.seletc; + } + + await HQJGFun.setMyData(call.uid, call.req.hdid, { giftbuy: mydata.giftbuy }); + + call.succ({ data: mydata }); +} \ No newline at end of file diff --git a/src/api_s2c/event/huangqijiuguan/ApiOpen.ts b/src/api_s2c/event/huangqijiuguan/ApiOpen.ts index 0d799d2..660ba47 100644 --- a/src/api_s2c/event/huangqijiuguan/ApiOpen.ts +++ b/src/api_s2c/event/huangqijiuguan/ApiOpen.ts @@ -1,10 +1,9 @@ import HQJGFun from "./fun"; import { ApiCall } from "tsrpc"; -import { HuoDongFun } from "../../../public/huodongfun"; import { ReqOpen, ResOpen } from "../../../shared/protocols/event/huangqijiuguan/PtlOpen"; export default async (call: ApiCall) => { - let hd = await HuoDongFun.getHdidInfo(call, call.req.hdid); + let hd = await HQJGFun.HdInfo(call, call.req.hdid); if (!hd || Object.keys(hd).length <= 0) { // 无此活动 return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 }) diff --git a/src/api_s2c/event/huangqijiuguan/ApiRecDpsPrize.ts b/src/api_s2c/event/huangqijiuguan/ApiRecDpsPrize.ts index 25b3438..888b3b3 100644 --- a/src/api_s2c/event/huangqijiuguan/ApiRecDpsPrize.ts +++ b/src/api_s2c/event/huangqijiuguan/ApiRecDpsPrize.ts @@ -1,11 +1,10 @@ import { ApiCall } from "tsrpc"; import HQJGFun, { Data } from "./fun"; -import { HuoDongFun } from "../../../public/huodongfun"; import { ReqRecDpsPrize, ResRecDpsPrize } from "../../../shared/protocols/event/huangqijiuguan/PtlRecDpsPrize"; import { PlayerFun } from "../../../public/player"; export default async function (call: ApiCall) { - let hd = await HuoDongFun.getHdidInfo(call, call.req.hdid); + let hd = await HQJGFun.HdInfo(call, call.req.hdid); if (!hd) { // 无此活动 diff --git a/src/api_s2c/event/huangqijiuguan/ApiZhaoMu.ts b/src/api_s2c/event/huangqijiuguan/ApiZhaoMu.ts index b672a94..224bcee 100644 --- a/src/api_s2c/event/huangqijiuguan/ApiZhaoMu.ts +++ b/src/api_s2c/event/huangqijiuguan/ApiZhaoMu.ts @@ -19,7 +19,7 @@ export default async function (call: ApiCall) { let prize = []; let mydata = await HQJGFun.getMydata(call, call.req.hdid); - for (let n = 0; n < call.req.num; n++) { + for (let n = 1; n <= call.req.num; n++) { let num = mydata.zhaomu.num + n; let baodi = hd.data.baodi.filter(x => x.num == num); if (baodi.length > 0) { @@ -45,4 +45,6 @@ export default async function (call: ApiCall) { await HQJGFun.setMyData(call.uid, call.req.hdid, { zhaomu: mydata.zhaomu }); call.succ({ data: mydata, prize: prize }) + + G.emit("Class_task_159", 'Class_task_159', call, 1, 0); } \ No newline at end of file diff --git a/src/api_s2c/event/huangqijiuguan/ApiZhaoMuPrizeRec.ts b/src/api_s2c/event/huangqijiuguan/ApiZhaoMuPrizeRec.ts index f0b7f8f..7ec2586 100644 --- a/src/api_s2c/event/huangqijiuguan/ApiZhaoMuPrizeRec.ts +++ b/src/api_s2c/event/huangqijiuguan/ApiZhaoMuPrizeRec.ts @@ -14,13 +14,19 @@ export default async function (call: ApiCall mydata.zhaomu.num || mydata.zhaomu.prize.includes(rec)) { + let con = hd.data.choukajiangli[rec.idx]; + + if (con.num > mydata.zhaomu.num || mydata.zhaomu.prize.includes(rec.idx)) { continue } - mydata.zhaomu.prize.push(rec); - prize = prize.concat(con.prize); + if (con.dlz) { + prize.push(con.dlz[0][rec.sec]); + } else { + prize = prize.concat(con.prize); + } + + mydata.zhaomu.prize.push(rec.idx); } if (prize.length <= 0) { diff --git a/src/api_s2c/event/huangqijiuguan/fun.ts b/src/api_s2c/event/huangqijiuguan/fun.ts index 1ee383d..60d2691 100644 --- a/src/api_s2c/event/huangqijiuguan/fun.ts +++ b/src/api_s2c/event/huangqijiuguan/fun.ts @@ -3,18 +3,22 @@ import { ReqAddHuoDong } from "../../../monopoly/protocols/PtlAddHuoDong" import { HuoDongFun } from "../../../public/huodongfun" import { PublicShared } from "../../../shared/public/public" import { EmailFun } from "../../../public/email" +import { playerInfo } from "../../../shared/protocols/user/PtlLogin" // hddata.data 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 } } } huobi: atn // 抽卡货币 - bossId: number // boss表的ID + boss: { + img: string + npcId: number + } // boss排行邮件 bossRank_des: string @@ -26,11 +30,11 @@ export interface Data { chouka: { a: string, t: string, n: number, p: number, gailv: number, cishu: number }[] - choukajiangli: { num: number, prize: any[] }[] + choukajiangli: { num: number, prize?: any[], dlz: { [k: string]: atn } }[] baodi: { num: number, prize: any[] }[] - gift: { id: number, free: boolean, payId: string, buynum: number, prize: atn[] }[] + gift: { id: number, free: boolean, payId: string, buynum: number, prize: atn[], dlz?: { [k: string]: atn }[] }[] duihuan: { id: number, need: atn[], prize: atn[], buyNum: number }[] @@ -151,14 +155,14 @@ export default class HQJGFun { } /** 获取活动数据 */ - static async HdInfo(call: ApiCall, hdid?: number): Promise { + static async HdInfo(call: ApiCall, hdid?: number): Promise { if (!hdid) { let hdlist = await HuoDongFun.gethdList( call, this.htype ); return hdlist.length > 0 ? hdlist[0] : null } else { - return await HuoDongFun.getHdidInfo(call, hdid) as ReqAddHuoDong + return await HuoDongFun.getHdidInfo(call, hdid) as any as ReqAddHuoDong & { data: Data } } } @@ -200,24 +204,16 @@ export default class HQJGFun { } } - static async buy(call: ApiCall, payId: string) { - let hddata = await this.HdInfo(call); - - if (!hddata) { // 活动不存在 - return - } - - let mydata = await this.getMydata(call); - await this.setMyData(call.uid, (await this.HdInfo(call)).hdid, mydata); - } - /** * 每日伤害等级奖励结算 */ - static async dayDpsLvPrize() { + static async dayDpsLvPrize(time: number) { + console.log( + "黄旗酒馆 每日伤害等级奖励结算 开始执行。。。" + ) // 取stime小于当前时间的最后一条数据 let hdinfo = await G.mongodb.collection("hdinfo").find({ - htype: this.htype, stime: { $lte: G.time } + htype: this.htype, stime: { $lte: time } }, { sort: { stime: -1 } }).limit(1).toArray(); // 没有活动数 @@ -227,6 +223,7 @@ export default class HQJGFun { let hd = hdinfo[0]; let hdid = hdinfo[0].hdid; + // 活动结束 if (hd.etime < G.time - 300) { return } @@ -260,17 +257,26 @@ export default class HQJGFun { contentInsertArr: [lvprize.lv], }) } + console.log( + "黄旗酒馆 每日伤害等级奖励结算 执行完成!!!" + ) }) } /** * 最大伤害排行奖励结算 */ - static async endDpsRankPrize() { - // 取stime小于当前时间的最后一条数据 + static async endDpsRankPrize(time: number) { + console.log( + "黄旗酒馆 最大伤害排行奖励结算 开始执行。。。" + ) + let today = PublicShared.getToDayZeroTime(time + 300); + let yesterday = PublicShared.getToDayZeroTime(time - 300); + + // 查询昨天23:59:00或者今天00:00:00结束的活动 let hdinfo = await G.mongodb.collection("hdinfo").find({ - htype: this.htype, stime: { $lte: G.time } - }, { sort: { stime: -1 } }).limit(1).toArray(); + htype: this.htype, rtime: { $gt: yesterday, $lte: today } + }).toArray(); // 没有活动数 if (hdinfo.length <= 0) { @@ -279,7 +285,7 @@ export default class HQJGFun { let hd = hdinfo[0]; let hdid = hdinfo[0].hdid; - if (hd.etime < G.time - 300) { + if (hd.data.sendrank) { return } @@ -306,5 +312,91 @@ export default class HQJGFun { contentInsertArr: [rank], }) } + // 标记已发送 + await G.mongodb.collection("hdinfo").updateOne( + { hdid: hdid }, { $set: { "data.sendrank": true } } + ); + + console.log( + "黄旗酒馆 最大伤害排行奖励结算 执行结束!!!" + ) } -} + + /**设置任务 */ + 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 taskid of Object.keys(tasks)) { + let taskCon = tasks[taskid]; + 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}.${taskid}`] = val + } else { + setData["$set"][`task.val.day${today}.${taskid}`] = val + } + } + + // 设置任务 + if (isset == 1) { + await G.mongodb.collection('event').updateOne({ uid: call.uid, type: this.dataType(hd.hdid) }, setData) + } + } + + static async buy(player: playerInfo, payId: string, payArgs: any, call: ApiCall) { + let hd = await this.HdInfo(call); + + if (!hd) { // 活动不存在 + return + } + + // 判断购买次数 + let gift = hd.data.gift.filter(x => x.payId == payId)[0]; + if (!gift) { + return + } + + let mydata = await this.getMydata(call); + if (!mydata.giftbuy[gift.id]) { + mydata.giftbuy[gift.id] = { num: 0, select: [] }; + } + + let prize: atn[] = []; + if (mydata.giftbuy[gift.id].num + 1 > gift.buynum) { + let pay = G.gc.pay[payId]; + prize.push({ a: "attr", t: "rmbmoney", n: pay.payExp[0].n }) + } else { + prize = gift.prize; + for (let i = 0; i < gift.dlz.length; i++) { + if (!mydata.giftbuy[gift.id].select[i]) { + let ids = Object.keys(gift.dlz[i]) + prize.push(gift.dlz[i][ids[0]]); + mydata.giftbuy[gift.id].select[i] = Number(ids[0]); + } else { + prize.push(gift.dlz[i][mydata.giftbuy[gift.id].select[i]]); + } + } + } + + mydata.giftbuy[gift.id].num++; + await this.setMyData(call.uid, hd.hdid, { giftbuy: mydata.giftbuy }); + } +} \ No newline at end of file diff --git a/src/globalListener.ts b/src/globalListener.ts index 57fee50..234a823 100644 --- a/src/globalListener.ts +++ b/src/globalListener.ts @@ -15,13 +15,15 @@ import { ZhanLingTasks } from './public/zhanling'; import { player } from './shared/protocols/user/type'; import { PublicShared } from './shared/public/public'; import { setGud } from './public/gud'; -import {checkResetBuyLog} from "./api_s2c/event/zhoumolibao/ApiOpen"; -import {Christmasfun} from "./api_s2c/event/christmas/fun"; -import {PushGiftFun} from "./public/pushgift"; -import {LeiChongLiBaoBuyGift} from "./api_s2c/event/leichonglibao/ApiReceive"; +import { checkResetBuyLog } from "./api_s2c/event/zhoumolibao/ApiOpen"; +import { PushGiftFun } from "./public/pushgift"; +import { LeiChongLiBaoBuyGift } from "./api_s2c/event/leichonglibao/ApiReceive"; import { HongDianChange } from './api_s2c/hongdian/fun'; +import HQJGFun from './api_s2c/event/huangqijiuguan/fun'; export type gEventType = { + /**新的一天 */ + NEW_DAY: (time: number) => void; /**玩家断开连接 */ PLAYER_DISCONNECT: (uid: string) => void; /**玩家修改名字 */ @@ -152,6 +154,8 @@ export type gEventType = { Class_task_157: (eventname, call, val, chkVal) => void; /**今日参与{1}次抓娃娃小游戏 */ Class_task_158: (eventname, call, val, chkVal) => void; + /**黄旗酒馆累计抽卡X次*/ + Class_task_159: (eventname, call, val, chkVal) => void; }; export function addListener() { @@ -165,7 +169,7 @@ export function addListener() { XstaskFun.uidTask[uid] = null; delete XstaskFun.uidTask[uid]; } - setGud(uid,{ logoutTime: G.time }); + setGud(uid, { logoutTime: G.time }); G.mongodb.collection('user').updateOne({ uid: uid }, { $set: { logoutTime: G.time } }); }); @@ -177,7 +181,7 @@ export function addListener() { } }); - G.on('PLAYER_PAY', async (player, payId, payArgs,call) => { + G.on('PLAYER_PAY', async (player, payId, payArgs, call) => { let conf: any = await PayFun.getConf(payId, payArgs); ActionLog.addDayLog(player.uid, { key: 'pay', val: conf.payExp[0].n }); ActionLog.addRetainLog(player.uid, { key: 'pay', val: conf.payExp[0].n }); @@ -261,4 +265,9 @@ export function addListener() { let call = PayFun.getCall(gud); G.emit("Class_task_134", 'Class_task_134', call, 1, 0, items); }); + + // 黄旗酒馆 + G.on("NEW_DAY", HQJGFun.dayDpsLvPrize.bind(HQJGFun)); + G.on("NEW_DAY", HQJGFun.endDpsRankPrize.bind(HQJGFun)); + G.on("PLAYER_PAY", HQJGFun.buy.bind(HQJGFun)); } \ No newline at end of file diff --git a/src/jsonType.ts b/src/jsonType.ts index 87cc3f9..589cc62 100644 --- a/src/jsonType.ts +++ b/src/jsonType.ts @@ -800,6 +800,8 @@ type gc_npc = k_v<{ 'ghname': string /**npc名称 */ 'npcname': string + /**怪物皮肤*/ + 'skin': number[] }>; type gc_openCond = k_v<{ diff --git a/src/public/scheduler/scheduler_newDay.ts b/src/public/scheduler/scheduler_newDay.ts index 2e6598a..dc1fd16 100644 --- a/src/public/scheduler/scheduler_newDay.ts +++ b/src/public/scheduler/scheduler_newDay.ts @@ -26,7 +26,45 @@ export class SchedulerNewDayLocalCtor extends Scheduler { } async start() { - + + clusterRunOnce(async () => { + //这个定时器会被每个进程都启动,这是这部分逻辑,应该只执行1次 + + //重置所有的ActionLog + await ActionLog.initAllDayLog(); + + // 每周一,发放终身卡 + (async () => { + if (PublicShared.getWeek(G.time) == 1) { + let logs = await G.mongodb.collection("payLogNew").find( + { key: "zhongshenka", del_time: { $exists: false } }, { projection: { _id: 0, } } + ).toArray(); + + if (logs.length == 0) { + console.log("没有终身卡数据,不发放终身卡"); + } + let con = G.gc.payEmail.zhongshenka.filter(e => e.day == 7)[0]; + for (let i = 0; i < logs.length; i++) { + console.log("发放终身卡", logs[i].uid); + // 发送邮件 + EmailFun.addEmail({ + uid: logs[i].uid, + type: "system", + title: con.title, + content: con.content, + contentInsertArr: [], + createTime: G.time, + prize: con.prize, + }) + } + } + })() + + // 转点刷新事件 + G.emit('NEW_DAY', G.time); + }) + + clusterRunOnce(async ()=>{ //这个定时器会被每个进程都启动,这是这部分逻辑,应该只执行1次 @@ -39,7 +77,7 @@ export class SchedulerNewDayLocalCtor extends Scheduler { let logs = await G.mongodb.collection("payLogNew").find( { key: "zhongshenka", del_time: { $exists: false } }, { projection: { _id: 0, } } ).toArray(); - + if (logs.length == 0) { console.log("没有终身卡数据,不发放终身卡"); } @@ -56,7 +94,7 @@ export class SchedulerNewDayLocalCtor extends Scheduler { createTime: G.time, prize:con.prize, }) - } + } } })() }) diff --git a/src/public/taskclass.ts b/src/public/taskclass.ts index 878a7a2..9475f29 100644 --- a/src/public/taskclass.ts +++ b/src/public/taskclass.ts @@ -1,19 +1,20 @@ -import {ApiCall} from "tsrpc" -import {YangChengMuBiaofun} from "../api_s2c/event/yangchengmubiao/fun" -import {Christmasfun} from "../api_s2c/event/christmas/fun" +import { ApiCall } from "tsrpc" +import { YangChengMuBiaofun } from "../api_s2c/event/yangchengmubiao/fun" +import { Christmasfun } from "../api_s2c/event/christmas/fun" // import { YangChengMuBiaofun } from "../api_s2c/event/yangchengmubiao/fun" -import {Wjjl} from "../module/collection_wjjl" -import {PublicShared} from "../shared/public/public" -import {PayFun} from "./pay" -import {TaskFun} from "./task" -import {CollectionWanted} from "../module/collection_wanted"; -import {TanXianFun} from "./tanxian"; -import {PataFun} from "./pata"; -import {weixiuchangType} from "../shared/protocols/weixiuchang/type"; -import {FunWeiXiuChang} from "./weixiuchang"; -import {JJCFun} from "./jjc"; -import {getGud} from "./gud"; -import {Yuandanfun} from "../api_s2c/event/yuandan/fun"; +import { Wjjl } from "../module/collection_wjjl" +import { PublicShared } from "../shared/public/public" +import { PayFun } from "./pay" +import { TaskFun } from "./task" +import { CollectionWanted } from "../module/collection_wanted"; +import { TanXianFun } from "./tanxian"; +import { PataFun } from "./pata"; +import { weixiuchangType } from "../shared/protocols/weixiuchang/type"; +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); } // 任务数值, 和检测值,看情况需要上层复写 @@ -167,12 +170,12 @@ export module manager { async initVal(call: ApiCall, con) { let _chk = parseInt(con.cond[0]) - return await G.mongodb.collection('hero').countDocuments({uid: call.uid, lv: {$gte: _chk}}) || 0 + return await G.mongodb.collection('hero').countDocuments({ uid: call.uid, lv: { $gte: _chk } }) || 0 } async alchangeVal(call: ApiCall, con, val: number) { let _chk = parseInt(con.cond[0]) - return await G.mongodb.collection('hero').countDocuments({uid: call.uid, lv: {$gte: _chk}}) || 0 + return await G.mongodb.collection('hero').countDocuments({ uid: call.uid, lv: { $gte: _chk } }) || 0 } } @@ -194,13 +197,13 @@ export module manager { async initVal(call: ApiCall, con) { let _chk = parseInt(con.cond[0]) - let _num = await G.mongodb.collection('hero').countDocuments({uid: call.uid, jieji: {$gte: _chk}}) || 0 + let _num = await G.mongodb.collection('hero').countDocuments({ uid: call.uid, jieji: { $gte: _chk } }) || 0 return _num } async alchangeVal(call: ApiCall, con, val: number) { let _chk = parseInt(con.cond[0]) - let _num = await G.mongodb.collection('hero').countDocuments({uid: call.uid, jieji: {$gte: _chk}}) || 0 + let _num = await G.mongodb.collection('hero').countDocuments({ uid: call.uid, jieji: { $gte: _chk } }) || 0 return _num } } @@ -256,13 +259,13 @@ export module manager { async initVal(call: ApiCall, con) { let _chk = parseInt(con.cond[0]) - let _num = await G.mongodb.collection('equip').countDocuments({uid: call.uid, lv: {$gte: _chk}}) || 0 + let _num = await G.mongodb.collection('equip').countDocuments({ uid: call.uid, lv: { $gte: _chk } }) || 0 return _num } async alchangeVal(call: ApiCall, con, val: number) { let _chk = parseInt(con.cond[0]) - let _num = await G.mongodb.collection('equip').countDocuments({uid: call.uid, lv: {$gte: _chk}}) || 0 + let _num = await G.mongodb.collection('equip').countDocuments({ uid: call.uid, lv: { $gte: _chk } }) || 0 return _num } } @@ -426,7 +429,7 @@ export module manager { isinc = 1 async initVal(call: ApiCall, con) { - let myData = await G.mongodb.cPlayerInfo('meirishilian').findOne({uid: call.uid, type: 'meirishilian'}); + let myData = await G.mongodb.cPlayerInfo('meirishilian').findOne({ uid: call.uid, type: 'meirishilian' }); if (myData.data.refreshTime > PublicShared.getToDayZeroTime()) { return R.compose(R.sum(), R.map(i => i[0].useFightNum), R.values())(myData.data.numInfo) || 0 } @@ -446,7 +449,7 @@ export module manager { isinc = 1 async initVal(call: ApiCall, con) { - let myData = await G.mongodb.cPlayerInfo('qjzzd').findOne({uid: call.uid, type: 'qjzzd'}); + let myData = await G.mongodb.cPlayerInfo('qjzzd').findOne({ uid: call.uid, type: 'qjzzd' }); if (myData?.refreFightTime > PublicShared.getToDayZeroTime()) { return myData?.useFightNum || 0 } @@ -505,7 +508,7 @@ export module manager { isinc = 1 async initVal(call: ApiCall, con) { - let data: Partial = await G.mongodb.collection('wanted').findOne({uid: call.uid}) || {}; + let data: Partial = await G.mongodb.collection('wanted').findOne({ uid: call.uid }) || {}; if (data.refreshTime > PublicShared.getToDayZeroTime()) { return data.toDayUseNum || 0 } @@ -608,12 +611,12 @@ export module manager { async initVal(call: ApiCall, con) { let _chk = parseInt(con.cond[0]) - return await G.mongodb.collection('peijian').countDocuments({uid: call.uid, lv: {$gte: _chk}}) || 0 + return await G.mongodb.collection('peijian').countDocuments({ uid: call.uid, lv: { $gte: _chk } }) || 0 } async alchangeVal(call: ApiCall, con, val: number) { let _chk = parseInt(con.cond[0]) - return await G.mongodb.collection('peijian').countDocuments({uid: call.uid, lv: {$gte: _chk}}) || 0 + return await G.mongodb.collection('peijian').countDocuments({ uid: call.uid, lv: { $gte: _chk } }) || 0 } } @@ -675,11 +678,11 @@ export module manager { isinc = 0 async initVal(call: ApiCall, con) { - return await G.mongodb.collection('equip').countDocuments({uid: call.uid, wearaId: {$ne: ""}}) || 0 + return await G.mongodb.collection('equip').countDocuments({ uid: call.uid, wearaId: { $ne: "" } }) || 0 } async alchangeVal(call: ApiCall, con, val: number) { - return await G.mongodb.collection('equip').countDocuments({uid: call.uid, wearaId: {$ne: ""}}) || 0 + return await G.mongodb.collection('equip').countDocuments({ uid: call.uid, wearaId: { $ne: "" } }) || 0 } } @@ -833,6 +836,11 @@ export module manager { } } + // 第61个任务 黄旗酒馆累计抽卡X次 + export class Class_task_159 extends BaseClass { + stype = 159 + isinc = 1 + } } diff --git a/src/shared/fightControl/fightFun.ts b/src/shared/fightControl/fightFun.ts index 3230eca..ea85f64 100644 --- a/src/shared/fightControl/fightFun.ts +++ b/src/shared/fightControl/fightFun.ts @@ -121,7 +121,7 @@ export function createNpc(npcId: string | number, fixData: Partial [i + 1, function () { - + d['skin'] = (npcConf.skin?.[i] || ''); let { id, atk, def, mindps, maxdps, hp, speed, ...ops } = G.gc.armyattr[d.countId]; let buff = HeroShared.getHeroBasicAttr({ heroId: d.heroId, lv: d.lv }); @@ -149,9 +149,9 @@ export function createNpc(npcId: string | number, fixData: Partial