From 1c256ab58b6e78e39c773be93b96c3bf76ab4b64 Mon Sep 17 00:00:00 2001 From: yushunrui <364203175@qq.com> Date: Tue, 9 Jan 2024 22:00:30 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix:=E7=AB=9E=E6=8A=80=E5=9C=BA=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E5=90=8D=E5=A4=B4=E5=83=8F=E7=89=B9=E6=AE=8A=E5=A4=84?= =?UTF-8?q?=E7=90=86=EF=BC=8C=E5=8F=AF=E4=BB=A5=E7=94=A8=E9=81=93=E5=85=B7?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E8=A7=A3=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/user.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/public/user.ts b/src/public/user.ts index 5914259..a89f392 100644 --- a/src/public/user.ts +++ b/src/public/user.ts @@ -305,8 +305,11 @@ export class UserFun { gud.headFrames[conf.id] += val * v; } } + else if(conf?.cond?.[0] == "jjc_rank") { + change = true; + gud.headFrames[conf.id] = -1; + } } - if (change) { PlayerFun.changeAttr(uid, {headFrames: gud.headFrames}); G.server.sendMsgByUid(uid, 'msg_s2c/PlayerChange', {headFrames: gud.headFrames}); From 0ddd611c593a41849d7f772b2066d89c3ed5d68c Mon Sep 17 00:00:00 2001 From: ciniao <4041990@qq.com> Date: Tue, 9 Jan 2024 22:30:35 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=97=A0=E6=95=88?= =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/jjc/ApiOpen.ts | 2 +- src/public/jjc.ts | 58 +++++++++++++++++++------------------- src/public/player.ts | 37 ++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 30 deletions(-) diff --git a/src/api_s2c/jjc/ApiOpen.ts b/src/api_s2c/jjc/ApiOpen.ts index 700ada3..0d6b0ee 100644 --- a/src/api_s2c/jjc/ApiOpen.ts +++ b/src/api_s2c/jjc/ApiOpen.ts @@ -30,6 +30,6 @@ export default async function (call: ApiCall) { }); UserFun.activeHeadFrame(call.uid, 'jjc_rank', data["rank"] + 1); - JJCFun.checkUpdatePlayer() + //JJCFun.checkUpdatePlayer() } \ No newline at end of file diff --git a/src/public/jjc.ts b/src/public/jjc.ts index d571417..67726f1 100644 --- a/src/public/jjc.ts +++ b/src/public/jjc.ts @@ -94,37 +94,37 @@ export class JJCFun { * @param uTimeOffset * @param isUpdate 是否更新数据 */ - static async checkUpdatePlayer(min: number = 0, max: number = 1000, uTimeOffset: number = 600, isUpdate: boolean = true) { - // 获取指定排名用户uid - let sortInfo = await this.getRankListUid(min, max) - if (!sortInfo.length) return [] - let updateArr = [] + // static async checkUpdatePlayer(min: number = 0, max: number = 1000, uTimeOffset: number = 600, isUpdate: boolean = true) { + // // 获取指定排名用户uid + // let sortInfo = await this.getRankListUid(min, max) + // if (!sortInfo.length) return [] + // let updateArr = [] - let users = await G.redis.hGetAll('rank:jjc:data') + // let users = await G.redis.hGetAll('rank:jjc:data') - for (let i = 0; i < sortInfo.length; i++) { - let uid = sortInfo[i] - let rankInfo = users[uid] - if (!rankInfo?.player) continue - // 比对utime,判断是否更新数据 - if (!rankInfo.player.isNpc) { - if (!rankInfo.utime || (rankInfo.utime && rankInfo.utime < (G.time - uTimeOffset))) { - updateArr.push(rankInfo) - } - } - } - // 更新数据 - if (isUpdate && updateArr.length > 0) { - let playerArrInfo = await G.mongodb.collection("user").find({uid: {$in: updateArr.map(i => i.uid)}}).toArray() - for (let i = 0; i < playerArrInfo.length; i++) { - let playerInfo = playerArrInfo[i] - let index = updateArr.findIndex(x => x.player.uid == playerInfo.uid) - updateArr[index].player = playerInfo - updateArr[index].utime = G.time - this.updatePlayerData(playerInfo.uid, updateArr[index]); - } - } - } + // for (let i = 0; i < sortInfo.length; i++) { + // let uid = sortInfo[i] + // let rankInfo = users[uid] + // if (!rankInfo?.player) continue + // // 比对utime,判断是否更新数据 + // if (!rankInfo.player.isNpc) { + // if (!rankInfo.utime || (rankInfo.utime && rankInfo.utime < (G.time - uTimeOffset))) { + // updateArr.push(rankInfo) + // } + // } + // } + // // 更新数据 + // if (isUpdate && updateArr.length > 0) { + // let playerArrInfo = await G.mongodb.collection("user").find({uid: {$in: updateArr.map(i => i.uid)}}).toArray() + // for (let i = 0; i < playerArrInfo.length; i++) { + // let playerInfo = playerArrInfo[i] + // let index = updateArr.findIndex(x => x.player.uid == playerInfo.uid) + // updateArr[index].player = playerInfo + // updateArr[index].utime = G.time + // this.updatePlayerData(playerInfo.uid, updateArr[index]); + // } + // } + // } /** * 获取指定范围排名的用户,仅返回uid[] diff --git a/src/public/player.ts b/src/public/player.ts index 2647bce..1cf7ef2 100644 --- a/src/public/player.ts +++ b/src/public/player.ts @@ -19,6 +19,8 @@ import {getGud, setGud} from './gud'; import {addGameLog} from "../gameLog"; import {PushGiftFun} from "./pushgift"; import { ActionLog } from './actionLog/actionLog'; +import { roleDataType } from '../shared/fightControl/fightType'; +import { PlayerShared } from '../shared/public/player'; export type call = { @@ -41,6 +43,41 @@ export type call = { }; export class PlayerFun { + /** + * 通过uid获取战斗数据 + * @param uid + * @returns + */ + static async getDefaultFightDataByUid(uid:string){ + let gud = await getGud(uid); + let posObj = gud.heroPos; + let roles: k_v = {}; + if (gud.selectMatrix && gud.matrixPos) { + posObj = gud.matrixPos[gud.selectMatrix]; + } + let heros = await HeroFun.getHeros({uid:uid}, Object.values(posObj).filter(_id => _id != '') as string[]); + let otherBuff = UserFun.getOtherBuff(gud) + + Object.entries(posObj).forEach(obj => { + let pos = obj[0]; + let _id = obj[1]; + let hero = heros.filter(h => h._id == _id)[0]; + + if (hero) { + roles[pos] = { + ...hero, + attr: { + ...HeroShared.getHeroBasicAttr(hero, { ...otherBuff, allBuff: HeroShared.getAllBuff(heros) }, Number(pos)) + } + }; + } + }); + + return { + player: { ...gud, buff: PlayerShared.getBuff(gud) }, + roles: roles + }; + } /** * 获取玩家atn数量 */ From 51ddb556375fa7191facfaed04138537e9138ee8 Mon Sep 17 00:00:00 2001 From: xichaoyin Date: Wed, 10 Jan 2024 13:38:27 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=E7=8E=A9=E5=AE=B6=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fix_patch/patch_20240110.ts | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/fix_patch/patch_20240110.ts diff --git a/src/fix_patch/patch_20240110.ts b/src/fix_patch/patch_20240110.ts new file mode 100644 index 0000000..103ec36 --- /dev/null +++ b/src/fix_patch/patch_20240110.ts @@ -0,0 +1,51 @@ +import { patchInit } from "../patch"; + + +class Path { + + async fun1(a: any) { + let taskType = 2; + let users = await G.mongodb.collection('user').find({ loginTime: { $gte: 1704643200 } }).toArray(); + for (let i = 0; i < users.length; i++) { + let user = users[i]; + let unFinishTask = (await G.mongodb.collection('task').find({ + uid: user.uid, type: taskType, finish: 0 + }, { projection: { taskid: 1 } }).toArray()).map(i => i.taskid); + + if (unFinishTask.length >= 2) { + for (let taskid of unFinishTask) { + let con = G.gc.task[taskType][taskid]; + if (!con) { + await G.mongodb.collection("task").deleteOne({ + uid: user.uid, taskid: taskid + }); + console.log(`删除玩家${user.uid}任务:${taskid}`); + } + if (unFinishTask.includes(con.pretask)) { + await G.mongodb.collection("task").deleteOne({ + uid: user.uid, taskid: taskid + }); + console.log(`删除玩家${user.uid}任务:${taskid}`); + } + } + } + } + } + + + async run() { + await this.fun1(1); + } +} + +async function main() { + await patchInit() + let patch = new Path(); + await patch.run(); + console.log("逻辑执行完成,等待退出"); + setTimeout(function () { + console.log('结束程序'); + process.exit(); + }, 3000); +} +main(); From f802242b352bcb201a690b14b787bf23409dc983 Mon Sep 17 00:00:00 2001 From: ciniao <4041990@qq.com> Date: Wed, 10 Jan 2024 14:00:48 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix:=E8=87=AA=E9=80=89=E7=A4=BC=E5=8C=85?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/pay.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/public/pay.ts b/src/public/pay.ts index bf4deb7..6052922 100644 --- a/src/public/pay.ts +++ b/src/public/pay.ts @@ -260,7 +260,10 @@ export class PayFun { let selectPrize = await G.ioredis.get(`pay:${payId}:${player.uid}`); if (selectPrize) { prize.push(...JSON.parse(selectPrize)) - G.ioredis.del(`pay:${payId}:${player.uid}`) + //支付A check -> 玩家支付 -> 网络延迟 + //支付B check -> 玩家支付 -> pay -> del + //支付A -> pay 时,这里可能被清了,导致给玩家发放了空的奖励,因此,这里不清除 + //G.ioredis.del(`pay:${payId}:${player.uid}`) } } From 0642ccb48cb2fadb592a99b2c735af64dd608c87 Mon Sep 17 00:00:00 2001 From: ciniao <4041990@qq.com> Date: Wed, 10 Jan 2024 14:08:33 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E9=AA=8C=E8=AF=81=E4=B8=93=E5=B1=9E?= =?UTF-8?q?=E6=8A=80=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shared/fightControl/fightCntrol.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/shared/fightControl/fightCntrol.ts b/src/shared/fightControl/fightCntrol.ts index 94d5b22..11ca577 100644 --- a/src/shared/fightControl/fightCntrol.ts +++ b/src/shared/fightControl/fightCntrol.ts @@ -151,25 +151,25 @@ export class FightControl { beforeSkill() { this.eachLiveRoles((role) => { let heroId = role.roleData.heroId; - let shiwu = role.roleData?.shiwu || {}; - let talent = role.roleData?.talent || {}; + // let shiwu = role.roleData?.shiwu || {}; + // let talent = role.roleData?.talent || {}; let skills = G.gc.heroskill[heroId][role.roleData.jieji || 0].bdskill || []; skills = skills.concat(role.roleData.attr.skillArr); - for (let key in shiwu) { - let zhushuan = shiwu[key]?.zhuanshu; - if (!zhushuan) continue; - if (zhushuan.skill) skills.push(zhushuan.skill); - }; - const hero_tf = G.gc.hero_tf; - for (let key in talent) { - let cdata = hero_tf[key][talent[key]]; - if (cdata && cdata.skill_effect) skills.push(cdata.skill_effect); - } + // for (let key in shiwu) { + // let zhushuan = shiwu[key]?.zhuanshu; + // if (!zhushuan) continue; + // if (zhushuan.skill) skills.push(zhushuan.skill); + // }; + // const hero_tf = G.gc.hero_tf; + // for (let key in talent) { + // let cdata = hero_tf[key][talent[key]]; + // if (cdata && cdata.skill_effect) skills.push(cdata.skill_effect); + // } // skills.push('tx06309'); - if (!skills) return; + //if (!skills) return; skills.forEach(_skill => { let askillconf = getSkillConf(_skill); if (!askillconf) return console.log('没有技能配置-->', _skill);