Merge remote-tracking branch 'origin/feature/huangqijiuguan' into dev

# Conflicts:
#	src/public/scheduler/scheduler_newDay.ts
#	src/shared/protocols/serviceProto.ts
This commit is contained in:
xichaoyin 2024-01-11 16:00:20 +08:00
commit 82c47aaadf
16 changed files with 335 additions and 81 deletions

View File

@ -6,7 +6,7 @@ import { fightResult } from "../../../shared/fightControl/fightType";
import { FightFun } from "../../../public/fight"; import { FightFun } from "../../../public/fight";
export default async function (call: ApiCall<ReqFight, ResFight>) { export default async function (call: ApiCall<ReqFight, ResFight>) {
let hd = await HuoDongFun.getHdidInfo(call, call.req.hdid); let hd = await HQJGFun.HdInfo(call, call.req.hdid);
if (!hd) { if (!hd) {
// 无此活动 // 无此活动
@ -17,7 +17,7 @@ export default async function (call: ApiCall<ReqFight, ResFight>) {
let mydata = await HQJGFun.getMydata(call, call.req.hdid); 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 up = false;
let today = HQJGFun.today(hd); let today = HQJGFun.today(hd);

View File

@ -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<ReqGiftRec, ResGiftRec>) {
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 })
}

View File

@ -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<ReqGiftSelect, ResGiftSelect>) {
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 });
}

View File

@ -1,10 +1,9 @@
import HQJGFun from "./fun"; import HQJGFun from "./fun";
import { ApiCall } from "tsrpc"; import { ApiCall } from "tsrpc";
import { HuoDongFun } from "../../../public/huodongfun";
import { ReqOpen, ResOpen } from "../../../shared/protocols/event/huangqijiuguan/PtlOpen"; import { ReqOpen, ResOpen } from "../../../shared/protocols/event/huangqijiuguan/PtlOpen";
export default async (call: ApiCall<ReqOpen, ResOpen>) => { export default async (call: ApiCall<ReqOpen, ResOpen>) => {
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) { if (!hd || Object.keys(hd).length <= 0) {
// 无此活动 // 无此活动
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 }) return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })

View File

