Merge remote-tracking branch 'origin/dev' into dev-shouchong

This commit is contained in:
xcy 2023-12-15 18:28:50 +08:00
commit fb6a6dfb38
10 changed files with 440 additions and 103 deletions

View File

@ -1,39 +1,7 @@
import { ApiCall } from "tsrpc";
import { ReqSelect, ResSelect } from "../../../shared/protocols/event/christmas/PtlSelect";
import {Christmasfun} from "./fun";
import {HongDianChange} from "../../hongdian/fun";
export default async function (call: ApiCall<ReqSelect, ResSelect>) {
let initCon = await Christmasfun.getCon(call)
let index = call.req.index;
let pid = call.req.pid;
let lbid = call.req.lbid;
let _con = initCon[call.req.hdid].data.libao[lbid];
if (!_con) {
// 礼包id 不存在
return call.error('', { code: -1, message: globalThis.lng.yangchengmubiao_2 })
}
if (index >= _con.dlz.length){
// 礼包id 不存在
return call.error('', { code: -2, message: globalThis.lng.yangchengmubiao_2 })
}
if (index >= _con.dlz.length){
// 礼包id 不存在
return call.error('', { code: -3, message: globalThis.lng.yangchengmubiao_2 })
}
if (!_con.dlz[index][pid]){
// 礼包id 不存在
return call.error('', { code: -4, message: globalThis.lng.yangchengmubiao_2 })
}
let _mydata = await Christmasfun.getMyData(call, call.req.hdid)
let lb_select = _mydata.select[lbid] || {}
lb_select[index.toString()] = pid
_mydata.select[lbid] = lb_select
let _setData = {}
_setData["select"] = _mydata.select
await Christmasfun.setMyData(call.uid, call.req.hdid, { $set: _setData })
let changedata = { mydata: _mydata}
// 推送红点
HongDianChange.sendChangeKey(call.uid, ['huodonghd']);
call.succ(changedata);
// TODO
call.error('API Not Implemented');
}

View File

@ -1,37 +1,7 @@
import { ApiCall } from "tsrpc";
import { ReqTaskRec, ResTaskRec } from "../../../shared/protocols/event/christmas/PtlTaskRec";
import {Christmasfun} from "./fun";
import {HongDianChange} from "../../hongdian/fun";
import {PlayerFun} from "../../../public/player";
export default async function (call: ApiCall<ReqTaskRec, ResTaskRec>) {
let initCon = await Christmasfun.getCon(call)
let taskid = call.req.taskid;
let _con = initCon[call.req.hdid].data.task[taskid];
if (!_con) {
// 任务id 不存在
return call.error('', { code: -1, message: globalThis.lng.yangchengmubiao_2 })
}
let _mydata = await Christmasfun.getMyData(call, call.req.hdid)
if (_mydata.taskval[taskid] < _con.pval) {
// 任务未完成
return call.error('', { code: -2, message: globalThis.lng.yangchengmubiao_3 })
}
if (_mydata.taskfinish.includes(taskid)) {
// 任务已领取
return call.error('', { code: -3, message: globalThis.lng.yangchengmubiao_4 })
}
_mydata.taskfinish.push(taskid)
let _setData = {}
_setData["taskfinish"] = _mydata.taskfinish
await Christmasfun.setMyData(call.uid, call.req.hdid, { $set: _setData })
let _prize = _con.prize
await PlayerFun.sendPrize(call, _prize);
let changedata = { mydata: _mydata, prize: _prize}
// 推送红点
HongDianChange.sendChangeKey(call.uid, ['huodonghd']);
call.succ(changedata);
// TODO
call.error('API Not Implemented');
}

View File

