From e2d9eea5ed9a5d3db1336987f04ce6478127ff9c Mon Sep 17 00:00:00 2001 From: xcy <871622040@qq.com> Date: Wed, 20 Dec 2023 16:31:32 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DClass=5Ftask=5F134?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=9B=91=E5=90=AC=E5=8F=82=E6=95=B0=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=AF=BC=E8=87=B4=E7=9A=84=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/task.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/public/task.ts b/src/public/task.ts index f9f4171..055ed64 100644 --- a/src/public/task.ts +++ b/src/public/task.ts @@ -788,7 +788,7 @@ export class TaskAllEmitFun { let _val = node.call.req.num; G.emit("Class_task_136", 'Class_task_136', node.call, _val, 0); // todo 统计藏品修复胶,此处只是临时处理,防止线上任务数据出错,正确做法是,统计修复胶的消耗,走136任务的统计 - G.emit("Class_task_134", 'Class_task_134', node.call, _val, 0, {}); + G.emit("Class_task_134", 'Class_task_134', node.call, _val, 0, []); } if (node.call.service.name == 'peijian/LvUp' && node.return.isSucc) { From dacd312bfefa355692307a452e1365d91133eb2a Mon Sep 17 00:00:00 2001 From: xcy <871622040@qq.com> Date: Wed, 20 Dec 2023 16:56:23 +0800 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20=E6=97=A5=E5=B8=B8=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=80=BC=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/taskclass.ts | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/public/taskclass.ts b/src/public/taskclass.ts index 5266c85..7271b4e 100644 --- a/src/public/taskclass.ts +++ b/src/public/taskclass.ts @@ -390,7 +390,10 @@ export module manager { async initVal(call: ApiCall, con) { const data = await TanXianFun.getData(call); - return data.useFastGuaJiNum || 0 + if (data?.resetTime > PublicShared.getToDayZeroTime()) { + return data.useFastGuaJiNum || 0 + } + return 0 } } @@ -401,7 +404,10 @@ export module manager { async initVal(call: ApiCall, con) { let data = await JJCFun.getData(call); - return data?.useFightNum || 0 + if (data?.resetTime >= PublicShared.getToDayZeroTime()) { + return data?.useFightNum || 0 + } + return 0 } } @@ -418,7 +424,10 @@ export module manager { async initVal(call: ApiCall, con) { let myData = await G.mongodb.cPlayerInfo('meirishilian').findOne({uid: call.uid, type: 'meirishilian'}); - return R.compose(R.sum(), R.map(i => i[0].useFightNum), R.values())(myData.data.numInfo) || 0 + if (myData.data.refreshTime > PublicShared.getToDayZeroTime()) { + return R.compose(R.sum(), R.map(i => i[0].useFightNum), R.values())(myData.data.numInfo) || 0 + } + return 0 } } @@ -435,7 +444,10 @@ export module manager { async initVal(call: ApiCall, con) { let myData = await G.mongodb.cPlayerInfo('qjzzd').findOne({uid: call.uid, type: 'qjzzd'}); - return myData.useFightNum || 0 + if (myData?.refreFightTime > PublicShared.getToDayZeroTime()) { + return myData?.useFightNum || 0 + } + return 0 } } @@ -491,7 +503,10 @@ export module manager { async initVal(call: ApiCall, con) { let data: Partial = await G.mongodb.collection('wanted').findOne({uid: call.uid}) || {}; - return data.toDayUseNum || 0 + if (data.refreshTime > PublicShared.getToDayZeroTime()) { + return data.toDayUseNum || 0 + } + return 0 } } @@ -766,6 +781,7 @@ export module manager { return call.conn.gud?.helpHeros?.length || 0; } } + // 第56个任务 完成圣诞活动小游戏 export class Class_task_154 extends BaseClass { stype = 154 @@ -775,6 +791,7 @@ export module manager { return 1; } } + // 第57个任务 领取每日任务最终宝箱 export class Class_task_155 extends BaseClass { stype = 155 From 23e1941812e0df08dc72f60bd8b167a502910899 Mon Sep 17 00:00:00 2001 From: xcy <871622040@qq.com> Date: Wed, 20 Dec 2023 19:05:09 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E5=99=A8=E9=87=8D=E5=A4=8D=E6=89=A7=E8=A1=8C=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E9=82=AE=E4=BB=B6=E9=87=8D=E5=A4=8D=E5=8F=91=E9=80=81=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/clusterUtils.ts | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/src/clusterUtils.ts b/src/clusterUtils.ts index 3836098..05b3006 100644 --- a/src/clusterUtils.ts +++ b/src/clusterUtils.ts @@ -2,13 +2,14 @@ import {RedisClientType, createClient} from "redis"; import {redisClient} from "./setRedis"; import {ConnectionStatus, WsServer} from "tsrpc"; import cluster from 'cluster'; -import { clusterFun } from "./clusterFunction"; +import {clusterFun} from "./clusterFunction"; //维护当前uid和pid的对应关系 let uid2processId = {}; //订阅redis let subscribeRedis: RedisClientType let firstPid = null; + //发布和可写redis复用原 setRedis 里的redisClient @@ -20,10 +21,10 @@ let firstPid = null; */ export function clusterSubscribe(key: string, callback: Function) { subscribeRedis.subscribe(G.redis.fromatKey(key), function (msg) { - try{ + try { callback(msg); - }catch(e){ - console.error("clusterSubscribe error",e); + } catch (e) { + console.error("clusterSubscribe error", e); } }); } @@ -43,14 +44,19 @@ export function clusterPublish(key: string, data: any) { * 在集群的N个进程中,只运行一次,在业务逻辑中也可使用 */ export function clusterRunOnce(fun) { + console.log(`${process.pid}环境变量pm_id===>${process.env.pm_id}`); if (process.env.pm_id == null || process.env.pm_id === '0') { //非pm2启动的,或是pm2下启动的第一个进程 + console.log("run clusterRunOnce1 ===>", process.pid) fun(); return; } - if(firstPid == process.pid){ + if(G.config.isG123)return; + + if (firstPid == process.pid) { //pm2的其中一个进程 + console.log("run clusterRunOnce2 ===>", process.pid) fun(); return; } @@ -60,16 +66,16 @@ export function clusterRunOnce(fun) { * 对外方法: * 在uid所在的进程执行fun方法,如果uid不在任何进程的话,则在当前进程执行 */ -export function clusterFunctionRunAtUidProcess(uid:string, fun:string, ...arg:any[]) { - if(!uid2processId[uid] || uid2processId[uid] == process.pid){ - clusterFun[ fun ].call(this, ...arg); +export function clusterFunctionRunAtUidProcess(uid: string, fun: string, ...arg: any[]) { + if (!uid2processId[uid] || uid2processId[uid] == process.pid) { + clusterFun[fun].call(this, ...arg); return; } clusterPublish("RunclusterFunction", JSON.stringify({ "uid": uid, "fun": fun, - "arg" : arg + "arg": arg })) } @@ -159,17 +165,17 @@ async function initSubscribeRedis() { clusterSubscribe('broadcastClusterMsg', function (msg) { let data = JSON.parse(msg); - if(!data.filter){ + if (!data.filter) { //如果不是有条件发送的话 G.server.broadcastMsg(data.msgName, data.msg); - }else { + } else { //但是如果是有条件发送的话 //条件里可能需要进程内的信息,则需要每个进程都分别筛选后执行 if (data.filter.ghId != null) { //指定公会 let conns = G.server.connections; conns = conns.filter(c => c?.gud?.ghId == data.filter.ghId); - conns.length>0 && G.server.broadcastMsg(data.msgName, data.msg, conns); + conns.length > 0 && G.server.broadcastMsg(data.msgName, data.msg, conns); } } }); @@ -178,7 +184,7 @@ async function initSubscribeRedis() { clusterSubscribe('RunclusterFunction', function (msg) { let data = JSON.parse(msg); if (uid2processId[data.uid] == process.pid) { - clusterFun[ data.fun ].call(this, ...data.arg); + clusterFun[data.fun].call(this, ...data.arg); } }); } @@ -193,8 +199,8 @@ export async function clusterMain() { }); //初始化订阅redis await initSubscribeRedis(); - - if(process.env.pm_id != null){ + + if (process.env.pm_id != null) { //pm2启动的,设置key为我的pid firstPid = await redisClient.get(G.redis.fromatKey("firstPid")); if (!firstPid) { @@ -207,7 +213,7 @@ export async function clusterMain() { redisClient.del(G.redis.fromatKey("uid2processId")); }); } - + //初始化玩家pid信息 await initUid2processId(); From 9429dacc638b5ba330f99c1bc2a5b464582adc06 Mon Sep 17 00:00:00 2001 From: dy Date: Wed, 20 Dec 2023 19:22:51 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=85=AC=E8=B7=AF=E7=8B=82=E9=A3=99?= =?UTF-8?q?=E6=80=A7=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/gonglukuangbiao/ApiOpen.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/api_s2c/gonglukuangbiao/ApiOpen.ts b/src/api_s2c/gonglukuangbiao/ApiOpen.ts index bb484b4..98fcb44 100644 --- a/src/api_s2c/gonglukuangbiao/ApiOpen.ts +++ b/src/api_s2c/gonglukuangbiao/ApiOpen.ts @@ -59,7 +59,7 @@ let enemyObject: object = {} async function checkAndRefreshEnemy() { if (lastRefreshTime + 3600 > G.time) return lastRefreshTime = G.time - for (let i = 3; i <= 8; i ++) { + for (let i = 3; i <= 8; i++) { let users = await G.mongodb.collection('user').aggregate([ { $match: { @@ -85,7 +85,9 @@ async function checkAndRefreshEnemy() { export async function refreshEnemys(call: ApiCall) { if (!lastRefreshTime) await checkAndRefreshEnemy() - let dbUser = enemyObject[Math.floor(call.conn.gud.lv / 10)] + let lvDw = Math.floor(call.conn.gud.lv / 10 > 8 ? 8 : call.conn.gud.lv / 10) + + let dbUser = enemyObject[lvDw] || [] let enemys: joinFightData[] = []; From 87ccce1875e712a2ebec70395686b7792e722037 Mon Sep 17 00:00:00 2001 From: chenkai Date: Thu, 21 Dec 2023 09:45:08 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix:=20=E5=AF=B9=E4=B8=BB=E8=A7=92=E6=8A=80?= =?UTF-8?q?=E8=83=BD=20buff=20=E9=80=A0=E6=88=90=E7=9A=84=E4=BC=A4?= =?UTF-8?q?=E5=AE=B3=E6=B7=BB=E5=8A=A0=E4=B8=8A=E9=99=90=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shared/fightControl/fightDPS.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/shared/fightControl/fightDPS.ts b/src/shared/fightControl/fightDPS.ts index 3509d39..6129e1a 100644 --- a/src/shared/fightControl/fightDPS.ts +++ b/src/shared/fightControl/fightDPS.ts @@ -37,7 +37,7 @@ export function getFightDPS(fromRole: FightObj, toRole: FightObj, extData: DPS_E 运算速度 自身速度*随机浮动值 随机浮动值 0.9-1.1(1位小数) (-10,10) */ - + if (fromRole.isDead || toRole.isDead) return { num: 0, dps: 0, miss: false, baoji: false, fromRole: fromRole, toRole: toRole }; let miss = false, baoji = false, dps = 0; let fromRoleLv = fromRole.getData('lv'), toRoleLv = toRole.getData('lv'); @@ -182,6 +182,18 @@ export function getBuffDPS(toRole: FightObj, fromRole: FightObj, extData: { xiao // todo 主角技能还没有限制百分比的最大伤害,以下判断修复技能buff没有伤害 if (fromRole.getData('pos') != 7){ dps = dps > maxDps ? maxDps : dps; + } else { + // 主角技能伤害最大值: avg(所有上场干部的maxDps) * 2 + let sumHeroMaxDps = 0, heroCount = 0; + const fromRoleSide = fromRole.getData('side'); + fromRole.fightControl.fightRolesArr.forEach(role => { + if (role.getData('pos') < 7 && role.getData('side') === fromRoleSide) { + sumHeroMaxDps += role.getData('maxdps'); + heroCount++; + } + }); + maxDps = sumHeroMaxDps / heroCount * 2; + dps = dps > maxDps ? maxDps : dps; } return { num: -dps, dps: -dps, miss: miss, baoji: baoji, fromRole: fromRole, toRole: toRole };