diff --git a/src/api_s2c/event/christmas/ApiSelect.ts b/src/api_s2c/event/christmas/ApiSelect.ts index 6680a9a..612618c 100644 --- a/src/api_s2c/event/christmas/ApiSelect.ts +++ b/src/api_s2c/event/christmas/ApiSelect.ts @@ -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) { - 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'); } \ No newline at end of file diff --git a/src/api_s2c/event/christmas/ApiTaskRec.ts b/src/api_s2c/event/christmas/ApiTaskRec.ts index 1227d85..389e095 100644 --- a/src/api_s2c/event/christmas/ApiTaskRec.ts +++ b/src/api_s2c/event/christmas/ApiTaskRec.ts @@ -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) { - 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'); } \ No newline at end of file diff --git a/src/api_s2c/kuangdong/ApiYanShi.ts b/src/api_s2c/kuangdong/ApiYanShi.ts index f80c861..b19effd 100644 --- a/src/api_s2c/kuangdong/ApiYanShi.ts +++ b/src/api_s2c/kuangdong/ApiYanShi.ts @@ -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) { 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) { _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 diff --git a/src/gameLog.ts b/src/gameLog.ts index 04e8c09..7f70f2c 100644 --- a/src/gameLog.ts +++ b/src/gameLog.ts @@ -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; } diff --git a/src/json/pay.json b/src/json/pay.json index 2129268..cc8e283 100644 --- a/src/json/pay.json +++ b/src/json/pay.json @@ -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": {} } \ No newline at end of file diff --git a/src/json/skill_afteratk.json b/src/json/skill_afteratk.json index 630f4c5..ee79b07 100644 --- a/src/json/skill_afteratk.json +++ b/src/json/skill_afteratk.json @@ -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, diff --git a/src/json/skill_buff.json b/src/json/skill_buff.json index 57be4e5..5c3cdb0 100644 --- a/src/json/skill_buff.json +++ b/src/json/skill_buff.json @@ -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, diff --git a/src/public/kuangdong.ts b/src/public/kuangdong.ts index fe73d02..942759d 100644 --- a/src/public/kuangdong.ts +++ b/src/public/kuangdong.ts @@ -81,7 +81,6 @@ export class KuangDongfun { upsert: true } ); - } /**获取所有矿洞信息 */ diff --git a/src/public/taskclass.ts b/src/public/taskclass.ts index 6924efa..06cc127 100644 --- a/src/public/taskclass.ts +++ b/src/public/taskclass.ts @@ -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) } // 任务数值, 和检测值,看情况需要上层复写 diff --git a/src/setMongodb.ts b/src/setMongodb.ts index 8ab7e8b..b157290 100644 --- a/src/setMongodb.ts +++ b/src/setMongodb.ts @@ -441,13 +441,22 @@ export async function initMongoDB() { //可结合查看:node_modules\mongodb\lib\connection_string.js //maxPoolSize默认值:100 - let option:MongoClientOptions; + /** + * MongoDB连接池具有多个参数,用于控制连接池的行为和性能。下面是一些常用的连接池参数及其作用: + * maxPoolSize:连接池的最大连接数。默认值为100。该参数决定了连接池中可以同时存在的最大连接数,超过这个数量后,新的连接请求会被阻塞。 + * minPoolSize:连接池的最小连接数。默认值为0。该参数决定了连接池中保持的最小连接数,当连接数少于这个数量时,连接池会自动创建新的连接实例。 + * maxIdleTimeMS:连接的最大空闲时间(毫秒)。默认值为0,表示连接不会被强制断开。该参数决定了连接在空闲一定时间后是否被断开,以释放服务器资源。 + * waitQueueTimeoutMS:连接请求的等待时间(毫秒)。默认值为0,表示无限等待。当连接池达到最大连接数时,新的连接请求会被放入等待队列中,该参数决定了连接请求在队列中的最长等待时间。 + */ + + 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');