@ -1,24 +1,24 @@
import { ApiCall } from "tsrpc";
import { KuangDongfun } from "../../public/kuangdong";
import { PlayerFun } from "../../public/player";
import { ReqYanShi, ResYanShi } from "../../shared/protocols/kuangdong/PtlYanShi";
import {ApiCall} from "tsrpc";
import {KuangDongfun} from "../../public/kuangdong";
import {PlayerFun} from "../../public/player";
import {ReqYanShi, ResYanShi} from "../../shared/protocols/kuangdong/PtlYanShi";
export default async function (call: ApiCall<ReqYanShi, ResYanShi>) {
let hdid = call.req.hdid
let kdInfo = await KuangDongfun.getKaiCaiInfo(hdid)
if (!kdInfo) {
return call.error('', { code: -1, message: globalThis.lng.kudangdong_1 })
return call.error('', {code: -1, message: globalThis.lng.kudangdong_1})
}
// 不是自己占领的
if (kdInfo.uid != call.uid) {
return call.error('', { code: -2, message: globalThis.lng.kudangdong_8 })
return call.error('', {code: -2, message: globalThis.lng.kudangdong_8})
}
// 已经延时
if (kdInfo.yanshi != 0) {
return call.error('', { code: -2, message: globalThis.lng.kudangdong_10 })
return call.error('', {code: -2, message: globalThis.lng.kudangdong_10})
}
// @ts-ignore
@ -30,7 +30,13 @@ export default async function (call: ApiCall<ReqYanShi, ResYanShi>) {
_need && await PlayerFun.cutNeed(call, _need);
kdInfo.yanshi = 8 * 3600
await KuangDongfun.setminingZhanLing(call.uid, hdid, { $set: { yanshi: kdInfo.yanshi } })
// 如果调用这个方法会upsert在没有查到数据的情况下
// 会插入空数据,全服玩家的查询列表接口都会报错
// await KuangDongfun.setminingZhanLing(call.uid, hdid, { $set: { yanshi: kdInfo.yanshi } })
await G.mongodb.collection('kuangdong').updateOne({uid: call.uid, hdid: hdid},
{$set: {yanshi: kdInfo.yanshi}});
kdInfo._id = kdInfo._id.toString()
let changeData = {
kdinfo: kdInfo

View File

@ -9,7 +9,10 @@ async function connGameLogDB() {
}else{
logDBUrl = "mongodb://root:lyMaple525458@10.0.1.20:27017/heijiao_gamelog?authSource=admin";
}
let client = await MongoClient.connect(logDBUrl,{maxPoolSize:10});
let client = await MongoClient.connect(logDBUrl,{
maxPoolSize:10,
maxIdleTimeMS: 5*60*1000
});
logDB = client.db(`gameLog${G.config.serverId}`);
return logDB;
}

View File

@ -425,6 +425,11 @@
"a": "attr",
"t": "rmbmoney",
"n": 980
},
{
"a": "hero",
"t": "4012",
"n": 1
}
],
"firstPayPrize": [],
@ -455,7 +460,7 @@
{
"a": "item",
"t": "4",
"n": 5
"n": 30
}
],
"firstPayPrize": [],
@ -481,12 +486,12 @@
{
"a": "attr",
"t": "rmbmoney",
"n": 980
"n": 5000
},
{
"a": "item",
"t": "4",
"n": 10
"a": "attr",
"t": "rmbmoney",
"n": 5000
}
],
"firstPayPrize": [],
@ -3587,7 +3592,13 @@
"wkdlibao_1": {
"id": "wkdlibao_1",
"money": 1,
"payExp": "[{\"a\": \"attr\", \"t\": \"payExp\", \"n\":10]",
"payExp": [
{
"a": "attr",
"t": "payExp",
"n": 10
}
],
"prize": [],
"firstPayPrize": [],
"name": "pay_name_wkdlibao_1",
@ -3717,5 +3728,378 @@
"needVip": 0,
"front": {},
"currency": "CNY"
}
},
"guanqialibao_1": {
"id": "guanqialibao_1",
"money": 6,
"payExp": [
{
"a": "attr",
"t": "payExp",
"n": 60
}
],
"prize": [
{
"a": "item",
"t": "49",
"n": 50
},
{
"a": "attr",
"t": "rmbmoney",
"n": 600
}
],
"firstPayPrize": [],
"name": "pay_name_guanqialibao_1",
"undefined": "关卡礼包_6",
"time": -1,
"buys": 1,
"needVip": 0,
"front": {},
"currency": "CNY"
},
"guanqialibao_2": {
"id": "guanqialibao_2",
"money": 30,
"payExp": [
{
"a": "attr",
"t": "payExp",
"n": 300
}
],
"prize": [
{
"a": "item",
"t": "49",
"n": 100
},
{
"a": "attr",
"t": "rmbmoney",
"n": 1360
}
],
"firstPayPrize": [],
"name": "pay_name_guanqialibao_2",
"undefined": "关卡礼包_30",
"time": -1,
"buys": 1,
"needVip": 0,
"front": {},
"currency": "CNY"
},
"guanqialibao_3": {
"id": "guanqialibao_3",
"money": 68,
"payExp": [
{
"a": "attr",
"t": "payExp",
"n": 680
}
],
"prize": [
{
"a": "item",
"t": "49",
"n": 200
},
{
"a": "attr",
"t": "rmbmoney",
"n": 2560
}
],
"firstPayPrize": [],
"name": "pay_name_guanqialibao_3",
"undefined": "关卡礼包_68",
"time": -1,
"buys": 1,
"needVip": 0,
"front": {},
"currency": "CNY"
},
"daojulibao_1": {
"id": "daojulibao_1",
"money": 6,
"payExp": [
{
"a": "attr",
"t": "payExp",
"n": 60
}
],
"prize": [
{
"a": "item",
"t": "49",
"n": 50
},
{
"a": "attr",
"t": "rmbmoney",
"n": 700
}
],
"firstPayPrize": [],
"name": "pay_name_daojulibao_1",
"undefined": "道具礼包_6",
"time": -1,
"buys": 1,
"needVip": 0,
"front": {},
"currency": "CNY"
},
"daojulibao_2": {
"id": "daojulibao_2",
"money": 30,
"payExp": [
{
"a": "attr",
"t": "payExp",
"n": 300
}
],
"prize": [
{
"a": "item",
"t": "49",
"n": 100
},
{
"a": "attr",
"t": "rmbmoney",
"n": 1260
}
],
"firstPayPrize": [],
"name": "pay_name_daojulibao_2",
"undefined": "道具礼包_30",
"time": -1,
"buys": 1,
"needVip": 0,
"front": {},
"currency": "CNY"
},
"daojulibao_3": {
"id": "daojulibao_3",
"money": 68,
"payExp": [
{
"a": "attr",
"t": "payExp",
"n": 680
}
],
"prize": [
{
"a": "item",
"t": "49",
"n": 200
},
{
"a": "attr",
"t": "rmbmoney",
"n": 2660
}
],
"firstPayPrize": [],
"name": "pay_name_daojulibao_3",
"undefined": "道具礼包_68",
"time": -1,
"buys": 1,
"needVip": 0,
"front": {},
"currency": "CNY"
},
"zhanbailibao_1": {
"id": "zhanbailibao_1",
"money": 6,
"payExp": [
{
"a": "attr",
"t": "payExp",
"n": 60
}
],
"prize": [
{
"a": "item",
"t": "49",
"n": 200
},
{
"a": "attr",
"t": "rmbmoney",
"n": 2660
}
],
"firstPayPrize": [],
"name": "pay_name_zhanbailibao_1",
"undefined": "战败礼包_68",
"time": -1,
"buys": 1,
"needVip": 0,
"front": {},
"currency": "CNY"
},
"zhanbailibao_2": {
"id": "zhanbailibao_2",
"money": 30,
"payExp": [
{
"a": "attr",
"t": "payExp",
"n": 300
}
],
"prize": [
{
"a": "item",
"t": "49",
"n": 200
},
{
"a": "attr",
"t": "rmbmoney",
"n": 2660
}
],
"firstPayPrize": [],
"name": "pay_name_zhanbailibao_2",
"undefined": "战败礼包_68",
"time": -1,
"buys": 1,
"needVip": 0,
"front": {},
"currency": "CNY"
},
"zhanbailibao_3": {
"id": "zhanbailibao_3",
"money": 68,
"payExp": [
{
"a": "attr",
"t": "payExp",
"n": 680
}
],
"prize": [
{
"a": "item",
"t": "49",
"n": 200
},
{
"a": "attr",
"t": "rmbmoney",
"n": 2660
}
],
"firstPayPrize": [],
"name": "pay_name_zhanbailibao_3",
"undefined": "战败礼包_68",
"time": -1,
"buys": 1,
"needVip": 0,
"front": {},
"currency": "CNY"
},
"choukalibao_1": {
"id": "choukalibao_1",
"money": 6,
"payExp": [
{
"a": "attr",
"t": "payExp",
"n": 60
}
],
"prize": [
{
"a": "item",
"t": "49",
"n": 200
},
{
"a": "attr",
"t": "rmbmoney",
"n": 2660
}
],
"firstPayPrize": [],
"name": "pay_name_choukalibao_1",
"undefined": "抽卡礼包_68",
"time": -1,
"buys": 1,
"needVip": 0,
"front": {},
"currency": "CNY"
},
"choukalibao_2": {
"id": "choukalibao_2",
"money": 30,
"payExp": [
{
"a": "attr",
"t": "payExp",
"n": 300
}
],
"prize": [
{
"a": "item",
"t": "49",
"n": 200
},
{
"a": "attr",
"t": "rmbmoney",
"n": 2660
}
],
"firstPayPrize": [],
"name": "pay_name_choukalibao_2",
"undefined": "抽卡礼包_68",
"time": -1,
"buys": 1,
"needVip": 0,
"front": {},
"currency": "CNY"
},
"choukalibao_3": {
"id": "choukalibao_3",
"money": 68,
"payExp": [
{
"a": "attr",
"t": "payExp",
"n": 680
}
],
"prize": [
{
"a": "item",
"t": "49",
"n": 200
},
{
"a": "attr",
"t": "rmbmoney",
"n": 2660
}
],
"firstPayPrize": [],
"name": "pay_name_choukalibao_3",
"undefined": "抽卡礼包_68",
"time": -1,
"buys": 1,
"needVip": 0,
"front": {},
"currency": "CNY"
},
"undefined": {}
}

