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 01/24] =?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 02/24] =?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 03/24] =?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 04/24] =?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 0a296d739a7074393305037f7a6e78b41528a841 Mon Sep 17 00:00:00 2001 From: xichaoyin Date: Wed, 10 Jan 2024 14:52:41 +0800 Subject: [PATCH 05/24] =?UTF-8?q?fix:=E5=B1=8F=E8=94=BD=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=96=B0=E7=9A=84=E4=BB=BB=E5=8A=A1=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/task.ts | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/public/task.ts b/src/public/task.ts index 89da6db..aef5687 100644 --- a/src/public/task.ts +++ b/src/public/task.ts @@ -261,28 +261,28 @@ export class TaskFun { delete _w["finish"]; } let _tmp = await this.getUserTaksList(call.uid, _w); - // 没有未完成任务 - // 检测是否有新加任务 - if (_tmp.length == 0) { - let rectask = (await G.mongodb.collection('task').find( - { uid: call.uid, type: _type }, { projection: { taskid: 1, _id: 0 } } - ).toArray()).map(e => e.taskid); + // // 没有未完成任务 后续添加任务直接使用脚本刷任务 + // // 检测是否有新加任务 + // if (_tmp.length == 0) { + // let rectask = (await G.mongodb.collection('task').find( + // { uid: call.uid, type: _type }, { projection: { taskid: 1, _id: 0 } } + // ).toArray()).map(e => e.taskid); - for (let taskid of rectask) { - let conf = G.gc.task[_type][taskid]; - // 配置不存在 - // 没有后续任务 - // 后续任务已完成 - if (!conf || !conf.followtask || rectask.includes(conf.followtask)) { - continue - } + // for (let taskid of rectask) { + // let conf = G.gc.task[_type][taskid]; + // // 配置不存在 + // // 没有后续任务 + // // 后续任务已完成 + // if (!conf || !conf.followtask || rectask.includes(conf.followtask)) { + // continue + // } - // 生成后续任务 - await this.setTaskInfo(call, conf.followtask, { type: _type }); - break; - } - _tmp = await this.getUserTaksList(call.uid, _w); - } + // // 生成后续任务 + // await this.setTaskInfo(call, conf.followtask, { type: _type }); + // break; + // } + // _tmp = await this.getUserTaksList(call.uid, _w); + // } _r[_type] = _tmp; } return _r; From 452f5f3d149454a01bef45d21fd6b5ca7007215f Mon Sep 17 00:00:00 2001 From: xichaoyin Date: Wed, 10 Jan 2024 15:19:38 +0800 Subject: [PATCH 06/24] =?UTF-8?q?patch:=E4=BB=BB=E5=8A=A1=E4=BF=AE?= =?UTF-8?q?=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 | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/fix_patch/patch_20240110.ts b/src/fix_patch/patch_20240110.ts index 103ec36..1597954 100644 --- a/src/fix_patch/patch_20240110.ts +++ b/src/fix_patch/patch_20240110.ts @@ -13,21 +13,11 @@ class Path { }, { 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}`); - } - } + unFinishTask.sort().slice(1); + await G.mongodb.collection("task").deleteOne({ + uid: user.uid, taskid: { $in: unFinishTask } + }); + console.log(`删除玩家${user.uid}任务:${unFinishTask}`); } } } From 0932d3ee4741688c0c209afd2253c7b462b17bed Mon Sep 17 00:00:00 2001 From: xichaoyin Date: Wed, 10 Jan 2024 15:46:41 +0800 Subject: [PATCH 07/24] =?UTF-8?q?patch:=E7=BB=88=E8=BA=AB=E5=8D=A1?= =?UTF-8?q?=E5=91=A8=E5=A5=96=E5=8A=B1=E8=A1=A5=E5=8F=91=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 | 82 +++++++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 4 deletions(-) diff --git a/src/fix_patch/patch_20240110.ts b/src/fix_patch/patch_20240110.ts index 1597954..8f48a19 100644 --- a/src/fix_patch/patch_20240110.ts +++ b/src/fix_patch/patch_20240110.ts @@ -1,8 +1,44 @@ +import { ReqEmail } from "../monopoly/protocols/PtlEmail"; import { patchInit } from "../patch"; +import { MsgEmail } from "../shared/protocols/msg_s2c/MsgEmail"; +import { PublicShared } from "../shared/public/public"; class Path { + async addEmail(email: ReqEmail & { createTime?: number; }) { + let { prize, uid, ...e } = email; + let lng = await G.redis.rawGet(`user:lng:${uid}`) + + let sendEmail: MsgEmail = { + _id: null, + uid: uid, + type: e.type, + title: e.lngTitle ? (e.lngTitle[lng] || e.lngTitle['ja']) : e.title, + content: e.lngContent ? (e.lngContent[lng] || e.lngContent['ja']) : e.content, + createTime: e.createTime || G.time, + contentInsertArr: e.contentInsertArr || [] + }; + + if (prize?.length > 0) { + sendEmail.prizeData = { + prize: email.prize, + isGet: false + }; + } + + if (email.g123log && Object.keys(email.g123log).length > 0) sendEmail.g123log = email.g123log; + + if (email.lngTitle) { + sendEmail.lngTitle = email.lngTitle + sendEmail.lngContent = email.lngContent + } + + await G.mongodb.collection('email').insertOne({ + ttl: new Date(), ...G.mongodb.conversionIdObj(sendEmail) + }); + } + async fun1(a: any) { let taskType = 2; let users = await G.mongodb.collection('user').find({ loginTime: { $gte: 1704643200 } }).toArray(); @@ -13,18 +49,56 @@ class Path { }, { projection: { taskid: 1 } }).toArray()).map(i => i.taskid); if (unFinishTask.length >= 2) { - unFinishTask.sort().slice(1); + let deltask = unFinishTask.sort().slice(1); await G.mongodb.collection("task").deleteOne({ - uid: user.uid, taskid: { $in: unFinishTask } + uid: user.uid, taskid: { $in: deltask } }); - console.log(`删除玩家${user.uid}任务:${unFinishTask}`); + console.log(`删除玩家${user.uid}任务:${deltask}`); + } + } + } + /** + * 补发玩家终身卡奖励 + */ + async fun2(a: any) { + let logs = await G.mongodb.collection("payLogNew").find( + { key: "zhongshenka", del_time: { $exists: false } }, { projection: { _id: 0, } } + ).toArray(); + + if (logs.length == 0) { + console.log("没有终身卡数据,不发放终身卡"); + } + let wzt = PublicShared.getToWeekMondayZeroTime(); + let con = G.gc.payEmail.zhongshenka.filter(e => e.day == 7)[0]; + for (let i = 0; i < logs.length; i++) { + + // 查询玩家邮件 + let emails = await G.mongodb.collection('email').find({ + uid: logs[i].uid, title: con.title, createTime: { $gte: wzt } + }).toArray(); + + + if (emails.length == 0) { + // 发送邮件 + this.addEmail({ + uid: logs[i].uid, + type: "system", + title: con.title, + content: con.content, + contentInsertArr: [], + createTime: G.time, + prize: con.prize, + }) + console.log("发放终身卡", logs[i].uid); + } else { + console.log("本周已发送过 不发放终身卡", logs[i].uid); } } } - async run() { await this.fun1(1); + await this.fun2(1); } } From ca3e973afd18a2cf44bb76e35bdc320d341bcdc2 Mon Sep 17 00:00:00 2001 From: xichaoyin Date: Wed, 10 Jan 2024 15:50:49 +0800 Subject: [PATCH 08/24] =?UTF-8?q?patch:=E7=BB=88=E8=BA=AB=E5=8D=A1?= =?UTF-8?q?=E5=91=A8=E5=A5=96=E5=8A=B1=E8=A1=A5=E5=8F=91=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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/fix_patch/patch_20240110.ts b/src/fix_patch/patch_20240110.ts index 8f48a19..9bfeeec 100644 --- a/src/fix_patch/patch_20240110.ts +++ b/src/fix_patch/patch_20240110.ts @@ -67,7 +67,9 @@ class Path { if (logs.length == 0) { console.log("没有终身卡数据,不发放终身卡"); + return } + let wzt = PublicShared.getToWeekMondayZeroTime(); let con = G.gc.payEmail.zhongshenka.filter(e => e.day == 7)[0]; for (let i = 0; i < logs.length; i++) { From a26aa7dab33ecdcf50d6fe0e4237531b2df43f37 Mon Sep 17 00:00:00 2001 From: yushunrui <364203175@qq.com> Date: Wed, 10 Jan 2024 16:44:53 +0800 Subject: [PATCH 09/24] =?UTF-8?q?fix:=E5=A4=84=E7=90=86=E5=BC=BA=E5=8C=96?= =?UTF-8?q?=E4=BC=99=E4=BC=B4=E6=B4=BB=E5=8A=A8=E5=88=9D=E5=A7=8B=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E4=BB=BB=E5=8A=A1=E8=BF=9B=E5=BA=A6=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/chuanshuozhilu/ApiOpen.ts | 30 +++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts b/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts index 27dd5d5..a1d648d 100644 --- a/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts +++ b/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts @@ -12,11 +12,37 @@ export default async function (call: ApiCall) { // 无此活动 return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 }) } - let db = await G.mongodb.cEvent(`chuanshuozhilu${call.req.hdid}`).findOne({ uid: call.uid, type: `chuanshuozhilu${call.req.hdid}` }); + let _info = db?.info || {} + // 如果初始没有数据,就判断玩家是否有活动对应的影响,生成一下初始化数据 + if (!db) { + + let _dbType: `chuanshuozhilu${number}` = `chuanshuozhilu${call.req.hdid}` + const hid = _hdinfo.data.hid + let heros = await G.mongodb.collection("hero").find({uid: call.uid, heroId: hid}) + .sort({ "zhanli": -1 }).limit(1).toArray(); + + if (heros) { + let hero = heros[0] + const lv = hero.lv || 0 + const jieji = hero.jieji || 0 + let setInfo = {"lv": lv, "jieji": jieji} + await G.mongodb.cEvent(_dbType).updateOne( + { uid: call.uid, type: _dbType }, + { $set: G.mongodb.createTreeObj({ key: `info.${hid}`, val: setInfo})}, + { upsert: true} + ) + if (!cache[call.uid]) cache[call.uid] = {hid:{}}; + if (!cache[call.uid][hid]) cache[call.uid][hid] = setInfo; + _info[hid] = setInfo + G.server.sendMsgByUid(call.uid, 'msg_s2c/HongDianChange', ['huodonghd']); + } + + } + call.succ({ - info: db?.info || {}, + info: _info, hdinfo: _hdinfo }); } From 104a1edadcd40f45bcd939ce518d2601c3ae9440 Mon Sep 17 00:00:00 2001 From: ciniao <4041990@qq.com> Date: Wed, 10 Jan 2024 16:57:11 +0800 Subject: [PATCH 10/24] =?UTF-8?q?=E5=A4=A9=E8=B5=8B=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 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/shared/fightControl/fightCntrol.ts b/src/shared/fightControl/fightCntrol.ts index 4db74c9..e13a18e 100644 --- a/src/shared/fightControl/fightCntrol.ts +++ b/src/shared/fightControl/fightCntrol.ts @@ -152,7 +152,7 @@ export class FightControl { this.eachLiveRoles((role) => { let heroId = role.roleData.heroId; // let shiwu = role.roleData?.shiwu || {}; - // let talent = role.roleData?.talent || {}; + let talent = role.roleData?.talent || {}; let skills = G.gc.heroskill[heroId][role.roleData.jieji || 0].bdskill || []; skills = skills.concat(role.roleData.attr.skillArr); @@ -161,15 +161,15 @@ export class FightControl { // 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); - // } + 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); From 48cd24d309b9209d87df05ae9d6a8913bd6e6bea Mon Sep 17 00:00:00 2001 From: yushunrui <364203175@qq.com> Date: Thu, 11 Jan 2024 18:45:59 +0800 Subject: [PATCH 11/24] =?UTF-8?q?fix:=E8=B6=85=E5=80=BC=E5=9F=BA=E9=87=91?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=A5=96=E5=8A=B1=E9=80=BB=E8=BE=91=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=B8=BA=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/yuedujijin/ApiRec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api_s2c/event/yuedujijin/ApiRec.ts b/src/api_s2c/event/yuedujijin/ApiRec.ts index 039f191..0db9481 100644 --- a/src/api_s2c/event/yuedujijin/ApiRec.ts +++ b/src/api_s2c/event/yuedujijin/ApiRec.ts @@ -16,8 +16,8 @@ export default async function (call: ApiCall) { if (call.req.index > day) return call.errorCode(-3); if (rec.includes(call.req.index)) return call.errorCode(-4); - - G.mongodb.cEvent(type).updateOne({uid: call.uid, type: type}, {$push: {rec: call.req.index}}, {upsert: true}); + // 从异步改成同步 + await G.mongodb.cEvent(type).updateOne({uid: call.uid, type: type}, {$push: {rec: call.req.index}}, {upsert: true}); await PlayerFun.sendPrize(call, [].concat(conf.prize[call.req.index])); From 8aab7b6322b88524b480318a3a95be2eaddf9531 Mon Sep 17 00:00:00 2001 From: yushunrui <364203175@qq.com> Date: Wed, 10 Jan 2024 20:37:58 +0800 Subject: [PATCH 12/24] =?UTF-8?q?fix:=E5=A4=84=E7=90=86=E4=BA=BA=E6=89=8D?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E4=BB=BB=E5=8A=A1=E9=A2=86=E5=8F=96=E6=A0=87?= =?UTF-8?q?=E8=AF=86=E5=9C=A8=E5=88=B7=20=E6=96=B0=E4=B8=80=E8=BD=AE?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E6=B2=A1=E6=9C=89=E9=87=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/yangchengmubiao/ApiRec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/api_s2c/event/yangchengmubiao/ApiRec.ts b/src/api_s2c/event/yangchengmubiao/ApiRec.ts index c7c1bae..6d0efa0 100644 --- a/src/api_s2c/event/yangchengmubiao/ApiRec.ts +++ b/src/api_s2c/event/yangchengmubiao/ApiRec.ts @@ -35,6 +35,7 @@ export default async function (call: ApiCall) { _mydata.lunci += 1 _setData["taskval"] = _mydata.taskval _setData["lunci"] = _mydata.lunci + _setData["finishid"] = _mydata.finishid } // 设置任务改变数据 From 0a94965e3020eaa99c02a1749d467bf25716f80d Mon Sep 17 00:00:00 2001 From: yushunrui <364203175@qq.com> Date: Wed, 10 Jan 2024 21:14:10 +0800 Subject: [PATCH 13/24] =?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/api_s2c/event/chuanshuozhilu/ApiOpen.ts | 1 + src/localConfig.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts b/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts index a1d648d..cad12c5 100644 --- a/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts +++ b/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts @@ -17,6 +17,7 @@ export default async function (call: ApiCall) { // 如果初始没有数据,就判断玩家是否有活动对应的影响,生成一下初始化数据 if (!db) { + let _dbType: `chuanshuozhilu${number}` = `chuanshuozhilu${call.req.hdid}` const hid = _hdinfo.data.hid let heros = await G.mongodb.collection("hero").find({uid: call.uid, heroId: hid}) diff --git a/src/localConfig.ts b/src/localConfig.ts index 5b04b02..d8bcfee 100644 --- a/src/localConfig.ts +++ b/src/localConfig.ts @@ -17,7 +17,7 @@ export default { /**redis url */ redisUrl: 'redis://:lyMaple525458@10.0.1.20:6379/0', /**mongodb url */ - mongodbUrl: 'mongodb://root:lyMaple525458@10.0.1.20:27017/heijiao?authSource=admin', + mongodbUrl: 'mongodb://root:lyMaple525458@10.0.1.20:27017/heijiao_ysr?authSource=admin', /**cross redis url */ crossRedisUrl: 'redis://:lyMaple525458@10.0.1.20:6379/1', /**cross mongodb url */ @@ -27,7 +27,7 @@ export default { /**服务器时间 */ time: '', /**开服时间 */ - openTime: '2023-12-11 1:0:0', + openTime: '2024-01-05 1:0:0', /**项目名称 */ projectName: 'heijiao', /**加密key */ From 363787fb394586da2571baf7d3c02fc4dda4e0bd Mon Sep 17 00:00:00 2001 From: yushunrui <364203175@qq.com> Date: Wed, 10 Jan 2024 21:16:13 +0800 Subject: [PATCH 14/24] =?UTF-8?q?Revert=20"fix:=E7=AB=9E=E6=8A=80=E5=9C=BA?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E5=90=8D=E5=A4=B4=E5=83=8F=E7=89=B9=E6=AE=8A?= =?UTF-8?q?=E5=A4=84=E7=90=86=EF=BC=8C=E5=8F=AF=E4=BB=A5=E7=94=A8=E9=81=93?= =?UTF-8?q?=E5=85=B7=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 This reverts commit 0a94965e3020eaa99c02a1749d467bf25716f80d. --- src/api_s2c/event/chuanshuozhilu/ApiOpen.ts | 1 - src/localConfig.ts | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts b/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts index cad12c5..a1d648d 100644 --- a/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts +++ b/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts @@ -17,7 +17,6 @@ export default async function (call: ApiCall) { // 如果初始没有数据,就判断玩家是否有活动对应的影响,生成一下初始化数据 if (!db) { - let _dbType: `chuanshuozhilu${number}` = `chuanshuozhilu${call.req.hdid}` const hid = _hdinfo.data.hid let heros = await G.mongodb.collection("hero").find({uid: call.uid, heroId: hid}) diff --git a/src/localConfig.ts b/src/localConfig.ts index d8bcfee..5b04b02 100644 --- a/src/localConfig.ts +++ b/src/localConfig.ts @@ -17,7 +17,7 @@ export default { /**redis url */ redisUrl: 'redis://:lyMaple525458@10.0.1.20:6379/0', /**mongodb url */ - mongodbUrl: 'mongodb://root:lyMaple525458@10.0.1.20:27017/heijiao_ysr?authSource=admin', + mongodbUrl: 'mongodb://root:lyMaple525458@10.0.1.20:27017/heijiao?authSource=admin', /**cross redis url */ crossRedisUrl: 'redis://:lyMaple525458@10.0.1.20:6379/1', /**cross mongodb url */ @@ -27,7 +27,7 @@ export default { /**服务器时间 */ time: '', /**开服时间 */ - openTime: '2024-01-05 1:0:0', + openTime: '2023-12-11 1:0:0', /**项目名称 */ projectName: 'heijiao', /**加密key */ From b80263ed16ac6f2910136123dbb5b016c27155dd Mon Sep 17 00:00:00 2001 From: yushunrui <364203175@qq.com> Date: Wed, 10 Jan 2024 21:17:04 +0800 Subject: [PATCH 15/24] =?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/api_s2c/event/chuanshuozhilu/ApiOpen.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts b/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts index a1d648d..bd9bf35 100644 --- a/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts +++ b/src/api_s2c/event/chuanshuozhilu/ApiOpen.ts @@ -35,6 +35,7 @@ export default async function (call: ApiCall) { if (!cache[call.uid]) cache[call.uid] = {hid:{}}; if (!cache[call.uid][hid]) cache[call.uid][hid] = setInfo; _info[hid] = setInfo + G.server.sendMsgByUid(call.uid, 'msg_s2c/HongDianChange', ['huodonghd']); } From c09c9dec89ad097e8a8adaae156caa153411db87 Mon Sep 17 00:00:00 2001 From: ciniao <4041990@qq.com> Date: Wed, 10 Jan 2024 21:55:02 +0800 Subject: [PATCH 16/24] =?UTF-8?q?=E9=85=8D=E4=BB=B6=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/hero/ApiGetList.ts | 56 +++++++++++++++++++------------ src/api_s2c/peijian/ApiGetList.ts | 46 +++++++++++++++++++++---- 2 files changed, 74 insertions(+), 28 deletions(-) diff --git a/src/api_s2c/hero/ApiGetList.ts b/src/api_s2c/hero/ApiGetList.ts index aafd7e2..4969794 100644 --- a/src/api_s2c/hero/ApiGetList.ts +++ b/src/api_s2c/hero/ApiGetList.ts @@ -51,16 +51,24 @@ export default async function (call: ApiCall) { async function checkDataAndFix(call: ApiCall, list: ResGetList['list']) { try { // 修复配件数据 - let peijianids = []; - Object.values(list).map(hero => { - hero.peijian && Object.values(hero.peijian).map( - i => peijianids.push(G.mongodb.conversionId(PeijianShared.fmt(i)._id)) - ) - }); + //hero数据里,所有英雄穿戴中的配件的 _id(objectId) + // let peijianids = []; + // Object.values(list).map(hero => { + // hero.peijian && Object.values(hero.peijian).map( + // i => peijianids.push(G.mongodb.conversionId(PeijianShared.fmt(i)._id)) + // ) + // }); - let peijians = (await G.mongodb.collection("peijian").find( - {uid: call.uid, _id: {$in: peijianids}}, {projection: {_id: 1}} - ).toArray()).map(temp => G.mongodb.conversionId(temp._id)); + //通过上述的_id,去配件表查询所有配件 + // let wearedPeiJian = (await G.mongodb.collection("peijian").find( + // {uid: call.uid, _id: {$in: peijianids}}, {projection: {_id: 1, wearId:1}} + // ).toArray()); + + // //peijians = 所有从db里查到的peijian的 _id字符串数据集合 + // let peijians = wearedPeiJian.map(temp => { + // let idstr = G.mongodb.conversionId(temp._id) + // return idstr; + // }); let shiwuIds = R.flatten(R.values(list).map(hero => R.values(hero.shiwu).map(i => G.mongodb.conversionId(i._id)))) @@ -68,15 +76,19 @@ async function checkDataAndFix(call: ApiCall, list: ResGetList['list']) { {uid: call.uid, _id: {$in: shiwuIds}}, {projection: {_id: 1}} ).toArray()).map(i => G.mongodb.conversionId(i._id)); - let peijianChanges = {}; + //let peijianChanges = {}; let shiwuChanges = {}; Object.values(list).map(hero => { - for (let pos in hero.peijian) { - if (!peijians.includes(PeijianShared.fmt(hero.peijian[pos])._id)) { - hero.peijian[pos] = ""; - peijianChanges[hero._id] = hero.peijian; - } - } + // for (let pos in hero.peijian) { + // //hero该位置记录的穿戴中的配件_id + // let _pid = PeijianShared.fmt(hero.peijian[pos])._id; + + // if (!peijians.includes(_pid) || peijianWearTo?.[_pid] != hero._id ) { + // //这个配件,实际在peijian表里不存在 或 配件表里该配件并不是在这个英雄身上 + // hero.peijian[pos] = ""; + // peijianChanges[hero._id] = hero.peijian; + // } + // } for (let pos in hero.shiwu) { if (!shiwus.includes(hero.shiwu[pos]._id)) { hero.shiwu = R.omit([pos], hero.shiwu) @@ -85,12 +97,12 @@ async function checkDataAndFix(call: ApiCall, list: ResGetList['list']) { } }) - for (let oid in peijianChanges) { - // 修复数据 - G.mongodb.collection("hero").updateOne( - G.mongodb.conversionIdObj({_id: oid}), {$set: {peijian: peijianChanges[oid]}} - ) - } + // for (let oid in peijianChanges) { + // // 修复数据 + // G.mongodb.collection("hero").updateOne( + // G.mongodb.conversionIdObj({_id: oid}), {$set: {peijian: peijianChanges[oid]}} + // ) + // } for (let oid in shiwuChanges) { // 修复数据 diff --git a/src/api_s2c/peijian/ApiGetList.ts b/src/api_s2c/peijian/ApiGetList.ts index 6a74c13..28d6559 100644 --- a/src/api_s2c/peijian/ApiGetList.ts +++ b/src/api_s2c/peijian/ApiGetList.ts @@ -1,12 +1,38 @@ import {ApiCall} from "tsrpc"; -import {ReqGetList, ResGetList} from "../../shared/protocols/peijian/PtlGetList"; +import { connGameLogDB } from "../../gameLog"; +import {PeiJian, ReqGetList, ResGetList} from "../../shared/protocols/peijian/PtlGetList"; +import { PeijianShared } from "../../shared/public/peijian"; export default async function (call: ApiCall) { let _maxLv = 0 let color = {} let peijianCon = G.gc.peijian + //所有上阵的英雄_id + let heroIds = R.values(call.conn.gud.heroPos) + //将所有未上阵的英雄的配件卸下 + if(heroIds.length>0){ + let _ids = heroIds.map(_id => G.mongodb.conversionId(_id)); + await G.mongodb.collection("hero").updateMany({uid: call.conn.uid},{ + $set:{ + peijian:{} + } + }); + } + //如果配件穿戴在了未上阵的hero身上,则执行卸下操作 + await G.mongodb.collection('peijian').updateMany({uid: call.conn.uid, wearId: {$nin: heroIds}}, {$set: {wearId: ''}}) + + + let heroPeiJian = {}; let dbList = (await G.mongodb.collection('peijian').find({uid: call.uid}).toArray()).map(p => { + + if(p.wearId){ + if(!heroPeiJian[ p.wearId ]){ + heroPeiJian[ p.wearId ] = {}; + } + heroPeiJian[ p.wearId ][ Object.keys(heroPeiJian[ p.wearId ]).length + 1 ] = PeijianShared.fmt( p as any ) + } + let np = G.mongodb.conversionIdObj(p); let {uid, ...ops} = np; @@ -16,17 +42,25 @@ export default async function (call: ApiCall) { return ops; }); - // 修复配件穿戴在不存在的英雄身上 - let heroIds = R.values(call.conn.gud.heroPos) - let fixIds = dbList.filter(i => i.wearId && !heroIds.includes(i.wearId)).map(i => G.mongodb.conversionId(i._id)) - if (fixIds.length) { - await G.mongodb.collection('peijian').updateMany({_id: {$in: fixIds}}, {$set: {wearId: ''}}) + //对hero的peijian字段进行修正 + if(Object.keys(heroPeiJian).length > 0){ + for(let heroid in heroPeiJian){ + await G.mongodb.collection("hero").updateOne({ + uid : call.conn.uid, + _id : G.mongodb.conversionId(heroid) + },{ + $set:{ + peijian : heroPeiJian[heroid] + } + }); + } } // 记录玩家最大等级,颜色相关数据 注册任务用 await G.mongodb.collection('playerInfo', 'usertasklog').updateOne({uid: call.conn.uid, type: 'usertasklog'}, {$set: {maxpeijianlv: _maxLv, peijiancolor: color}}, {upsert: true}) + let list = Object.fromEntries(dbList.map(p => [G.formatRedisKey(p._id), p])); G.redis.set('peijian', call.uid, list); From 45c5a195ed9967cbbc3afa0db2543ec35db39629 Mon Sep 17 00:00:00 2001 From: ciniao <4041990@qq.com> Date: Wed, 10 Jan 2024 23:08:14 +0800 Subject: [PATCH 17/24] =?UTF-8?q?addhp=E4=B8=8D=E5=BA=94=E8=AF=A5=E5=8F=96?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shared/public/hero.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/public/hero.ts b/src/shared/public/hero.ts index dbddc83..261d609 100644 --- a/src/shared/public/hero.ts +++ b/src/shared/public/hero.ts @@ -305,7 +305,7 @@ export class HeroShared { static amendAttr(buff: k_v) { for (let k in buff) { if (typeof buff[k] != 'number') continue; - if (k.indexOf('pro') != -1 || k.indexOf('drop') != -1) continue; + if (k.indexOf('pro') != -1 || k.indexOf('drop') != -1 || k=='addhp') continue; buff[k] = Math.floor(buff[k]); } } From 325ed8745cc09f246017d664f1a5aef0759ed9e0 Mon Sep 17 00:00:00 2001 From: xichaoyin Date: Thu, 11 Jan 2024 11:20:14 +0800 Subject: [PATCH 18/24] =?UTF-8?q?fix:=E6=97=B6=E5=8C=BA=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zoeninfo.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/zoeninfo.sh b/zoeninfo.sh index 3decece..254ea0e 100644 --- a/zoeninfo.sh +++ b/zoeninfo.sh @@ -1,9 +1,5 @@ - # "Asia/Shanghai" # "Asia/Tokyo" - cp "/usr/share/zoneinfo/$1" "/etc/localtime" - echo "$1" > /etc/timezone -pm2 restart all || true \ No newline at end of file From 2c3d53899e61bbc52238949603432be0d2bd6545 Mon Sep 17 00:00:00 2001 From: ciniao <4041990@qq.com> Date: Thu, 11 Jan 2024 11:23:08 +0800 Subject: [PATCH 19/24] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=EF=BC=8C=E8=A7=A3?= =?UTF-8?q?=E5=86=B3pm2=E9=9B=86=E7=BE=A4=E5=90=AF=E5=8A=A8=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zoeninfo.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zoeninfo.sh b/zoeninfo.sh index 254ea0e..de007f2 100644 --- a/zoeninfo.sh +++ b/zoeninfo.sh @@ -3,3 +3,8 @@ cp "/usr/share/zoneinfo/$1" "/etc/localtime" echo "$1" > /etc/timezone +for i in `env | grep -E -i 'SERVER_GAME' | sed 's/=.*//'` ; do + unset $i +done + + From 847613db4a52e272107a76efb98beb6e23ab4fb2 Mon Sep 17 00:00:00 2001 From: xichaoyin Date: Thu, 11 Jan 2024 14:51:17 +0800 Subject: [PATCH 20/24] =?UTF-8?q?fix:=E4=B8=9B=E6=9E=97=E7=8B=A9=E7=8C=8E?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E5=99=A8=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/scheduler/scheduler_clsl.ts | 30 +++++++++++++++----------- src/setStartAfther.ts | 4 ++-- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/public/scheduler/scheduler_clsl.ts b/src/public/scheduler/scheduler_clsl.ts index b068a8b..117fe01 100644 --- a/src/public/scheduler/scheduler_clsl.ts +++ b/src/public/scheduler/scheduler_clsl.ts @@ -1,7 +1,7 @@ -import {PublicShared} from '../../shared/public/public'; -import {EmailFun} from '../email'; -import {RankClslCross} from '../rank/rank_clsl'; -import {Scheduler, schedulerType} from './scheduler'; +import { PublicShared } from '../../shared/public/public'; +import { EmailFun } from '../email'; +import { RankClslCross } from '../rank/rank_clsl'; +import { Scheduler, schedulerType } from './scheduler'; /** * 丛林猎手赛季重置 @@ -26,12 +26,12 @@ export class SchedulerClslLocalCtor extends Scheduler { // 修改clslCrossUser表中的uid为del_uid_week 并且 设置ttltime为当前时间 await G.mongodb.collection('clslCrossUser').updateMany( { - ttltime: {$exists: false} - }, {$rename: {"uid": `del_uid_${week}`}, $set: {"ttltime": new Date()}} + ttltime: { $exists: false } + }, { $rename: { "uid": `del_uid_${week}` }, $set: { "ttltime": new Date() } } ); // 获取分组信息 重置排行榜 - let groups = await G.mongodb.collection('clslCrossGroup').findOne({week}); + let groups = await G.mongodb.collection('clslCrossGroup').findOne({ week }); Object.keys(groups.groups).forEach((group) => { // 清理排行数据 new RankClslCross(group).clear(); @@ -64,7 +64,7 @@ export class SchedulerClslCrossCtor extends Scheduler { async start() { let week = PublicShared.getToWeek(); let users = await G.mongodb.collection('clslCrossUser').find({ - ttltime: {$exists: false} + ttltime: { $exists: false } }, { projection: { "uid": 1, @@ -118,15 +118,15 @@ export class SchedulerClslCrossCtor extends Scheduler { // 更新玩家分组id for (let group in groups) { - await G.mongodb.collection('clslCrossUser').updateMany({uid: {$in: groups[group].users}}, {$set: {group: group}}); + await G.mongodb.collection('clslCrossUser').updateMany({ uid: { $in: groups[group].users } }, { $set: { group: group } }); } // 记录分组 - await G.mongodb.collection("clslCrossGroup").updateOne({week: week}, {$set: {groups: groups}}, {upsert: true}); + await G.mongodb.collection("clslCrossGroup").updateOne({ week: week }, { $set: { groups: groups } }, { upsert: true }); // 初始化丛林猎手排行榜 G.mongodb.collection('clslCrossUser').find({ - allStar: {$gte: this.star}, ttltime: {$exists: false} + allStar: { $gte: this.star }, ttltime: { $exists: false } }).toArray().then(users => { users.forEach(u => { new RankClslCross(u.group).addNew({ @@ -161,7 +161,13 @@ export class SchedulerClslPrize extends Scheduler { async start() { // 排名奖励 let group2users: { [group: string]: string[] } = {}; - (await G.mongodb.collection('clslCrossUser').find({allStar: {$gte: this.star}}).toArray()).forEach(u => { + (await G.mongodb.collection('clslCrossUser').find( + { + uid: { $exists: true }, + allStar: { $gte: this.star } + }, + { sort: { allStar: -1 } } + ).limit(10).toArray()).forEach(u => { if (u.group in group2users) { group2users[u.group].push(u.uid); } else { diff --git a/src/setStartAfther.ts b/src/setStartAfther.ts index 19ebf83..bd0eb16 100644 --- a/src/setStartAfther.ts +++ b/src/setStartAfther.ts @@ -86,8 +86,8 @@ export async function startAfter() { new SchedulerSlzdClean().init(); new SchedulerSlzdPrize().init(); - new SchedulerClslPrize().init(); - new SchedulerClslLocalCtor().init(); + // new SchedulerClslPrize().init(); + // new SchedulerClslLocalCtor().init(); new SchedulerWzryAutoBaoMing().init(); new SchedulerWzryjingcaiSendPrize().init(); new SchedulerWzryendDel().init(); From ac4432fea87114d30473dee178d996541b5f2bd9 Mon Sep 17 00:00:00 2001 From: yushunrui <364203175@qq.com> Date: Fri, 12 Jan 2024 22:52:56 +0800 Subject: [PATCH 21/24] =?UTF-8?q?fix:=E5=A4=B4=E5=83=8F=E6=A1=86=20?= =?UTF-8?q?=E8=81=8A=E5=A4=A9=E6=A1=86=EF=BC=8C=E9=80=A0=E5=9E=8B=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/user.ts | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/public/user.ts b/src/public/user.ts index a89f392..851f82c 100644 --- a/src/public/user.ts +++ b/src/public/user.ts @@ -297,12 +297,10 @@ export class UserFun { if (val == -1 && !gud.headFrames[conf.id]) { change = true; gud.headFrames[conf.id] = -1; - } else if (!gud.headFrames[conf.id] || gud.headFrames[conf.id] < G.time) { + } + else if (val >= 0) { change = true; gud.headFrames[conf.id] = G.time + val * v; - } else { - change = true; - gud.headFrames[conf.id] += val * v; } } else if(conf?.cond?.[0] == "jjc_rank") { @@ -344,19 +342,15 @@ export class UserFun { if (conf?.cond?.[0] == 'time') { let val = conf.cond[1]; - if (val == -1 && !gud.chatFrames[conf.id]) { + if (val == -1 && !gud.headFrames[conf.id]) { change = true; - gud.chatFrames[conf.id] = -1; - } else if (!gud.chatFrames[conf.id] || gud.chatFrames[conf.id] < G.time) { + gud.headFrames[conf.id] = -1; + } else if (val >= 0) { change = true; - gud.chatFrames[conf.id] = G.time + val * v; - } else { - change = true; - gud.chatFrames[conf.id] += val * v; + gud.headFrames[conf.id] = G.time + val * v; } } } - if (change) { PlayerFun.changeAttr(uid, {chatFrames: gud.chatFrames}); G.server.sendMsgByUid(uid, 'msg_s2c/PlayerChange', {chatFrames: gud.chatFrames}); @@ -391,15 +385,13 @@ export class UserFun { if (conf?.cond?.[0] == 'time') { let val = conf.cond[1]; - if (val == -1) { + if (val == -1 && !gud.headFrames[conf.id]) { change = true; - gud.model[conf.id] = {id: conf.id + '', time: -1}; - } else if (gud.model[conf.id].time < G.time) { + gud.headFrames[conf.id] = -1; + } + else if (val >= 0) { change = true; - gud.model[conf.id] = {id: conf.id + '', time: G.time + val * v}; - } else { - change = true; - gud.model[conf.id] = {id: conf.id + '', time: gud.model[conf.id].time += val * v} + gud.headFrames[conf.id] = G.time + val * v; } } } From c7ce70fcc0ca7abbbcb588b83df73e84200f4e0f Mon Sep 17 00:00:00 2001 From: yushunrui <364203175@qq.com> Date: Fri, 12 Jan 2024 23:10:39 +0800 Subject: [PATCH 22/24] =?UTF-8?q?fix:=E5=A4=84=E7=90=86=E4=BA=86=E5=A4=B4?= =?UTF-8?q?=E5=83=8F=E6=A1=86=E5=92=8C=E8=81=8A=E5=A4=A9=E6=A1=86=E5=BE=97?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/user.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/public/user.ts b/src/public/user.ts index 851f82c..a9270b0 100644 --- a/src/public/user.ts +++ b/src/public/user.ts @@ -297,8 +297,7 @@ export class UserFun { if (val == -1 && !gud.headFrames[conf.id]) { change = true; gud.headFrames[conf.id] = -1; - } - else if (val >= 0) { + } else if (val > 0 && gud.headFrames[conf.id] != -1) { change = true; gud.headFrames[conf.id] = G.time + val * v; } @@ -342,15 +341,16 @@ export class UserFun { if (conf?.cond?.[0] == 'time') { let val = conf.cond[1]; - if (val == -1 && !gud.headFrames[conf.id]) { + if (val == -1 && !gud.chatFrames[conf.id]) { change = true; - gud.headFrames[conf.id] = -1; - } else if (val >= 0) { + gud.chatFrames[conf.id] = -1; + } else if (val > 0 && gud.chatFrames[conf.id] != -1) { change = true; - gud.headFrames[conf.id] = G.time + val * v; + gud.chatFrames[conf.id] = G.time + val * v; } } } + if (change) { PlayerFun.changeAttr(uid, {chatFrames: gud.chatFrames}); G.server.sendMsgByUid(uid, 'msg_s2c/PlayerChange', {chatFrames: gud.chatFrames}); @@ -385,13 +385,15 @@ export class UserFun { if (conf?.cond?.[0] == 'time') { let val = conf.cond[1]; - if (val == -1 && !gud.headFrames[conf.id]) { + if (val == -1) { change = true; - gud.headFrames[conf.id] = -1; - } - else if (val >= 0) { + gud.model[conf.id] = {id: conf.id + '', time: -1}; + } else if (gud.model[conf.id].time < G.time) { change = true; - gud.headFrames[conf.id] = G.time + val * v; + gud.model[conf.id] = {id: conf.id + '', time: G.time + val * v}; + } else { + change = true; + gud.model[conf.id] = {id: conf.id + '', time: gud.model[conf.id].time += val * v} } } } From 184bdd304e0e4d3dd857b8101f4d6c0ef2ad12ba Mon Sep 17 00:00:00 2001 From: yushunrui <364203175@qq.com> Date: Fri, 12 Jan 2024 23:32:40 +0800 Subject: [PATCH 23/24] =?UTF-8?q?=E8=84=9A=E6=9C=AC=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=EF=BC=8C=E5=85=91=E6=8D=A2=E6=8E=89=E8=90=BD=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=A4=BC=E5=8C=85=E5=86=85=E5=AE=B9=EF=BC=8C=20=E7=8E=A9?= =?UTF-8?q?=E5=AE=B6=E6=96=B0=E5=B9=B4=E5=A4=B4=E5=83=8F=E6=A1=86=E5=88=B7?= =?UTF-8?q?=E6=88=90=E6=B0=B8=E4=B9=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fix_patch/patch_20240112.ts | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/fix_patch/patch_20240112.ts diff --git a/src/fix_patch/patch_20240112.ts b/src/fix_patch/patch_20240112.ts new file mode 100644 index 0000000..2a03906 --- /dev/null +++ b/src/fix_patch/patch_20240112.ts @@ -0,0 +1,48 @@ +import { patchFun, patchInit } from "../patch"; + +class Path { + + async huodong2(a: any) { + const hdids = [2002,2003] + const hdinfos = await G.mongodb.find('hdinfo', { hdid: { $in: hdids } }) + for (let i = 0; i < hdinfos.length; i++) { + let hdinfo = hdinfos[i] + hdinfo.data.gift = {} + + await G.mongodb.collection('hdinfo').updateOne({ "hdid": hdinfo.hdid}, { "$set": {"data.figt": {}} }); + console.log(hdinfo.hdid,"finish") + } + + return "sucess!!!" + } + + async headFrame(a: any) { + const users = await G.mongodb.find('user', {"headFrames.25": {"$exists": 1}}) + for (let i = 0; i < users.length; i++) { + let user = users[i] + user.headFrames["25"] = -1 + await G.mongodb.collection('user').updateOne({ "uid": user.uid}, { "$set": {"headFrames": user.headFrames} }); + console.log(user.uid, user.headFrames) + } + + return "sucess!!!" + } + + + async run() { + await this.huodong2(1); + await this.headFrame(1); + } +} + +async function main() { + await patchInit() + let patch = new Path(); + await patch.run(); + console.log("逻辑执行完成,等待退出"); + setTimeout(function () { + console.log('结束程序'); + process.exit(); + }, 3000); +} +main(); From 6eb61ece9c1c5cf4357d67337ea83d060818d75b Mon Sep 17 00:00:00 2001 From: yushunrui <364203175@qq.com> Date: Fri, 12 Jan 2024 23:53:59 +0800 Subject: [PATCH 24/24] =?UTF-8?q?fix:=E5=A4=84=E7=90=86=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E5=92=8C=E6=96=B0=E5=B9=B4=E5=A4=B4=E5=83=8F=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fix_patch/patch_20240112.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/fix_patch/patch_20240112.ts b/src/fix_patch/patch_20240112.ts index 2a03906..a51f304 100644 --- a/src/fix_patch/patch_20240112.ts +++ b/src/fix_patch/patch_20240112.ts @@ -12,7 +12,6 @@ class Path { await G.mongodb.collection('hdinfo').updateOne({ "hdid": hdinfo.hdid}, { "$set": {"data.figt": {}} }); console.log(hdinfo.hdid,"finish") } - return "sucess!!!" } @@ -24,7 +23,6 @@ class Path { await G.mongodb.collection('user').updateOne({ "uid": user.uid}, { "$set": {"headFrames": user.headFrames} }); console.log(user.uid, user.headFrames) } - return "sucess!!!" }