@ -1,11 +1,10 @@
import { ApiCall } from "tsrpc"; import { ApiCall } from "tsrpc";
import HQJGFun, { Data } from "./fun"; import HQJGFun, { Data } from "./fun";
import { HuoDongFun } from "../../../public/huodongfun";
import { ReqRecDpsPrize, ResRecDpsPrize } from "../../../shared/protocols/event/huangqijiuguan/PtlRecDpsPrize"; import { ReqRecDpsPrize, ResRecDpsPrize } from "../../../shared/protocols/event/huangqijiuguan/PtlRecDpsPrize";
import { PlayerFun } from "../../../public/player"; import { PlayerFun } from "../../../public/player";
export default async function (call: ApiCall<ReqRecDpsPrize, ResRecDpsPrize>) { export default async function (call: ApiCall<ReqRecDpsPrize, ResRecDpsPrize>) {
let hd = await HuoDongFun.getHdidInfo(call, call.req.hdid); let hd = await HQJGFun.HdInfo(call, call.req.hdid);
if (!hd) { if (!hd) {
// 无此活动 // 无此活动

View File

@ -19,7 +19,7 @@ export default async function (call: ApiCall<ReqZhaoMu, ResZhaoMu>) {
let prize = []; let prize = [];
let mydata = await HQJGFun.getMydata(call, call.req.hdid); 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 num = mydata.zhaomu.num + n;
let baodi = hd.data.baodi.filter(x => x.num == num); let baodi = hd.data.baodi.filter(x => x.num == num);
if (baodi.length > 0) { if (baodi.length > 0) {
@ -45,4 +45,6 @@ export default async function (call: ApiCall<ReqZhaoMu, ResZhaoMu>) {
await HQJGFun.setMyData(call.uid, call.req.hdid, { zhaomu: mydata.zhaomu }); await HQJGFun.setMyData(call.uid, call.req.hdid, { zhaomu: mydata.zhaomu });
call.succ({ data: mydata, prize: prize }) call.succ({ data: mydata, prize: prize })
G.emit("Class_task_159", 'Class_task_159', call, 1, 0);
} }

View File

@ -14,13 +14,19 @@ export default async function (call: ApiCall<ReqZhaoMuPrizeRec, ResZhaoMuPrizeRe
let mydata = await HQJGFun.getMydata(call, call.req.hdid); let mydata = await HQJGFun.getMydata(call, call.req.hdid);
for (let rec of call.req.recid) { for (let rec of call.req.recid) {
let con = hd.data.choukajiangli[rec]; let con = hd.data.choukajiangli[rec.idx];
if (con.num > mydata.zhaomu.num || mydata.zhaomu.prize.includes(rec)) {
if (con.num > mydata.zhaomu.num || mydata.zhaomu.prize.includes(rec.idx)) {
continue continue
} }
mydata.zhaomu.prize.push(rec); if (con.dlz) {
prize = prize.concat(con.prize); prize.push(con.dlz[0][rec.sec]);
} else {
prize = prize.concat(con.prize);
}
mydata.zhaomu.prize.push(rec.idx);
} }
if (prize.length <= 0) { if (prize.length <= 0) {

View File

@ -3,18 +3,22 @@ import { ReqAddHuoDong } from "../../../monopoly/protocols/PtlAddHuoDong"
import { HuoDongFun } from "../../../public/huodongfun" import { HuoDongFun } from "../../../public/huodongfun"
import { PublicShared } from "../../../shared/public/public" import { PublicShared } from "../../../shared/public/public"
import { EmailFun } from "../../../public/email" import { EmailFun } from "../../../public/email"
import { playerInfo } from "../../../shared/protocols/user/PtlLogin"
// hddata.data // hddata.data
export interface Data { export interface Data {
show: 1 show: 1
task: { task: {
[k: `day${number}`]: { [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 // 抽卡货币 huobi: atn // 抽卡货币
bossId: number // boss表的ID boss: {
img: string
npcId: number
}
// boss排行邮件 // boss排行邮件
bossRank_des: string bossRank_des: string
@ -26,11 +30,11 @@ export interface Data {
chouka: { a: string, t: string, n: number, p: number, gailv: number, cishu: number }[] 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[] }[] 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 }[] 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<ReqAddHuoDong> { static async HdInfo(call: ApiCall, hdid?: number): Promise<ReqAddHuoDong & { data: Data }> {
if (!hdid) { if (!hdid) {
let hdlist = await HuoDongFun.gethdList( let hdlist = await HuoDongFun.gethdList(
call, this.htype call, this.htype
); );
return hdlist.length > 0 ? hdlist[0] : null return hdlist.length > 0 ? hdlist[0] : null
} else { } 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小于当前时间的最后一条数据 // 取stime小于当前时间的最后一条数据
let hdinfo = await G.mongodb.collection("hdinfo").find({ 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(); }, { sort: { stime: -1 } }).limit(1).toArray();
// 没有活动数 // 没有活动数
@ -227,6 +223,7 @@ export default class HQJGFun {
let hd = hdinfo[0]; let hd = hdinfo[0];
let hdid = hdinfo[0].hdid; let hdid = hdinfo[0].hdid;
// 活动结束
if (hd.etime < G.time - 300) { if (hd.etime < G.time - 300) {
return return
} }
@ -260,17 +257,26 @@ export default class HQJGFun {
contentInsertArr: [lvprize.lv], contentInsertArr: [lvprize.lv],
}) })
} }
console.log(
"黄旗酒馆 每日伤害等级奖励结算 执行完成!!!"
)
}) })
} }
/** /**
* *
*/ */
static async endDpsRankPrize() { static async endDpsRankPrize(time: number) {
// 取stime小于当前时间的最后一条数据 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({ let hdinfo = await G.mongodb.collection("hdinfo").find({
htype: this.htype, stime: { $lte: G.time } htype: this.htype, rtime: { $gt: yesterday, $lte: today }
}, { sort: { stime: -1 } }).limit(1).toArray(); }).toArray();
// 没有活动数 // 没有活动数
if (hdinfo.length <= 0) { if (hdinfo.length <= 0) {
@ -279,7 +285,7 @@ export default class HQJGFun {
let hd = hdinfo[0]; let hd = hdinfo[0];
let hdid = hdinfo[0].hdid; let hdid = hdinfo[0].hdid;
if (hd.etime < G.time - 300) { if (hd.data.sendrank) {
return return
} }
@ -306,5 +312,91 @@ export default class HQJGFun {
contentInsertArr: [rank], 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 });
}
}

View File

@ -15,13 +15,15 @@ import { ZhanLingTasks } from './public/zhanling';
import { player } from './shared/protocols/user/type'; import { player } from './shared/protocols/user/type';
import { PublicShared } from './shared/public/public'; import { PublicShared } from './shared/public/public';
import { setGud } from './public/gud'; import { setGud } from './public/gud';
import {checkResetBuyLog} from "./api_s2c/event/zhoumolibao/ApiOpen"; import { checkResetBuyLog } from "./api_s2c/event/zhoumolibao/ApiOpen";
import {Christmasfun} from "./api_s2c/event/christmas/fun"; import { PushGiftFun } from "./public/pushgift";
import {PushGiftFun} from "./public/pushgift"; import { LeiChongLiBaoBuyGift } from "./api_s2c/event/leichonglibao/ApiReceive";
import {LeiChongLiBaoBuyGift} from "./api_s2c/event/leichonglibao/ApiReceive";
import { HongDianChange } from './api_s2c/hongdian/fun'; import { HongDianChange } from './api_s2c/hongdian/fun';
import HQJGFun from './api_s2c/event/huangqijiuguan/fun';
export type gEventType = { export type gEventType = {
/**新的一天 */
NEW_DAY: (time: number) => void;
/**玩家断开连接 */ /**玩家断开连接 */
PLAYER_DISCONNECT: (uid: string) => void; PLAYER_DISCONNECT: (uid: string) => void;
/**玩家修改名字 */ /**玩家修改名字 */
@ -152,6 +154,8 @@ export type gEventType = {
Class_task_157: (eventname, call, val, chkVal) => void; Class_task_157: (eventname, call, val, chkVal) => void;
/**今日参与{1}次抓娃娃小游戏 */ /**今日参与{1}次抓娃娃小游戏 */
Class_task_158: (eventname, call, val, chkVal) => void; Class_task_158: (eventname, call, val, chkVal) => void;
/**黄旗酒馆累计抽卡X次*/
Class_task_159: (eventname, call, val, chkVal) => void;
}; };
export function addListener() { export function addListener() {
@ -165,7 +169,7 @@ export function addListener() {
XstaskFun.uidTask[uid] = null; XstaskFun.uidTask[uid] = null;
delete XstaskFun.uidTask[uid]; 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 } }); 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); let conf: any = await PayFun.getConf(payId, payArgs);
ActionLog.addDayLog(player.uid, { key: 'pay', val: conf.payExp[0].n }); ActionLog.addDayLog(player.uid, { key: 'pay', val: conf.payExp[0].n });
ActionLog.addRetainLog(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); let call = PayFun.getCall(gud);
G.emit("Class_task_134", 'Class_task_134', call, 1, 0, items); 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));
} }

