feat:黄旗酒馆
This commit is contained in:
parent
52c24d4507
commit
9154278020
@ -5,6 +5,7 @@ import { PublicShared } from "../../../shared/public/public"
|
|||||||
import { EmailFun } from "../../../public/email"
|
import { EmailFun } from "../../../public/email"
|
||||||
import { playerInfo } from "../../../shared/protocols/user/PtlLogin"
|
import { playerInfo } from "../../../shared/protocols/user/PtlLogin"
|
||||||
import { PlayerFun } from "../../../public/player"
|
import { PlayerFun } from "../../../public/player"
|
||||||
|
import { Player } from "../../../shared/fightControl/Player"
|
||||||
|
|
||||||
// hddata.data
|
// hddata.data
|
||||||
export interface Data {
|
export interface Data {
|
||||||
@ -44,6 +45,10 @@ export interface Data {
|
|||||||
bossTask: { id: number, need: number, prize: atn[] }[]
|
bossTask: { id: number, need: number, prize: atn[] }[]
|
||||||
|
|
||||||
bossRank: { id: string, rank: [number, 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 {
|
export interface PlayerData {
|
||||||
@ -279,13 +284,14 @@ export default class HQJGFun {
|
|||||||
htype: this.htype, rtime: { $gt: yesterday, $lte: today }
|
htype: this.htype, rtime: { $gt: yesterday, $lte: today }
|
||||||
}).toArray();
|
}).toArray();
|
||||||
|
|
||||||
// 没有活动数
|
// 没有活动数 或者发奖标识已设置
|
||||||
if (hdinfo.length <= 0) {
|
if (hdinfo.length <= 0 || hdinfo[0].data.sendrank) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let hd = hdinfo[0];
|
let hd = hdinfo[0];
|
||||||
let hdid = hdinfo[0].hdid;
|
let hdid = hdinfo[0].hdid;
|
||||||
|
let hddata = hdinfo[0].data as Data;
|
||||||
if (hd.data.sendrank) {
|
if (hd.data.sendrank) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -317,6 +323,36 @@ export default class HQJGFun {
|
|||||||
await G.mongodb.collection("hdinfo").updateOne(
|
await G.mongodb.collection("hdinfo").updateOne(
|
||||||
{ hdid: hdid }, { $set: { "data.sendrank": true } }
|
{ 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(
|
console.log(
|
||||||
"黄旗酒馆 最大伤害排行奖励结算 执行结束!!!"
|
"黄旗酒馆 最大伤害排行奖励结算 执行结束!!!"
|
||||||
|
Loading…
Reference in New Issue
Block a user