feat:
黄旗酒馆
This commit is contained in:
parent
7c3b5e985c
commit
61afa26e45
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 })
|
||||
}
|
40
src/api_s2c/event/huangqijiuguan/ApiFight.ts
Normal file
40
src/api_s2c/event/huangqijiuguan/ApiFight.ts
Normal file
@ -0,0 +1,40 @@
|
||||
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 HuoDongFun.getHdidInfo(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.bossId, '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 });
|
||||
}
|
16
src/api_s2c/event/huangqijiuguan/ApiOpen.ts
Normal file
16
src/api_s2c/event/huangqijiuguan/ApiOpen.ts
Normal file
@ -0,0 +1,16 @@
|
||||
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<ReqOpen, ResOpen>) => {
|
||||
let hd = HuoDongFun.getHdidInfo(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 }));
|
||||
}
|
47
src/api_s2c/event/huangqijiuguan/ApiRecDpsPrize.ts
Normal file
47
src/api_s2c/event/huangqijiuguan/ApiRecDpsPrize.ts
Normal file
@ -0,0 +1,47 @@
|
||||
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<ReqRecDpsPrize, ResRecDpsPrize>) {
|
||||
let hd = await HuoDongFun.getHdidInfo(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 })
|
||||
}
|
52
src/api_s2c/event/huangqijiuguan/ApiTaskRec.ts
Normal file
52
src/api_s2c/event/huangqijiuguan/ApiTaskRec.ts
Normal file
@ -0,0 +1,52 @@
|
||||
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 });
|
||||
}
|
48
src/api_s2c/event/huangqijiuguan/ApiZhaoMu.ts
Normal file
48
src/api_s2c/event/huangqijiuguan/ApiZhaoMu.ts
Normal file
@ -0,0 +1,48 @@
|
||||
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 = 0; 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 = 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 })
|
||||
}
|
36
src/api_s2c/event/huangqijiuguan/ApiZhaoMuPrizeRec.ts
Normal file
36
src/api_s2c/event/huangqijiuguan/ApiZhaoMuPrizeRec.ts
Normal file
@ -0,0 +1,36 @@
|
||||
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];
|
||||
if (con.num > mydata.zhaomu.num || mydata.zhaomu.prize.includes(rec)) {
|
||||
continue
|
||||
}
|
||||
|
||||
mydata.zhaomu.prize.push(rec);
|
||||
prize = prize.concat(con.prize);
|
||||
}
|
||||
|
||||
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 })
|
||||
}
|
310
src/api_s2c/event/huangqijiuguan/fun.ts
Normal file
310
src/api_s2c/event/huangqijiuguan/fun.ts
Normal file
@ -0,0 +1,310 @@
|
||||
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"
|
||||
|
||||
// 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 }
|
||||
}
|
||||
}
|
||||
|
||||
huobi: atn // 抽卡货币
|
||||
bossId: number // boss表的ID
|
||||
|
||||
// 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[] }[]
|
||||
|
||||
baodi: { num: number, prize: any[] }[]
|
||||
|
||||
gift: { id: number, free: boolean, payId: string, buynum: number, prize: 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[] }
|
||||
}
|
||||
|
||||
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) },
|
||||
{
|
||||
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> {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** 获取我的数据 */
|
||||
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 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() {
|
||||
// 取stime小于当前时间的最后一条数据
|
||||
let hdinfo = await G.mongodb.collection("hdinfo").find({
|
||||
htype: this.htype, stime: { $lte: G.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],
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 最大伤害排行奖励结算
|
||||
*/
|
||||
static async endDpsRankPrize() {
|
||||
// 取stime小于当前时间的最后一条数据
|
||||
let hdinfo = await G.mongodb.collection("hdinfo").find({
|
||||
htype: this.htype, stime: { $lte: G.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 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],
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
25897
src/json/huodong.json5
25897
src/json/huodong.json5
File diff suppressed because it is too large
Load Diff
@ -356,6 +356,10 @@ class Lng {
|
||||
|
||||
weiwang_12: "weiwang_12";
|
||||
|
||||
hqjgtips_27: "hqjgtips_27";
|
||||
hqjgtips_28: "hqjgtips_28";
|
||||
hqjgtips_29: "hqjgtips_29";
|
||||
|
||||
"11111" = "globalThis.lng.chat_1"
|
||||
// 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 ResOpenLeiChongLiBao} from '../shared/protocols/event/leichonglibao/PtlOpen';
|
||||
import {event as ResOpenYuandan} from '../shared/protocols/event/yuandan/PtlOpen';
|
||||
import {PlayerData} from "../api_s2c/event/huangqijiuguan/fun";
|
||||
|
||||
export type eventType = {
|
||||
shouchong: {
|
||||
@ -74,6 +75,7 @@ export type eventType = {
|
||||
[k: `leichonglibao${number}`]: ResOpenLeiChongLiBao & { opentime: number };
|
||||
[k: `yuandan${number}`]: ResOpenYuandan;
|
||||
[k: `pobinglibao${number}`]: ResOpenPobinglibao;
|
||||
[k: `huangqijiuguan_${number}`]: PlayerData;
|
||||
};
|
||||
|
||||
export type CollectionEvent<T extends keyof eventType> = {
|
||||
|
@ -11,7 +11,7 @@ import { re, string } from "mathjs";
|
||||
import { getGud } from './gud';
|
||||
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 } = {
|
||||
|
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;
|
||||
}
|
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: number[]
|
||||
}
|
||||
|
||||
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