View File

@ -800,6 +800,8 @@ type gc_npc = k_v<{
'ghname': string 'ghname': string
/**npc名称 */ /**npc名称 */
'npcname': string 'npcname': string
/**怪物皮肤*/
'skin': number[]
}>; }>;
type gc_openCond = k_v<{ type gc_openCond = k_v<{

View File

@ -26,7 +26,45 @@ export class SchedulerNewDayLocalCtor extends Scheduler {
} }
async start() { 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 ()=>{ clusterRunOnce(async ()=>{
//这个定时器会被每个进程都启动这是这部分逻辑应该只执行1次 //这个定时器会被每个进程都启动这是这部分逻辑应该只执行1次
@ -39,7 +77,7 @@ export class SchedulerNewDayLocalCtor extends Scheduler {
let logs = await G.mongodb.collection("payLogNew").find( let logs = await G.mongodb.collection("payLogNew").find(
{ key: "zhongshenka", del_time: { $exists: false } }, { projection: { _id: 0, } } { key: "zhongshenka", del_time: { $exists: false } }, { projection: { _id: 0, } }
).toArray(); ).toArray();
if (logs.length == 0) { if (logs.length == 0) {
console.log("没有终身卡数据,不发放终身卡"); console.log("没有终身卡数据,不发放终身卡");
} }
@ -56,7 +94,7 @@ export class SchedulerNewDayLocalCtor extends Scheduler {
createTime: G.time, createTime: G.time,
prize:con.prize, prize:con.prize,
}) })
} }
} }
})() })()
}) })