View File

@ -1002,7 +1002,7 @@
"side": 4,
"randnum": 1,
"order": "rand",
"limit": 2,
"limit": 3,
"data": {
"pro": 0.95
},
@ -1011,7 +1011,7 @@
"mofa": 0,
"islong": 0
},
"describe": "普通攻击替换为随机攻击2个目标造成基础伤害95%的物理伤害"
"describe": "普通攻击替换为随机攻击3个目标造成基础伤害95%的物理伤害"
},
"4002201": {
"skillid": 4002201,
@ -1020,7 +1020,7 @@
"side": 4,
"randnum": 1,
"order": "rand",
"limit": 2,
"limit": 3,
"data": {
"pro": 1.14
},
@ -1029,7 +1029,7 @@
"mofa": 0,
"islong": 0
},
"describe": "普通攻击替换为随机攻击2个目标造成基础伤害114%的物理伤害"
"describe": "普通攻击替换为随机攻击3个目标造成基础伤害114%的物理伤害"
},
"4003200": {
"skillid": 4003200,
@ -1202,11 +1202,11 @@
"order": "rand",
"limit": 6,
"data": {
"pro": 0.11
"pro": 0.13
},
"chkdata": {},
"ext": {},
"describe": "每次行动前50%几率恢复己方所有成员11%的最大生命值"
"describe": "每次行动前50%几率恢复己方所有成员13%的最大生命值"
},
"4005203": {
"skillid": 4005203,
@ -1217,11 +1217,11 @@
"order": "rand",
"limit": 6,
"data": {
"pro": 0.11
"pro": 0.13
},
"chkdata": {},
"ext": {},
"describe": "每次行动前75%几率恢复己方所有成员11%的最大生命值"
"describe": "每次行动前75%几率恢复己方所有成员13%的最大生命值"
},
"4006200": {
"skillid": 4006200,

View File

@ -739,14 +739,14 @@
"sxleixing": "zhongdu",
"buff_type": 2,
"xiaoguocanshu": {
"pro": 0.15,
"pro": 0.18,
"type": "hp"
},
"round": 2,
"group": 4012300,
"jiejiaxiaoguo": "retime",
"diejiacengshu": 1,
"describe": "行动时有18%概率使敌方随机4个目标中毒每回合降低15%当前生命对部分强力生物效果降低持续2回合技能"
"describe": "行动时有18%概率使敌方随机4个目标中毒每回合降低18%当前生命对部分强力生物效果降低持续2回合技能"
},
"4012301": {
"skillid": 4012301,
@ -759,14 +759,14 @@
"sxleixing": "zhongdu",
"buff_type": 2,
"xiaoguocanshu": {
"pro": 0.15,
"pro": 0.18,
"type": "hp"
},
"round": 2,
"group": 4012301,
"jiejiaxiaoguo": "retime",
"diejiacengshu": 1,
"describe": "行动时有25%概率使敌方随机4个目标中毒每回合降低15%当前生命对部分强力生物效果降低持续2回合技能"
"describe": "行动时有25%概率使敌方随机4个目标中毒每回合降低18%当前生命对部分强力生物效果降低持续2回合技能"
},
"4012302": {
"skillid": 4012302,

View File

@ -81,7 +81,6 @@ export class KuangDongfun {
upsert: true
}
);
}
/**获取所有矿洞信息 */

