Merge branch 'feature/huangqijiuguan' into release
# Conflicts: # src/json/huodong.json5 # src/public/scheduler/scheduler_newDay.ts # src/shared/protocols/serviceProto.ts
This commit is contained in:
commit
e4011067fd
41
src/api_s2c/event/huangqijiuguan/ApiDuiHuan.ts
Normal file
41
src/api_s2c/event/huangqijiuguan/ApiDuiHuan.ts
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import HQJGFun from "./fun";
|
||||||
|
import { ApiCall } from "tsrpc";
|
||||||
|
import { PlayerFun } from "../../../public/player";
|
||||||
|
import { ReqDuiHuan, ResDuiHuan } from "../../../shared/protocols/event/huangqijiuguan/PtlDuiHuan";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default async function (call: ApiCall<ReqDuiHuan, ResDuiHuan>) {
|
||||||
|
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 need = [];
|
||||||
|
let prize = [];
|
||||||
|
let mydata = await HQJGFun.getMydata(call, call.req.hdid);
|
||||||
|
for (let id in call.req.dh) {
|
||||||
|
let con = hd.data.duihuan.filter(x => x.id == Number(id))[0];
|
||||||
|
|
||||||
|
if ((mydata.duihuan[id] || 0) + call.req.dh[id] > con.buyNum) {
|
||||||
|
return call.error("", { code: -2, message: globalThis.lng.hqjgtips_28 })
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < call.req.dh[id]; i++) {
|
||||||
|
need.push(...con.need);
|
||||||
|
prize.push(...con.prize);
|
||||||
|
}
|
||||||
|
|
||||||
|
mydata.duihuan[id] = (mydata.duihuan[id] || 0) + call.req.dh[id];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查消耗
|
||||||
|
await PlayerFun.checkNeedIsMeet(call, need);
|
||||||
|
// 发送奖励
|
||||||
|
await PlayerFun.sendPrize(call, prize);
|
||||||
|
// 记录兑换次数
|
||||||
|
await HQJGFun.setMyData(call.uid, hd.hdid, { duihuan: mydata.duihuan });
|
||||||
|
|
||||||
|
call.succ({ prize: prize, data: mydata })
|
||||||
|
}
|
42
src/api_s2c/event/huangqijiuguan/ApiFight.ts
Normal file
42
src/api_s2c/event/huangqijiuguan/ApiFight.ts
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import { ApiCall } from "tsrpc";
|
||||||
|
import { ReqFight, ResFight } from "../../../shared/protocols/event/huangqijiuguan/PtlFight";
|
||||||
|
import { HuoDongFun } from "../../../public/huodongfun";
|
||||||
|
import HQJGFun from "./fun";
|
||||||
|
import { fightResult } from "../../../shared/fightControl/fightType";
|
||||||
|
import { FightFun } from "../../../public/fight";
|
||||||
|
|
||||||
|
export default async function (call: ApiCall<ReqFight, ResFight>) {
|
||||||
|
let hd = await HQJGFun.HdInfo(call, call.req.hdid);
|
||||||
|
|
||||||
|
if (!hd) {
|
||||||
|
// 无此活动
|
||||||
|
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 个人活动信息
|
||||||
|
let mydata = await HQJGFun.getMydata(call, call.req.hdid);
|
||||||
|
|
||||||
|
// 开始战斗
|
||||||
|
let result: fightResult = await FightFun.fightNpc(call, hd.data.boss.npcId, 'hqjg');
|
||||||
|
|
||||||
|
let up = false;
|
||||||
|
let today = HQJGFun.today(hd);
|
||||||
|
// 历史最大伤害
|
||||||
|
if (result.totalDamage[0] > mydata.bossres.maxdps) {
|
||||||
|
up = true;
|
||||||
|
mydata.bossres.maxdps = result.totalDamage[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 今日最大伤害
|
||||||
|
if (result.totalDamage[0] > (mydata.bossres.todaydps[today] || 0)) {
|
||||||
|
up = true;
|
||||||
|
mydata.bossres.todaydps[today] = result.totalDamage[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新伤害数据
|
||||||
|
up && await HQJGFun.setMyData(call.uid, call.req.hdid, { bossres: mydata.bossres });
|
||||||
|
|
||||||
|
call.succ({ data: mydata, result: result });
|
||||||
|
|
||||||
|
G.server.sendMsgByUid(call.uid, "msg_s2c/HongDianChange", ["huodonghd"])
|
||||||
|
}
|
44
src/api_s2c/event/huangqijiuguan/ApiGiftRec.ts
Normal file
44
src/api_s2c/event/huangqijiuguan/ApiGiftRec.ts
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
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 })
|
||||||
|
|
||||||
|
G.server.sendMsgByUid(call.uid, "msg_s2c/HongDianChange", ["huodonghd"])
|
||||||
|
}
|
35
src/api_s2c/event/huangqijiuguan/ApiGiftSelect.ts
Normal file
35
src/api_s2c/event/huangqijiuguan/ApiGiftSelect.ts
Normal 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 });
|
||||||
|
}
|
15
src/api_s2c/event/huangqijiuguan/ApiOpen.ts
Normal file
15
src/api_s2c/event/huangqijiuguan/ApiOpen.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import HQJGFun from "./fun";
|
||||||
|
import { ApiCall } from "tsrpc";
|
||||||
|
import { ReqOpen, ResOpen } from "../../../shared/protocols/event/huangqijiuguan/PtlOpen";
|
||||||
|
|
||||||
|
export default async (call: ApiCall<ReqOpen, ResOpen>) => {
|
||||||
|
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 mydata = await HQJGFun.getMydata(call, call.req.hdid);
|
||||||
|
|
||||||
|
call.succ({ data: mydata })
|
||||||
|
}
|
7
src/api_s2c/event/huangqijiuguan/ApiRankList.ts
Normal file
7
src/api_s2c/event/huangqijiuguan/ApiRankList.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { ApiCall } from "tsrpc";
|
||||||
|
import { ReqRankList, ResRankList } from "../../../shared/protocols/event/huangqijiuguan/PtlRankList";
|
||||||
|
import HQJGFun from "./fun";
|
||||||
|
|
||||||
|
export default async function (call: ApiCall<ReqRankList, ResRankList>) {
|
||||||
|
HQJGFun.getRankList(call.req.hdid).then(data => call.succ({ rankList: data }));
|
||||||
|
}
|
48
src/api_s2c/event/huangqijiuguan/ApiRecDpsPrize.ts
Normal file
48
src/api_s2c/event/huangqijiuguan/ApiRecDpsPrize.ts
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import { ApiCall } from "tsrpc";
|
||||||
|
import HQJGFun, { Data } from "./fun";
|
||||||
|
import { ReqRecDpsPrize, ResRecDpsPrize } from "../../../shared/protocols/event/huangqijiuguan/PtlRecDpsPrize";
|
||||||
|
import { PlayerFun } from "../../../public/player";
|
||||||
|
|
||||||
|
export default async function (call: ApiCall<ReqRecDpsPrize, ResRecDpsPrize>) {
|
||||||
|
let hd = await HQJGFun.HdInfo(call, call.req.hdid);
|
||||||
|
|
||||||
|
if (!hd) {
|
||||||
|
// 无此活动
|
||||||
|
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })
|
||||||
|
}
|
||||||
|
|
||||||
|
let data = hd.data as Data
|
||||||
|
|
||||||
|
// 个人活动信息
|
||||||
|
let mydata = await HQJGFun.getMydata(call, call.req.hdid);
|
||||||
|
|
||||||
|
// 领取伤害奖励
|
||||||
|
let prize = [];
|
||||||
|
for (let rec of call.req.recid) {
|
||||||
|
let con = data.bossTask.filter(x => x.id == rec)[0];
|
||||||
|
|
||||||
|
if (mydata.bossres.recdpstask.includes(con.id)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (con.need > (mydata.bossres.maxdps || 0)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
mydata.bossres.recdpstask.push(con.id);
|
||||||
|
prize = prize.concat(con.prize);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prize.length <= 0) {
|
||||||
|
call.error("", { code: -2, message: lng.hqjgtips_27 });
|
||||||
|
} else {
|
||||||
|
// 发送奖励
|
||||||
|
await PlayerFun.sendPrize(call, prize);
|
||||||
|
// 设置领奖记录
|
||||||
|
await HQJGFun.setMyData(call.uid, call.req.hdid, { bossres: mydata.bossres });
|
||||||
|
}
|
||||||
|
|
||||||
|
call.succ({ data: mydata, prize: prize })
|
||||||
|
|
||||||
|
G.server.sendMsgByUid(call.uid, "msg_s2c/HongDianChange", ["huodonghd"])
|
||||||
|
}
|
54
src/api_s2c/event/huangqijiuguan/ApiTaskRec.ts
Normal file
54
src/api_s2c/event/huangqijiuguan/ApiTaskRec.ts
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
import HQJGFun from "./fun";
|
||||||
|
import { ApiCall } from "tsrpc";
|
||||||
|
import { ReqTaskRec, ResTaskRec } from "../../../shared/protocols/event/huangqijiuguan/PtlTaskRec";
|
||||||
|
import { PlayerFun } from "../../../public/player";
|
||||||
|
|
||||||
|
export default async function (call: ApiCall<ReqTaskRec, ResTaskRec>) {
|
||||||
|
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 today = HQJGFun.today(hd);
|
||||||
|
if (today < call.req.day) {
|
||||||
|
// 未到领取时间
|
||||||
|
return call.error('', { code: -1, message: globalThis.lng.hqjgtips_29 })
|
||||||
|
}
|
||||||
|
|
||||||
|
let prize = [];
|
||||||
|
let taskday = `day${call.req.day}`
|
||||||
|
let mydata = await HQJGFun.getMydata(call, call.req.hdid);
|
||||||
|
|
||||||
|
for (let id of call.req.taskid) {
|
||||||
|
let con = hd.data.task[taskday][id];
|
||||||
|
|
||||||
|
if (!con) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mydata.task.rec[taskday] && mydata.task.rec[taskday].includes(id)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mydata.task.val[taskday] || (mydata.task.val[taskday][id] || 0) < con.pval) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
prize = prize.concat(con.prize);
|
||||||
|
mydata.task.rec[taskday] = (mydata.task.rec[taskday] || []).push(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prize.length <= 0) {
|
||||||
|
return call.error("", { code: -2, message: globalThis.lng.hqjgtips_28 })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送奖励
|
||||||
|
await PlayerFun.sendPrize(call, prize);
|
||||||
|
// 设置领取记录
|
||||||
|
await HQJGFun.setMyData(call.uid, call.req.hdid, mydata);
|
||||||
|
|
||||||
|
call.succ({ data: mydata, prize: prize });
|
||||||
|
|
||||||
|
G.server.sendMsgByUid(call.uid, "msg_s2c/HongDianChange", ["huodonghd"])
|
||||||
|
}
|
51
src/api_s2c/event/huangqijiuguan/ApiZhaoMu.ts
Normal file
51
src/api_s2c/event/huangqijiuguan/ApiZhaoMu.ts
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import { ApiCall } from "tsrpc";
|
||||||
|
import { ReqZhaoMu, ResZhaoMu } from "../../../shared/protocols/event/huangqijiuguan/PtlZhaoMu";
|
||||||
|
import HQJGFun from "./fun";
|
||||||
|
import { PlayerFun } from "../../../public/player";
|
||||||
|
import { PublicShared } from "../../../shared/public/public";
|
||||||
|
|
||||||
|
export default async function (call: ApiCall<ReqZhaoMu, ResZhaoMu>) {
|
||||||
|
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 need = [{ a: hd.data.huobi.a, t: hd.data.huobi.t, n: hd.data.huobi.n * call.req.num }];
|
||||||
|
|
||||||
|
// 检测消耗
|
||||||
|
await PlayerFun.checkNeedIsMeet(call, need);
|
||||||
|
|
||||||
|
let prize = [];
|
||||||
|
let mydata = await HQJGFun.getMydata(call, call.req.hdid);
|
||||||
|
|
||||||
|
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) {
|
||||||
|
// 触发保底
|
||||||
|
prize = prize.concat(baodi[0].prize);
|
||||||
|
} else {
|
||||||
|
// 常规掉落
|
||||||
|
let temp = PublicShared.randomDropAny<{
|
||||||
|
a: string, t: string, n: number, p: number
|
||||||
|
}>(
|
||||||
|
hd.data.chouka.filter(x => x.cishu <= num)
|
||||||
|
);
|
||||||
|
prize.push({ a: temp.a, t: temp.t, n: temp.n });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mydata.zhaomu.num += call.req.num;
|
||||||
|
|
||||||
|
// 扣除消耗
|
||||||
|
await PlayerFun.cutNeed(call, need);
|
||||||
|
// 发送奖励
|
||||||
|
await PlayerFun.sendPrize(call, prize);
|
||||||
|
// 设置抽卡数据
|
||||||
|
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);
|
||||||
|
}
|
44
src/api_s2c/event/huangqijiuguan/ApiZhaoMuPrizeRec.ts
Normal file
44
src/api_s2c/event/huangqijiuguan/ApiZhaoMuPrizeRec.ts
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import { ApiCall } from "tsrpc";
|
||||||
|
import { ReqZhaoMuPrizeRec, ResZhaoMuPrizeRec } from "../../../shared/protocols/event/huangqijiuguan/PtlZhaoMuPrizeRec";
|
||||||
|
import HQJGFun from "./fun";
|
||||||
|
import { PlayerFun } from "../../../public/player";
|
||||||
|
|
||||||
|
export default async function (call: ApiCall<ReqZhaoMuPrizeRec, ResZhaoMuPrizeRec>) {
|
||||||
|
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 prize = [];
|
||||||
|
let mydata = await HQJGFun.getMydata(call, call.req.hdid);
|
||||||
|
|
||||||
|
for (let rec of call.req.recid) {
|
||||||
|
let con = hd.data.choukajiangli[rec.idx];
|
||||||
|
|
||||||
|
if (con.num > mydata.zhaomu.num || mydata.zhaomu.prize.includes(rec.idx)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
return call.error('', { code: -2, message: globalThis.lng.hqjgtips_28 })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送奖励
|
||||||
|
await PlayerFun.sendPrize(call, prize);
|
||||||
|
// 设置领取数据
|
||||||
|
await HQJGFun.setMyData(call.uid, call.req.hdid, { zhaomu: mydata.zhaomu });
|
||||||
|
|
||||||
|
call.succ({ prize: prize, data: mydata })
|
||||||
|
|
||||||
|
G.server.sendMsgByUid(call.uid, "msg_s2c/HongDianChange", ["huodonghd"])
|
||||||
|
}
|
501
src/api_s2c/event/huangqijiuguan/fun.ts
Normal file
501
src/api_s2c/event/huangqijiuguan/fun.ts
Normal file
@ -0,0 +1,501 @@
|
|||||||
|
import { ApiCall } from "tsrpc"
|
||||||
|
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"
|
||||||
|
import { PlayerFun } from "../../../public/player"
|
||||||
|
import { Player } from "../../../shared/fightControl/Player"
|
||||||
|
|
||||||
|
// hddata.data
|
||||||
|
export interface Data {
|
||||||
|
show: 1
|
||||||
|
task: {
|
||||||
|
[k: `day${number}`]: {
|
||||||
|
[k: string]: { pval: number, stype: number, cond: string[], tiaozhuan: number, prize: atn[], des: string }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
huobi: atn // 抽卡货币
|
||||||
|
boss: {
|
||||||
|
img: string
|
||||||
|
npcId: number
|
||||||
|
}
|
||||||
|
|
||||||
|
// boss排行邮件
|
||||||
|
bossRank_des: string
|
||||||
|
bossRank_title: string
|
||||||
|
|
||||||
|
// boss挑战等级奖励邮
|
||||||
|
bossLvReward_des: string
|
||||||
|
bossLvReward_title: string
|
||||||
|
|
||||||
|
chouka: { a: string, t: string, n: number, p: number, gailv: number, cishu: number }[]
|
||||||
|
|
||||||
|
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[], dlz?: { [k: string]: atn }[] }[]
|
||||||
|
|
||||||
|
duihuan: { id: number, need: atn[], prize: atn[], buyNum: number }[]
|
||||||
|
|
||||||
|
bossLvReward: { lv: number, need: number, prize: atn[] }[]
|
||||||
|
|
||||||
|
bossTask: { id: number, need: number, prize: atn[] }[]
|
||||||
|
|
||||||
|
bossRank: { id: string, rank: [number, number], prize: atn[] }
|
||||||
|
|
||||||
|
zhuanhuan: { start: atn, end: atn }[]
|
||||||
|
end_mail_title: string
|
||||||
|
end_mail_des: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PlayerData {
|
||||||
|
// 招募数据
|
||||||
|
zhaomu: {
|
||||||
|
// 招募次数
|
||||||
|
num: number
|
||||||
|
// 次数奖励领取记录
|
||||||
|
prize: number[]
|
||||||
|
};
|
||||||
|
|
||||||
|
// 任务计数
|
||||||
|
task: {
|
||||||
|
rec: { [k: `day${number}`]: number[] }
|
||||||
|
val: { [k: `day${number}`]: { [id: string]: number } }
|
||||||
|
},
|
||||||
|
|
||||||
|
// 礼包购买记录
|
||||||
|
giftbuy: { [id: string]: { num: number, select: number[] } }
|
||||||
|
|
||||||
|
// 兑换次数记录
|
||||||
|
duihuan: { [id: string]: number }
|
||||||
|
|
||||||
|
// boss挑战数据
|
||||||
|
bossres: {
|
||||||
|
// 历史最大伤害
|
||||||
|
maxdps: number
|
||||||
|
// 今日最大伤害
|
||||||
|
todaydps: {
|
||||||
|
[k: string]: number
|
||||||
|
}
|
||||||
|
// 今日奖励领取记录
|
||||||
|
recdpstask: number[]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 最后修改数据时间
|
||||||
|
lasttime: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class HQJGFun {
|
||||||
|
static get htype() {
|
||||||
|
return 15
|
||||||
|
};
|
||||||
|
|
||||||
|
static rankkey(hdid: number) {
|
||||||
|
return `rank:huangqijiuguan_${hdid}`
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 默认数据 */
|
||||||
|
static get defaultData() {
|
||||||
|
return {
|
||||||
|
zhaomu: {
|
||||||
|
num: 0,
|
||||||
|
prize: []
|
||||||
|
},
|
||||||
|
task: {
|
||||||
|
val: {},
|
||||||
|
rec: {}
|
||||||
|
},
|
||||||
|
giftbuy: {},
|
||||||
|
duihuan: {},
|
||||||
|
bossres: {
|
||||||
|
maxdps: 0,
|
||||||
|
zhanli: 0,
|
||||||
|
todaydps: {},
|
||||||
|
recdpstask: []
|
||||||
|
},
|
||||||
|
lasttime: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static today(hdinfo: ReqAddHuoDong) {
|
||||||
|
/**
|
||||||
|
* 获取活动开启到第几天 从1开始
|
||||||
|
*/
|
||||||
|
return PublicShared.getDiff(hdinfo.stime, G.time)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取排行榜
|
||||||
|
*/
|
||||||
|
static async getRankList(hdid: number) {
|
||||||
|
let uids = await G.mongodb.collection("event").find(
|
||||||
|
{ type: this.dataType(hdid), "bossres.maxdps": { $gt: 0 } },
|
||||||
|
{
|
||||||
|
sort: { "bossres.maxdps": -1, "bossres.zhanli": -1 },
|
||||||
|
projection: { uid: 1, bossres: 1 }
|
||||||
|
}
|
||||||
|
).limit(50).toArray();
|
||||||
|
|
||||||
|
let userinfo = await G.mongodb.collection('user').find(
|
||||||
|
{ uid: { $in: uids.map(v => v.uid) } },
|
||||||
|
).toArray();
|
||||||
|
|
||||||
|
let res = [];
|
||||||
|
for (let rank = 1; rank <= uids.length; rank++) {
|
||||||
|
let uid = uids[rank - 1].uid;
|
||||||
|
let user = userinfo.find(v => v.uid == uid);
|
||||||
|
if (user) {
|
||||||
|
res.push({ rank, ...user, valArr: [uids[rank - 1].bossres.maxdps] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 数据类型 */
|
||||||
|
static dataType(hdid: number) {
|
||||||
|
return `huangqijiuguan_${hdid}` as `huangqijiuguan_${number}`
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取活动数据 */
|
||||||
|
static async HdInfo(call: ApiCall, hdid?: number): Promise<ReqAddHuoDong & { data: Data }> {
|
||||||
|
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 any as ReqAddHuoDong & { data: Data }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** 获取我的数据 */
|
||||||
|
static async getMydata(call: ApiCall, hdid?: number) {
|
||||||
|
if (!hdid) {
|
||||||
|
hdid = (await HQJGFun.HdInfo(call)).hdid;
|
||||||
|
}
|
||||||
|
let data = await G.mongodb.cEvent(this.dataType(hdid)).findOne({
|
||||||
|
uid: call.uid, type: this.dataType(hdid)
|
||||||
|
}, { projection: { _id: 0 } });
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
data = (await G.mongodb.cEvent(this.dataType(hdid)).findOneAndUpdate({
|
||||||
|
uid: call.uid, type: this.dataType(hdid)
|
||||||
|
}, {
|
||||||
|
$set: this.defaultData
|
||||||
|
}, { upsert: true, returnDocument: 'after', projection: { _id: 0 } })).value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 设置我的数据 */
|
||||||
|
static async setMyData(uid: string, hdid: number, update: { [k in keyof Partial<PlayerData>]: PlayerData[k] }) {
|
||||||
|
if (!update.lasttime) {
|
||||||
|
update.lasttime = G.time;
|
||||||
|
}
|
||||||
|
|
||||||
|
let res = await G.mongodb.cEvent(this.dataType(hdid)).updateOne(
|
||||||
|
{ uid: uid, type: this.dataType(hdid) }, { $set: update }
|
||||||
|
);
|
||||||
|
|
||||||
|
if (res.upsertedCount <= 0) {
|
||||||
|
await G.mongodb.cEvent(this.dataType(hdid)).updateOne(
|
||||||
|
{ uid: uid, type: this.dataType(hdid) }, { $set: Object.assign(this.defaultData, update) }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每日伤害等级奖励结算
|
||||||
|
*/
|
||||||
|
static async dayDpsLvPrize(time: number) {
|
||||||
|
console.log(
|
||||||
|
"黄旗酒馆 每日伤害等级奖励结算 开始执行。。。"
|
||||||
|
)
|
||||||
|
// 取stime小于当前时间的最后一条数据
|
||||||
|
let hdinfo = await G.mongodb.collection("hdinfo").find({
|
||||||
|
htype: this.htype, stime: { $lte: time }
|
||||||
|
}, { sort: { stime: -1 } }).limit(1).toArray();
|
||||||
|
|
||||||
|
// 没有活动数
|
||||||
|
if (hdinfo.length <= 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let hd = hdinfo[0];
|
||||||
|
let hdid = hdinfo[0].hdid;
|
||||||
|
// 活动结束
|
||||||
|
if (hd.etime < G.time - 300) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let today = PublicShared.getDiff(hd.stime, G.time - 300);
|
||||||
|
G.mongodb.collection("event").find({ type: `huangqijiuguan_${hdid}` }).toArray().then(datas => {
|
||||||
|
let hddata = hd.data as Data;
|
||||||
|
for (let i = 0; i < datas.length; i++) {
|
||||||
|
let data = datas[i];
|
||||||
|
|
||||||
|
let lvprize: { lv: number; need?: number; prize?: atn[] };
|
||||||
|
let dps = data.bossres.todaydps[today] || 0;
|
||||||
|
for (let lvinfo of hddata.bossLvReward) {
|
||||||
|
if (dps < lvinfo.need) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!lvprize || lvprize.lv < lvinfo.lv) {
|
||||||
|
lvprize = lvinfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!lvprize) continue
|
||||||
|
let title = hddata.bossLvReward_title;
|
||||||
|
let content = hddata.bossLvReward_des;
|
||||||
|
EmailFun.addEmail({
|
||||||
|
uid: data.uid,
|
||||||
|
title: title,
|
||||||
|
type: "system",
|
||||||
|
content: content,
|
||||||
|
prize: lvprize.prize,
|
||||||
|
contentInsertArr: [lvprize.lv],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
console.log(
|
||||||
|
"黄旗酒馆 每日伤害等级奖励结算 执行完成!!!"
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大伤害排行奖励结算
|
||||||
|
*/
|
||||||
|
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, rtime: { $gt: yesterday, $lte: today }
|
||||||
|
}).toArray();
|
||||||
|
|
||||||
|
// 没有活动数 或者发奖标识已设置
|
||||||
|
if (hdinfo.length <= 0 || hdinfo[0].data.sendrank) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let hd = hdinfo[0];
|
||||||
|
let hdid = hdinfo[0].hdid;
|
||||||
|
let hddata = hdinfo[0].data as Data;
|
||||||
|
if (hd.data.sendrank) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let uids = await G.mongodb.collection("event").find(
|
||||||
|
{ type: this.dataType(hdid) },
|
||||||
|
{
|
||||||
|
sort: { "bossres.maxdps": -1, "bossres.zhanli": -1 },
|
||||||
|
projection: { uid: 1, bossres: 1 }
|
||||||
|
}
|
||||||
|
).toArray();
|
||||||
|
|
||||||
|
for (let rank = 1; rank <= uids.length; rank++) {
|
||||||
|
let con = hd.data.bossRank.filter(
|
||||||
|
(x: { rank: number[] }) => rank >= x.rank[0] && rank <= x.rank[1]
|
||||||
|
)[0];
|
||||||
|
if (!con) continue;
|
||||||
|
// 发送排名奖励
|
||||||
|
await EmailFun.addEmail({
|
||||||
|
uid: uids[rank - 1].uid,
|
||||||
|
title: hd.data.bossRank_title,
|
||||||
|
type: "system",
|
||||||
|
content: hd.data.bossRank_des,
|
||||||
|
prize: con.prize,
|
||||||
|
contentInsertArr: [rank],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 标记已发送
|
||||||
|
await G.mongodb.collection("hdinfo").updateOne(
|
||||||
|
{ hdid: hdid }, { $set: { "data.sendrank": true } }
|
||||||
|
);
|
||||||
|
// 货币兑换
|
||||||
|
G.mongodb.collection("user").find().toArray().then(async (users) => {
|
||||||
|
for (let i = 0; i < users.length; i++) {
|
||||||
|
let prize = [];
|
||||||
|
let change = {};
|
||||||
|
let user = users[i];
|
||||||
|
for (let con of hddata.zhuanhuan) {
|
||||||
|
let num = user[con.start.t];
|
||||||
|
if (num < con.start.n) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
change[con.start.t] = 0;
|
||||||
|
prize.push({
|
||||||
|
a: con.end.a, t: con.end.t, n: con.end.n * (num / con.start.n),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (prize.length <= 0) continue
|
||||||
|
// 扣除消耗
|
||||||
|
await PlayerFun.changeAttr(user.uid, change);
|
||||||
|
G.server?.sendMsgByUid(user.uid, "msg_s2c/PlayerChange", change);
|
||||||
|
// 发送奖励邮件
|
||||||
|
await EmailFun.addEmail({
|
||||||
|
uid: user.uid,
|
||||||
|
type: "system",
|
||||||
|
prize: prize,
|
||||||
|
title: hddata.end_mail_title,
|
||||||
|
content: hddata.end_mail_des,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
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);
|
||||||
|
let tasks = hd.data.task[`day${today}`];
|
||||||
|
|
||||||
|
if (!tasks) return
|
||||||
|
|
||||||
|
let mydata = await this.getMydata(call, hd.hdid);
|
||||||
|
|
||||||
|
if (!mydata.task.val[`day${today}`]) {
|
||||||
|
mydata.task.val[`day${today}`] = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
let isset = 0;
|
||||||
|
let setData = {
|
||||||
|
$inc: {},
|
||||||
|
$set: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
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) { // 累加
|
||||||
|
mydata.task.val[`day${today}`][taskid] = (mydata.task.val[`day${today}`][taskid] || 0) + val
|
||||||
|
setData["$inc"][`task.val.day${today}.${taskid}`] = val
|
||||||
|
} else {
|
||||||
|
mydata.task.val[`day${today}`][taskid] = val
|
||||||
|
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)
|
||||||
|
|
||||||
|
if ((await this.getHongDian(call, hd, mydata)).show) {
|
||||||
|
G.server.sendMsgByUid(call.uid, "msg_s2c/HongDianChange", ["huodonghd"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 PlayerFun.sendPrize(call, prize, true);
|
||||||
|
await this.setMyData(call.uid, hd.hdid, { giftbuy: mydata.giftbuy });
|
||||||
|
}
|
||||||
|
|
||||||
|
static async getHongDian(call: ApiCall, hd: ReqAddHuoDong, mydata?: PlayerData) {
|
||||||
|
let hdid = hd.hdid;
|
||||||
|
let hddata = hd.data as Data;
|
||||||
|
|
||||||
|
mydata = mydata || await this.getMydata(call, hdid);
|
||||||
|
// 当黄旗招募存在可领取的可选奖励时
|
||||||
|
for (let i = 0; i < hddata.choukajiangli.length; i++) {
|
||||||
|
let ele = hddata.choukajiangli[i];
|
||||||
|
if (mydata.zhaomu.num >= ele.num && !mydata.zhaomu.prize.includes(i)) {
|
||||||
|
return { show: true }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let today = this.today(hd);
|
||||||
|
// 当今日没有进行boss挑战时
|
||||||
|
if (!mydata.bossres.todaydps[today]) {
|
||||||
|
return { show: true }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当每日任务界面存在可领取的任务奖励时
|
||||||
|
for (let day = 1; day <= today; day++) {
|
||||||
|
for (let taskid in hddata.task[`day${day}`]) {
|
||||||
|
let task = hddata.task[`day${day}`][taskid];
|
||||||
|
if (mydata.task.val[`day${day}`]?.[taskid] >= task.pval && !(mydata.task.rec?.[`day${day}`] || []).includes(Number(taskid))) {
|
||||||
|
return { show: true }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当干部挑战界面存在可领取的挑战任务奖励时
|
||||||
|
for (let mb of hddata.bossTask) {
|
||||||
|
if (mb.need <= mydata.bossres.maxdps && !mydata.bossres.recdpstask.includes(mb.id)) {
|
||||||
|
return { show: true }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当存在可以领取的免费礼包时
|
||||||
|
for (let gift of hddata.gift) {
|
||||||
|
if (gift.free && (mydata.giftbuy[gift.id]?.num || 0) < gift.buynum) {
|
||||||
|
return { show: true }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { show: false }
|
||||||
|
}
|
||||||
|
}
|
@ -21,6 +21,7 @@ import kfjsFun from "../../public/kaifujingsai";
|
|||||||
import {RankKfjs} from "../../public/rank/rank_kfjs";
|
import {RankKfjs} from "../../public/rank/rank_kfjs";
|
||||||
import {ShopFun} from "../../public/shop";
|
import {ShopFun} from "../../public/shop";
|
||||||
import {Christmasfun} from '../event/christmas/fun';
|
import {Christmasfun} from '../event/christmas/fun';
|
||||||
|
import HQJGFun from '../event/huangqijiuguan/fun';
|
||||||
|
|
||||||
export class HongDianFun {
|
export class HongDianFun {
|
||||||
/**黑榜争霸红点 */
|
/**黑榜争霸红点 */
|
||||||
@ -352,6 +353,10 @@ export class HuoDongHongDianFun {
|
|||||||
// 检测 htype 10 元旦活动红点
|
// 检测 htype 10 元旦活动红点
|
||||||
ishd = await this.yuandan(call, element)
|
ishd = await this.yuandan(call, element)
|
||||||
}
|
}
|
||||||
|
if (element.htype == 15) {
|
||||||
|
// 检测 htype 15 黄芪酒馆活动红点
|
||||||
|
ishd = await HQJGFun.getHongDian(call, element)
|
||||||
|
}
|
||||||
|
|
||||||
// 此活动有红点
|
// 此活动有红点
|
||||||
if (ishd.show) {
|
if (ishd.show) {
|
||||||
|
@ -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));
|
||||||
}
|
}
|
25897
src/json/huodong.json5
25897
src/json/huodong.json5
File diff suppressed because it is too large
Load Diff
@ -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<{
|
||||||
|
@ -359,6 +359,10 @@ class Lng {
|
|||||||
|
|
||||||
weiwang_12: "weiwang_12";
|
weiwang_12: "weiwang_12";
|
||||||
|
|
||||||
|
hqjgtips_27: "hqjgtips_27";
|
||||||
|
hqjgtips_28: "hqjgtips_28";
|
||||||
|
hqjgtips_29: "hqjgtips_29";
|
||||||
|
|
||||||
"11111" = "globalThis.lng.chat_1"
|
"11111" = "globalThis.lng.chat_1"
|
||||||
// return call.error('', { code: -3, message: globalThis.lng.chat_2 });
|
// return call.error('', { code: -3, message: globalThis.lng.chat_2 });
|
||||||
}
|
}
|
@ -24,6 +24,7 @@ import {ResOpen as ResOpenZhoumolibao} from '../shared/protocols/event/zhoumolib
|
|||||||
import {ResOpen as ResOpenPobinglibao} from '../shared/protocols/event/pobinglibao/PtlOpen';
|
import {ResOpen as ResOpenPobinglibao} from '../shared/protocols/event/pobinglibao/PtlOpen';
|
||||||
import {ResOpen as ResOpenLeiChongLiBao} from '../shared/protocols/event/leichonglibao/PtlOpen';
|
import {ResOpen as ResOpenLeiChongLiBao} from '../shared/protocols/event/leichonglibao/PtlOpen';
|
||||||
import {event as ResOpenYuandan} from '../shared/protocols/event/yuandan/PtlOpen';
|
import {event as ResOpenYuandan} from '../shared/protocols/event/yuandan/PtlOpen';
|
||||||
|
import {PlayerData} from "../api_s2c/event/huangqijiuguan/fun";
|
||||||
|
|
||||||
export type eventType = {
|
export type eventType = {
|
||||||
shouchong: {
|
shouchong: {
|
||||||
@ -74,6 +75,7 @@ export type eventType = {
|
|||||||
[k: `leichonglibao${number}`]: ResOpenLeiChongLiBao & { opentime: number };
|
[k: `leichonglibao${number}`]: ResOpenLeiChongLiBao & { opentime: number };
|
||||||
[k: `yuandan${number}`]: ResOpenYuandan;
|
[k: `yuandan${number}`]: ResOpenYuandan;
|
||||||
[k: `pobinglibao${number}`]: ResOpenPobinglibao;
|
[k: `pobinglibao${number}`]: ResOpenPobinglibao;
|
||||||
|
[k: `huangqijiuguan_${number}`]: PlayerData;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CollectionEvent<T extends keyof eventType> = {
|
export type CollectionEvent<T extends keyof eventType> = {
|
||||||
|
@ -11,7 +11,7 @@ import { re, string } from "mathjs";
|
|||||||
import { getGud } from './gud';
|
import { getGud } from './gud';
|
||||||
import { PushGiftFun } from "./pushgift";
|
import { PushGiftFun } from "./pushgift";
|
||||||
|
|
||||||
type fightType = 'tanxian' | 'pata' | 'jjc' | 'gbtx' | 'qjzzd' | 'meirishilian' | 'wzrycross';
|
type fightType = 'tanxian' | 'pata' | 'jjc' | 'gbtx' | 'qjzzd' | 'meirishilian' | 'wzrycross' | 'hqjg';
|
||||||
|
|
||||||
|
|
||||||
let fights: { [key: string]: FightControl } = {
|
let fights: { [key: string]: FightControl } = {
|
||||||
|
@ -127,7 +127,7 @@ export class PlayerFun {
|
|||||||
/**
|
/**
|
||||||
* 发送奖励
|
* 发送奖励
|
||||||
*/
|
*/
|
||||||
static async sendPrize(call: call, prizeList: atn[]) {
|
static async sendPrize(call: call, prizeList: atn[], pushToClient=false) {
|
||||||
prizeList = PublicShared.mergePrize(prizeList);
|
prizeList = PublicShared.mergePrize(prizeList);
|
||||||
|
|
||||||
let attr = prizeList.filter(atn => atn.a == 'attr' && atn.n != 0);
|
let attr = prizeList.filter(atn => atn.a == 'attr' && atn.n != 0);
|
||||||
@ -150,6 +150,14 @@ export class PlayerFun {
|
|||||||
heroskin.length > 0 && this.addHeroskin(call, heroskin),
|
heroskin.length > 0 && this.addHeroskin(call, heroskin),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if(pushToClient){
|
||||||
|
G.server.sendMsgByUid(call.uid, 'msg_s2c/Collection', {
|
||||||
|
fromApi: `PlayerFun_sendPrize`,
|
||||||
|
msg: call.eventMsg
|
||||||
|
});
|
||||||
|
call.eventMsg = {};
|
||||||
|
}
|
||||||
|
|
||||||
return prizeList;
|
return prizeList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@ export class SchedulerNewDayLocalCtor extends Scheduler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async start() {
|
async start() {
|
||||||
|
|
||||||
clusterRunOnce(async ()=>{
|
clusterRunOnce(async () => {
|
||||||
//这个定时器会被每个进程都启动,这是这部分逻辑,应该只执行1次
|
//这个定时器会被每个进程都启动,这是这部分逻辑,应该只执行1次
|
||||||
|
|
||||||
//重置所有的ActionLog
|
//重置所有的ActionLog
|
||||||
@ -39,7 +39,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("没有终身卡数据,不发放终身卡");
|
||||||
}
|
}
|
||||||
@ -54,11 +54,14 @@ export class SchedulerNewDayLocalCtor extends Scheduler {
|
|||||||
content: con.content,
|
content: con.content,
|
||||||
contentInsertArr: [],
|
contentInsertArr: [],
|
||||||
createTime: G.time,
|
createTime: G.time,
|
||||||
prize:con.prize,
|
prize: con.prize,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
|
|
||||||
|
// 转点刷新事件
|
||||||
|
G.emit('NEW_DAY', G.time);
|
||||||
})
|
})
|
||||||
|
|
||||||
let users = Object.values(G.server.uid_connections)
|
let users = Object.values(G.server.uid_connections)
|
||||||
|
@ -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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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)
|
||||||
};
|
};
|
||||||
|
|
||||||
}()]))
|
}()]))
|
||||||
|
11
src/shared/protocols/event/huangqijiuguan/PtlDuiHuan.ts
Normal file
11
src/shared/protocols/event/huangqijiuguan/PtlDuiHuan.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { PlayerData } from "../../../../api_s2c/event/huangqijiuguan/fun"
|
||||||
|
|
||||||
|
export interface ReqDuiHuan {
|
||||||
|
hdid: number
|
||||||
|
dh: { [id: number]: number }
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ResDuiHuan {
|
||||||
|
data: PlayerData
|
||||||
|
prize: { a: string, t: string, n: number }[]
|
||||||
|
}
|
11
src/shared/protocols/event/huangqijiuguan/PtlFight.ts
Normal file
11
src/shared/protocols/event/huangqijiuguan/PtlFight.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { PlayerData } from "../../../../api_s2c/event/huangqijiuguan/fun";
|
||||||
|
import { fightResult } from "../../../fightControl/fightType";
|
||||||
|
|
||||||
|
export interface ReqFight {
|
||||||
|
hdid: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ResFight {
|
||||||
|
data: PlayerData
|
||||||
|
result: fightResult;
|
||||||
|
}
|
11
src/shared/protocols/event/huangqijiuguan/PtlGiftRec.ts
Normal file
11
src/shared/protocols/event/huangqijiuguan/PtlGiftRec.ts
Normal 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 }[]
|
||||||
|
}
|
11
src/shared/protocols/event/huangqijiuguan/PtlGiftSelect.ts
Normal file
11
src/shared/protocols/event/huangqijiuguan/PtlGiftSelect.ts
Normal 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
|
||||||
|
}
|
9
src/shared/protocols/event/huangqijiuguan/PtlOpen.ts
Normal file
9
src/shared/protocols/event/huangqijiuguan/PtlOpen.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { PlayerData } from "../../../../api_s2c/event/huangqijiuguan/fun"
|
||||||
|
|
||||||
|
export interface ReqOpen {
|
||||||
|
hdid: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ResOpen {
|
||||||
|
data: PlayerData
|
||||||
|
}
|
7
src/shared/protocols/event/huangqijiuguan/PtlRankList.ts
Normal file
7
src/shared/protocols/event/huangqijiuguan/PtlRankList.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export interface ReqRankList {
|
||||||
|
hdid: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ResRankList {
|
||||||
|
rankList: any[]
|
||||||
|
}
|
11
src/shared/protocols/event/huangqijiuguan/PtlRecDpsPrize.ts
Normal file
11
src/shared/protocols/event/huangqijiuguan/PtlRecDpsPrize.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { PlayerData } from "../../../../api_s2c/event/huangqijiuguan/fun"
|
||||||
|
|
||||||
|
export interface ReqRecDpsPrize {
|
||||||
|
hdid: number
|
||||||
|
recid: number[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ResRecDpsPrize {
|
||||||
|
data: PlayerData,
|
||||||
|
prize: { a: string, t: string, n: number }[]
|
||||||
|
}
|
13
src/shared/protocols/event/huangqijiuguan/PtlTaskRec.ts
Normal file
13
src/shared/protocols/event/huangqijiuguan/PtlTaskRec.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { PlayerData } from "../../../../api_s2c/event/huangqijiuguan/fun"
|
||||||
|
|
||||||
|
export interface ReqTaskRec {
|
||||||
|
day: number
|
||||||
|
hdid: number
|
||||||
|
taskid: number[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ResTaskRec {
|
||||||
|
data: PlayerData
|
||||||
|
prize: { a: string, t: string, n: number }[]
|
||||||
|
}
|
||||||
|
|
12
src/shared/protocols/event/huangqijiuguan/PtlZhaoMu.ts
Normal file
12
src/shared/protocols/event/huangqijiuguan/PtlZhaoMu.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { PlayerData } from "../../../../api_s2c/event/huangqijiuguan/fun"
|
||||||
|
|
||||||
|
|
||||||
|
export interface ReqZhaoMu {
|
||||||
|
num: number
|
||||||
|
hdid: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ResZhaoMu {
|
||||||
|
data: PlayerData
|
||||||
|
prize: { a: string, t: string, n: number }[]
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
import { PlayerData } from "../../../../api_s2c/event/huangqijiuguan/fun"
|
||||||
|
|
||||||
|
export interface ReqZhaoMuPrizeRec {
|
||||||
|
hdid: number
|
||||||
|
recid: { idx: number, sec: string }[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ResZhaoMuPrizeRec {
|
||||||
|
data: PlayerData
|
||||||
|
prize: { a: string, t: string, n: number }[]
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user