fix lingzhulaixi

This commit is contained in:
dy 2024-01-04 11:05:05 +08:00
parent eb73af1dd2
commit 98a3927966
2 changed files with 16 additions and 16 deletions

View File

@ -91,13 +91,13 @@ export default async function (call: ApiCall<ReqPkBoss, ResPkBoss>) {
}
_mySetDat = {
maxdps: _myData.maxdps,
time: _myData.time,
}
_bossData.delhp += result.totalDamage[0]
}
// 无论挑战成功失败都扣除战斗次数
_mySetDat["num"] = _myData.num + 1;
_mySetDat["time"] = G.time;
// 设置boss数据
await LingZhuLaiXifun.setBossData(_bossData.bid, _setData)

View File

@ -1,33 +1,33 @@
import { ApiCall } from "tsrpc";
import { LingZhuLaiXifun } from "../../public/lingzhulaixi";
import { PlayerFun } from "../../public/player";
import { ReqSaoDang, ResSaoDang } from "../../shared/protocols/lingzhulaixi/PtlSaoDang";
import { PublicShared } from "../../shared/public/public";
import { HongDianChange } from "../hongdian/fun";
import {ApiCall} from "tsrpc";
import {LingZhuLaiXifun} from "../../public/lingzhulaixi";
import {PlayerFun} from "../../public/player";
import {ReqSaoDang, ResSaoDang} from "../../shared/protocols/lingzhulaixi/PtlSaoDang";
import {PublicShared} from "../../shared/public/public";
import {HongDianChange} from "../hongdian/fun";
import {ActionLog} from "../../public/actionLog/actionLog";
export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
let _con = await LingZhuLaiXifun.getCon(call.req.bid)
if (!_con) {
// 参数错误,无相关配置
return call.error('', { code: -1, message: globalThis.lng.lingzhulaixi_1 })
return call.error('', {code: -1, message: globalThis.lng.lingzhulaixi_1})
}
if (call.conn.gud.lv < _con.lv) {
// 等级不足
return call.error('', { code: -2, message: globalThis.lng.lingzhulaixi_2 })
return call.error('', {code: -2, message: globalThis.lng.lingzhulaixi_2})
}
// boss信息
let _bossData = await LingZhuLaiXifun.getBossData(call.req.bid)
if (_bossData.passtime != 0) {
// boss 未复活
return call.error('', { code: -3, message: globalThis.lng.lingzhulaixi_4 })
return call.error('', {code: -3, message: globalThis.lng.lingzhulaixi_4})
}
if (!_bossData.pkuser[call.uid]) {
// 未挑战过,请先去挑战
return call.error('', { code: -4, message: globalThis.lng.lingzhulaixi_5 })
return call.error('', {code: -4, message: globalThis.lng.lingzhulaixi_5})
}
let _myData = await LingZhuLaiXifun.getUsePKNum(call)
@ -54,7 +54,7 @@ export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
if (!prize[0]) {
// 无奖励,没有挑战次数
return call.error('', { code: -5, message: globalThis.lng.lingzhulaixi_6 })
return call.error('', {code: -5, message: globalThis.lng.lingzhulaixi_6})
}
let _setData // 设置数据
@ -71,8 +71,8 @@ export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
Object.assign(_bossData, _setData["$set"])
// 清除玩家数据
await G.mongodb.cPlayerInfo('lingzhulaixi').updateMany(
{ type: 'lingzhulaixi' },
{ $set: G.mongodb.createTreeObj({ key: `maxdps.${call.req.bid}`, val: 0 }) }
{type: 'lingzhulaixi'},
{$set: G.mongodb.createTreeObj({key: `maxdps.${call.req.bid}`, val: 0})}
)
} else {
_setData = {
@ -86,13 +86,13 @@ export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
// 设置boss数据
await LingZhuLaiXifun.setBossData(_bossData.bid, _setData)
await LingZhuLaiXifun.setMyData(call, { $inc: { num: _num } })
await LingZhuLaiXifun.setMyData(call, {$inc: {num: _num}, $set: {time: G.time}})
// 发奖
prize = PublicShared.mergePrize(prize)
await PlayerFun.sendPrize(call, prize)
ActionLog.addDayLog(call.uid, { key: "lingzhulaixi/PkBoss", val: _num });
ActionLog.addDayLog(call.uid, {key: "lingzhulaixi/PkBoss", val: _num});
// 扣除挑战次数
_myData.num += _num