View File

@ -1,6 +1,5 @@
import {ApiCall} from "tsrpc"
import {YangChengMuBiaofun} from "../api_s2c/event/yangchengmubiao/fun"
import {Christmasfun} from "../api_s2c/event/christmas/fun"
// import { YangChengMuBiaofun } from "../api_s2c/event/yangchengmubiao/fun"
import {Wjjl} from "../module/collection_wjjl"
import {PublicShared} from "../shared/public/public"
@ -74,8 +73,6 @@ export module manager {
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)
// 圣诞任务计数
Christmasfun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg)
}
// 任务数值, 和检测值,看情况需要上层复写

View File

@ -441,13 +441,22 @@ export async function initMongoDB() {
//可结合查看node_modules\mongodb\lib\connection_string.js
//maxPoolSize默认值100
let option:MongoClientOptions;
/**
* MongoDB连接池具有多个参数
* maxPoolSize100
* minPoolSize0
* maxIdleTimeMS0
* waitQueueTimeoutMS0
*/
let option:MongoClientOptions = {
//空闲5分钟后关闭
maxIdleTimeMS: 5*60*1000
};
//跨服只有1个直接采用默认配置就行
if(G.argv.serverType != 'cross'){
if(PublicShared.getOpenServerDay() > 3){
option = {
maxPoolSize: 10
}
option.maxPoolSize=10;
}
}
@ -461,7 +470,8 @@ export async function initMongoDB() {
console.log('connect crossmongodb ......');
//本服里,维持住跟跨服数据库的链接
let crossClient = await MongoClient.connect(G.config.crossMongodbUrl,{
maxPoolSize:10
maxPoolSize:10,
maxIdleTimeMS: 5*60*1000
});
G.crossmongodb = new _mongodb(crossClient.db(G.config.corssDBName || ""));
console.log('connect crossmongodb succ');