View File

@ -1,19 +1,20 @@
import {ApiCall} from "tsrpc" import { ApiCall } from "tsrpc"
import {YangChengMuBiaofun} from "../api_s2c/event/yangchengmubiao/fun" import { YangChengMuBiaofun } from "../api_s2c/event/yangchengmubiao/fun"
import {Christmasfun} from "../api_s2c/event/christmas/fun" import { Christmasfun } from "../api_s2c/event/christmas/fun"
// import { YangChengMuBiaofun } from "../api_s2c/event/yangchengmubiao/fun" // import { YangChengMuBiaofun } from "../api_s2c/event/yangchengmubiao/fun"
import {Wjjl} from "../module/collection_wjjl" import { Wjjl } from "../module/collection_wjjl"
import {PublicShared} from "../shared/public/public" import { PublicShared } from "../shared/public/public"
import {PayFun} from "./pay" import { PayFun } from "./pay"
import {TaskFun} from "./task" import { TaskFun } from "./task"
import {CollectionWanted} from "../module/collection_wanted"; import { CollectionWanted } from "../module/collection_wanted";
import {TanXianFun} from "./tanxian"; import { TanXianFun } from "./tanxian";
import {PataFun} from "./pata"; import { PataFun } from "./pata";
import {weixiuchangType} from "../shared/protocols/weixiuchang/type"; import { weixiuchangType } from "../shared/protocols/weixiuchang/type";
import {FunWeiXiuChang} from "./weixiuchang"; import { FunWeiXiuChang } from "./weixiuchang";
import {JJCFun} from "./jjc"; import { JJCFun } from "./jjc";
import {getGud} from "./gud"; import { getGud } from "./gud";
import {Yuandanfun} from "../api_s2c/event/yuandan/fun"; import { Yuandanfun } from "../api_s2c/event/yuandan/fun";
import HQJGFun from "../api_s2c/event/huangqijiuguan/fun"
let _classNameFunc = {} let _classNameFunc = {}
/** /**
@ -72,13 +73,15 @@ export module manager {
// 设置数据 // 设置数据
async setVal(call: ApiCall, val: number, chkval, arg) { 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) { async initVal(call: ApiCall, con) {
let _chk = parseInt(con.cond[0]) 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) { async alchangeVal(call: ApiCall, con, val: number) {
let _chk = parseInt(con.cond[0]) 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) { async initVal(call: ApiCall, con) {
let _chk = parseInt(con.cond[0]) 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 return _num
} }
async alchangeVal(call: ApiCall, con, val: number) { async alchangeVal(call: ApiCall, con, val: number) {
let _chk = parseInt(con.cond[0]) 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 return _num
} }
} }
@ -256,13 +259,13 @@ export module manager {
async initVal(call: ApiCall, con) { async initVal(call: ApiCall, con) {
let _chk = parseInt(con.cond[0]) 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 return _num
} }
async alchangeVal(call: ApiCall, con, val: number) { async alchangeVal(call: ApiCall, con, val: number) {
let _chk = parseInt(con.cond[0]) 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 return _num
} }
} }
@ -426,7 +429,7 @@ export module manager {
isinc = 1 isinc = 1
async initVal(call: ApiCall, con) { 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()) { if (myData.data.refreshTime > PublicShared.getToDayZeroTime()) {
return R.compose(R.sum(), R.map(i => i[0].useFightNum), R.values())(myData.data.numInfo) || 0 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 isinc = 1
async initVal(call: ApiCall, con) { 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()) { if (myData?.refreFightTime > PublicShared.getToDayZeroTime()) {
return myData?.useFightNum || 0 return myData?.useFightNum || 0
} }
@ -505,7 +508,7 @@ export module manager {
isinc = 1 isinc = 1
async initVal(call: ApiCall, con) { async initVal(call: ApiCall, con) {
let data: Partial<CollectionWanted> = await G.mongodb.collection('wanted').findOne({uid: call.uid}) || {}; let data: Partial<CollectionWanted> = await G.mongodb.collection('wanted').findOne({ uid: call.uid }) || {};
if (data.refreshTime > PublicShared.getToDayZeroTime()) { if (data.refreshTime > PublicShared.getToDayZeroTime()) {
return data.toDayUseNum || 0 return data.toDayUseNum || 0
} }
@ -608,12 +611,12 @@ export module manager {
async initVal(call: ApiCall, con) { async initVal(call: ApiCall, con) {
let _chk = parseInt(con.cond[0]) 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) { async alchangeVal(call: ApiCall, con, val: number) {
let _chk = parseInt(con.cond[0]) 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 isinc = 0
async initVal(call: ApiCall, con) { 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) { 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
}
} }

View File

@ -121,7 +121,7 @@ export function createNpc(npcId: string | number, fixData: Partial<ResLogin['gud
isNpc: true isNpc: true
}, },
roles: Object.fromEntries(dataArr.map((d, i) => [i + 1, function () { roles: Object.fromEntries(dataArr.map((d, i) => [i + 1, function () {
d['skin'] = (npcConf.skin?.[i] || '');
let { id, atk, def, mindps, maxdps, hp, speed, ...ops } = G.gc.armyattr[d.countId]; let { id, atk, def, mindps, maxdps, hp, speed, ...ops } = G.gc.armyattr[d.countId];
let buff = HeroShared.getHeroBasicAttr({ heroId: d.heroId, lv: d.lv }); let buff = HeroShared.getHeroBasicAttr({ heroId: d.heroId, lv: d.lv });
@ -149,9 +149,9 @@ export function createNpc(npcId: string | number, fixData: Partial<ResLogin['gud
return { return {
attr: buff, attr: buff,
...d, ...d,
lv: (npcConf.npcLv ? npcConf.npcLv[i]: 0) || d.lv, lv: (npcConf.npcLv ? npcConf.npcLv[i] : 0) || d.lv,
isBoss: !!npcConf.isboss, isBoss: !!npcConf.isboss,
trueLv: d.lv || (npcConf.npcLv ? npcConf.npcLv[i]: 0) trueLv: d.lv || (npcConf.npcLv ? npcConf.npcLv[i] : 0)
}; };
}()])) }()]))

View File

@ -0,0 +1,11 @@
import { PlayerData } from "../../../../api_s2c/event/huangqijiuguan/fun"
export interface ReqGiftRec {
hdid: number
giftid: number
}
export interface ResGiftRec {
data: PlayerData
prize: { a: string, t: string, n: number }[]
}

View File

@ -0,0 +1,11 @@
import { PlayerData } from "../../../../api_s2c/event/huangqijiuguan/fun"
export interface ReqGiftSelect {
hdid: number
giftid: number
seletc: number[]
}
export interface ResGiftSelect {
data: PlayerData
}

View File

@ -2,7 +2,7 @@ import { PlayerData } from "../../../../api_s2c/event/huangqijiuguan/fun"
export interface ReqZhaoMuPrizeRec { export interface ReqZhaoMuPrizeRec {
hdid: number hdid: number
recid: number[] recid: { idx: number, sec: string }[]
} }
export interface ResZhaoMuPrizeRec { export interface ResZhaoMuPrizeRec {