Compare commits

...

2 Commits

Author SHA1 Message Date
dy
04533c80f4 fix pata/saodang 2024-01-04 11:20:00 +08:00
dy
98a3927966 fix lingzhulaixi 2024-01-04 11:05:05 +08:00
5 changed files with 43 additions and 44 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

View File

@ -1,10 +1,10 @@
import { ApiCall } from "tsrpc";
import { PataFun } from "../../public/pata";
import { PlayerFun } from "../../public/player";
import { ReqSaoDang, ResSaoDang } from "../../shared/protocols/pata/PtlSaoDang";
import { PlayerShared } from '../../shared/public/player';
import { PublicShared } from "../../shared/public/public";
import { HongDianChange } from "../hongdian/fun";
import {ApiCall} from "tsrpc";
import {PataFun} from "../../public/pata";
import {PlayerFun} from "../../public/player";
import {ReqSaoDang, ResSaoDang} from "../../shared/protocols/pata/PtlSaoDang";
import {PlayerShared} from '../../shared/public/player';
import {PublicShared} from "../../shared/public/public";
import {HongDianChange} from "../hongdian/fun";
export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
let changeInfo = await PataFun.getInfo(call.uid);
@ -25,11 +25,11 @@ export default async function (call: ApiCall<ReqSaoDang, ResSaoDang>) {
changeInfo.saodangNum = call.req.num + (changeInfo?.saodangNum || 0);
// 改变的数据
let setData = {
saodangNum: changeInfo.saodangNum
};
// let setData = {
// saodangNum: changeInfo.saodangNum
// };
// 设置数据
await PataFun.changeInfo(call.uid, changeInfo.sid, { $set: setData });
await PataFun.changeInfo(call.uid, changeInfo.sid, {"$inc": {saodangNum: call.req.num}});
_prize = await PlayerFun.sendPrize(call, _prize);
let data = {

View File

@ -11,8 +11,8 @@
},
{
"key":"got_rmbmoney",
"limit":30000,
"tips":"钻石获取达到3万"
"limit":50000,
"tips":"钻石获取达到5万"
},
{
"key":"use_attr_rmbmoney",
@ -21,8 +21,8 @@
},
{
"key":"tanxian/FastGuaJi",
"limit":40,
"tips":"快速探险达到40次"
"limit":30,
"tips":"快速探险达到30次"
},
{
"key":"xstask/Receive/Num",

View File

@ -1,12 +1,12 @@
import { UpdateFilter } from 'mongodb';
import { paTaType } from '../shared/protocols/pata/type';
import { PublicShared } from '../shared/public/public';
import {UpdateFilter} from 'mongodb';
import {paTaType} from '../shared/protocols/pata/type';
import {PublicShared} from '../shared/public/public';
export class PataFun {
/**获取爬塔信息 */
static async getInfo(uid: string, sid: number = 0) {
let info: paTaType = await G.mongodb.collection('pata').findOne({ uid: uid, sid: sid });
let info: paTaType = await G.mongodb.collection('pata').findOne({uid: uid, sid: sid});
let nt = G.time;
if (!info) {
info = {
@ -17,7 +17,7 @@ export class PataFun {
sid: sid,
saodangNum: 0
};
this.changeInfo(uid, info.sid, { $set: info });
this.changeInfo(uid, info.sid, {$set: info});
}
/** 第二天 */
@ -27,7 +27,7 @@ export class PataFun {
useNum: 0,
saodangNum: 0
};
this.changeInfo(uid, info.sid, { $set: setData });
this.changeInfo(uid, info.sid, {$set: setData});
}
if (info['_id']) {
@ -38,20 +38,19 @@ export class PataFun {
}
/**修改爬塔信息 */
static async changeInfo(uid: string, sid: number, change: Pick<UpdateFilter<paTaType>, '$set'>) {
G.mongodb.collection('pata').updateOne(
{ uid: uid, sid: sid },
static async changeInfo(uid: string, sid: number, change: Pick<UpdateFilter<paTaType>, string>) {
await G.mongodb.collection('pata').updateOne(
{uid: uid, sid: sid},
change,
{ upsert: true }
{upsert: true}
);
}
/**获取爬塔红点 */
static async getHongDian(uid: string) {
let mydata = await this.getInfo(uid);
let con = Object.keys(G.gc.patacom);
con.sort((a, b) => { return parseInt(a) - parseInt(b); });
con.sort((a, b) => parseInt(a) - parseInt(b));
for (let idx in con) {
idx = con[idx];
if (mydata.lv <= parseInt(idx)) {