Merge remote-tracking branch 'origin/bugfix' into dev
# Conflicts: # src/public/player.ts # src/shared/fightControl/fightCntrol.ts
This commit is contained in:
commit
f0df93cdd1
@ -12,11 +12,38 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
|||||||
// 无此活动
|
// 无此活动
|
||||||
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })
|
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 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({
|
call.succ({
|
||||||
info: db?.info || {},
|
info: _info,
|
||||||
hdinfo: _hdinfo
|
hdinfo: _hdinfo
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ export default async function (call: ApiCall<ReqRec, ResRec>) {
|
|||||||
_mydata.lunci += 1
|
_mydata.lunci += 1
|
||||||
_setData["taskval"] = _mydata.taskval
|
_setData["taskval"] = _mydata.taskval
|
||||||
_setData["lunci"] = _mydata.lunci
|
_setData["lunci"] = _mydata.lunci
|
||||||
|
_setData["finishid"] = _mydata.finishid
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置任务改变数据
|
// 设置任务改变数据
|
||||||
|
@ -16,8 +16,8 @@ export default async function (call: ApiCall<ReqRec, ResRec>) {
|
|||||||
if (call.req.index > day) return call.errorCode(-3);
|
if (call.req.index > day) return call.errorCode(-3);
|
||||||
if (rec.includes(call.req.index)) return call.errorCode(-4);
|
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]));
|
await PlayerFun.sendPrize(call, [].concat(conf.prize[call.req.index]));
|
||||||
|
@ -51,16 +51,24 @@ export default async function (call: ApiCall<ReqGetList, ResGetList>) {
|
|||||||
async function checkDataAndFix(call: ApiCall, list: ResGetList['list']) {
|
async function checkDataAndFix(call: ApiCall, list: ResGetList['list']) {
|
||||||
try {
|
try {
|
||||||
// 修复配件数据
|
// 修复配件数据
|
||||||
let peijianids = [];
|
//hero数据里,所有英雄穿戴中的配件的 _id(objectId)
|
||||||
Object.values(list).map(hero => {
|
// let peijianids = [];
|
||||||
hero.peijian && Object.values(hero.peijian).map(
|
// Object.values(list).map(hero => {
|
||||||
i => peijianids.push(G.mongodb.conversionId(PeijianShared.fmt(i)._id))
|
// 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(
|
//通过上述的_id,去配件表查询所有配件
|
||||||
{uid: call.uid, _id: {$in: peijianids}}, {projection: {_id: 1}}
|
// let wearedPeiJian = (await G.mongodb.collection("peijian").find(
|
||||||
).toArray()).map(temp => G.mongodb.conversionId(temp._id));
|
// {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))))
|
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}}
|
{uid: call.uid, _id: {$in: shiwuIds}}, {projection: {_id: 1}}
|
||||||
).toArray()).map(i => G.mongodb.conversionId(i._id));
|
).toArray()).map(i => G.mongodb.conversionId(i._id));
|
||||||
|
|
||||||
let peijianChanges = {};
|
//let peijianChanges = {};
|
||||||
let shiwuChanges = {};
|
let shiwuChanges = {};
|
||||||
Object.values(list).map(hero => {
|
Object.values(list).map(hero => {
|
||||||
for (let pos in hero.peijian) {
|
// for (let pos in hero.peijian) {
|
||||||
if (!peijians.includes(PeijianShared.fmt(hero.peijian[pos])._id)) {
|
// //hero该位置记录的穿戴中的配件_id
|
||||||
hero.peijian[pos] = "";
|
// let _pid = PeijianShared.fmt(hero.peijian[pos])._id;
|
||||||
peijianChanges[hero._id] = hero.peijian;
|
|
||||||
}
|
// if (!peijians.includes(_pid) || peijianWearTo?.[_pid] != hero._id ) {
|
||||||
}
|
// //这个配件,实际在peijian表里不存在 或 配件表里该配件并不是在这个英雄身上
|
||||||
|
// hero.peijian[pos] = "";
|
||||||
|
// peijianChanges[hero._id] = hero.peijian;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
for (let pos in hero.shiwu) {
|
for (let pos in hero.shiwu) {
|
||||||
if (!shiwus.includes(hero.shiwu[pos]._id)) {
|
if (!shiwus.includes(hero.shiwu[pos]._id)) {
|
||||||
hero.shiwu = R.omit([pos], hero.shiwu)
|
hero.shiwu = R.omit([pos], hero.shiwu)
|
||||||
@ -85,12 +97,12 @@ async function checkDataAndFix(call: ApiCall, list: ResGetList['list']) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
for (let oid in peijianChanges) {
|
// for (let oid in peijianChanges) {
|
||||||
// 修复数据
|
// // 修复数据
|
||||||
G.mongodb.collection("hero").updateOne(
|
// G.mongodb.collection("hero").updateOne(
|
||||||
G.mongodb.conversionIdObj({_id: oid}), {$set: {peijian: peijianChanges[oid]}}
|
// G.mongodb.conversionIdObj({_id: oid}), {$set: {peijian: peijianChanges[oid]}}
|
||||||
)
|
// )
|
||||||
}
|
// }
|
||||||
|
|
||||||
for (let oid in shiwuChanges) {
|
for (let oid in shiwuChanges) {
|
||||||
// 修复数据
|
// 修复数据
|
||||||
|
@ -30,6 +30,6 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
UserFun.activeHeadFrame(call.uid, 'jjc_rank', data["rank"] + 1);
|
UserFun.activeHeadFrame(call.uid, 'jjc_rank', data["rank"] + 1);
|
||||||
JJCFun.checkUpdatePlayer()
|
//JJCFun.checkUpdatePlayer()
|
||||||
|
|
||||||
}
|
}
|
@ -1,12 +1,38 @@
|
|||||||
import {ApiCall} from "tsrpc";
|
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<ReqGetList, ResGetList>) {
|
export default async function (call: ApiCall<ReqGetList, ResGetList>) {
|
||||||
let _maxLv = 0
|
let _maxLv = 0
|
||||||
let color = {}
|
let color = {}
|
||||||
let peijianCon = G.gc.peijian
|
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 => {
|
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 np = G.mongodb.conversionIdObj(p);
|
||||||
let {uid, ...ops} = np;
|
let {uid, ...ops} = np;
|
||||||
|
|
||||||
@ -16,17 +42,25 @@ export default async function (call: ApiCall<ReqGetList, ResGetList>) {
|
|||||||
return ops;
|
return ops;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 修复配件穿戴在不存在的英雄身上
|
//对hero的peijian字段进行修正
|
||||||
let heroIds = R.values(call.conn.gud.heroPos)
|
if(Object.keys(heroPeiJian).length > 0){
|
||||||
let fixIds = dbList.filter(i => i.wearId && !heroIds.includes(i.wearId)).map(i => G.mongodb.conversionId(i._id))
|
for(let heroid in heroPeiJian){
|
||||||
if (fixIds.length) {
|
await G.mongodb.collection("hero").updateOne({
|
||||||
await G.mongodb.collection('peijian').updateMany({_id: {$in: fixIds}}, {$set: {wearId: ''}})
|
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'},
|
await G.mongodb.collection('playerInfo', 'usertasklog').updateOne({uid: call.conn.uid, type: 'usertasklog'},
|
||||||
{$set: {maxpeijianlv: _maxLv, peijiancolor: color}}, {upsert: true})
|
{$set: {maxpeijianlv: _maxLv, peijiancolor: color}}, {upsert: true})
|
||||||
|
|
||||||
|
|
||||||
let list = Object.fromEntries(dbList.map(p => [G.formatRedisKey(p._id), p]));
|
let list = Object.fromEntries(dbList.map(p => [G.formatRedisKey(p._id), p]));
|
||||||
G.redis.set('peijian', call.uid, list);
|
G.redis.set('peijian', call.uid, list);
|
||||||
|
|
||||||
|
117
src/fix_patch/patch_20240110.ts
Normal file
117
src/fix_patch/patch_20240110.ts
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
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();
|
||||||
|
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) {
|
||||||
|
let deltask = unFinishTask.sort().slice(1);
|
||||||
|
await G.mongodb.collection("task").deleteOne({
|
||||||
|
uid: user.uid, taskid: { $in: deltask }
|
||||||
|
});
|
||||||
|
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("没有终身卡数据,不发放终身卡");
|
||||||
|
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++) {
|
||||||
|
|
||||||
|
// 查询玩家邮件
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
await patchInit()
|
||||||
|
let patch = new Path();
|
||||||
|
await patch.run();
|
||||||
|
console.log("逻辑执行完成,等待退出");
|
||||||
|
setTimeout(function () {
|
||||||
|
console.log('结束程序');
|
||||||
|
process.exit();
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
main();
|
46
src/fix_patch/patch_20240112.ts
Normal file
46
src/fix_patch/patch_20240112.ts
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
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();
|
@ -94,37 +94,37 @@ export class JJCFun {
|
|||||||
* @param uTimeOffset
|
* @param uTimeOffset
|
||||||
* @param isUpdate 是否更新数据
|
* @param isUpdate 是否更新数据
|
||||||
*/
|
*/
|
||||||
static async checkUpdatePlayer(min: number = 0, max: number = 1000, uTimeOffset: number = 600, isUpdate: boolean = true) {
|
// static async checkUpdatePlayer(min: number = 0, max: number = 1000, uTimeOffset: number = 600, isUpdate: boolean = true) {
|
||||||
// 获取指定排名用户uid
|
// // 获取指定排名用户uid
|
||||||
let sortInfo = await this.getRankListUid(min, max)
|
// let sortInfo = await this.getRankListUid(min, max)
|
||||||
if (!sortInfo.length) return []
|
// if (!sortInfo.length) return []
|
||||||
let updateArr = []
|
// 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++) {
|
// for (let i = 0; i < sortInfo.length; i++) {
|
||||||
let uid = sortInfo[i]
|
// let uid = sortInfo[i]
|
||||||
let rankInfo = users[uid]
|
// let rankInfo = users[uid]
|
||||||
if (!rankInfo?.player) continue
|
// if (!rankInfo?.player) continue
|
||||||
// 比对utime,判断是否更新数据
|
// // 比对utime,判断是否更新数据
|
||||||
if (!rankInfo.player.isNpc) {
|
// if (!rankInfo.player.isNpc) {
|
||||||
if (!rankInfo.utime || (rankInfo.utime && rankInfo.utime < (G.time - uTimeOffset))) {
|
// if (!rankInfo.utime || (rankInfo.utime && rankInfo.utime < (G.time - uTimeOffset))) {
|
||||||
updateArr.push(rankInfo)
|
// updateArr.push(rankInfo)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// 更新数据
|
// // 更新数据
|
||||||
if (isUpdate && updateArr.length > 0) {
|
// if (isUpdate && updateArr.length > 0) {
|
||||||
let playerArrInfo = await G.mongodb.collection("user").find({uid: {$in: updateArr.map(i => i.uid)}}).toArray()
|
// let playerArrInfo = await G.mongodb.collection("user").find({uid: {$in: updateArr.map(i => i.uid)}}).toArray()
|
||||||
for (let i = 0; i < playerArrInfo.length; i++) {
|
// for (let i = 0; i < playerArrInfo.length; i++) {
|
||||||
let playerInfo = playerArrInfo[i]
|
// let playerInfo = playerArrInfo[i]
|
||||||
let index = updateArr.findIndex(x => x.player.uid == playerInfo.uid)
|
// let index = updateArr.findIndex(x => x.player.uid == playerInfo.uid)
|
||||||
updateArr[index].player = playerInfo
|
// updateArr[index].player = playerInfo
|
||||||
updateArr[index].utime = G.time
|
// updateArr[index].utime = G.time
|
||||||
this.updatePlayerData(playerInfo.uid, updateArr[index]);
|
// this.updatePlayerData(playerInfo.uid, updateArr[index]);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定范围排名的用户,仅返回uid[]
|
* 获取指定范围排名的用户,仅返回uid[]
|
||||||
|
@ -260,7 +260,10 @@ export class PayFun {
|
|||||||
let selectPrize = await G.ioredis.get(`pay:${payId}:${player.uid}`);
|
let selectPrize = await G.ioredis.get(`pay:${payId}:${player.uid}`);
|
||||||
if (selectPrize) {
|
if (selectPrize) {
|
||||||
prize.push(...JSON.parse(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}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,9 @@ import { getGud, setGud } from './gud';
|
|||||||
import {addGameLog} from "../gameLog";
|
import {addGameLog} from "../gameLog";
|
||||||
import {PushGiftFun} from "./pushgift";
|
import {PushGiftFun} from "./pushgift";
|
||||||
import { ActionLog } from './actionLog/actionLog';
|
import { ActionLog } from './actionLog/actionLog';
|
||||||
import HeroSkinFun from './heroskin';
|
import { roleDataType } from '../shared/fightControl/fightType';
|
||||||
|
import { PlayerShared } from '../shared/public/player';
|
||||||
|
|
||||||
|
|
||||||
export type call = {
|
export type call = {
|
||||||
get otherBuff(): otherBuff;
|
get otherBuff(): otherBuff;
|
||||||
@ -41,6 +43,41 @@ export type call = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export class PlayerFun {
|
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<roleDataType> = {};
|
||||||
|
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数量
|
* 获取玩家atn数量
|
||||||
*/
|
*/
|
||||||
|
@ -161,7 +161,13 @@ export class SchedulerClslPrize extends Scheduler {
|
|||||||
async start() {
|
async start() {
|
||||||
// 排名奖励
|
// 排名奖励
|
||||||
let group2users: { [group: string]: string[] } = {};
|
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) {
|
if (u.group in group2users) {
|
||||||
group2users[u.group].push(u.uid);
|
group2users[u.group].push(u.uid);
|
||||||
} else {
|
} else {
|
||||||
|
@ -261,28 +261,28 @@ export class TaskFun {
|
|||||||
delete _w["finish"];
|
delete _w["finish"];
|
||||||
}
|
}
|
||||||
let _tmp = await this.getUserTaksList(call.uid, _w);
|
let _tmp = await this.getUserTaksList(call.uid, _w);
|
||||||
// 没有未完成任务
|
// // 没有未完成任务 后续添加任务直接使用脚本刷任务
|
||||||
// 检测是否有新加任务
|
// // 检测是否有新加任务
|
||||||
if (_tmp.length == 0) {
|
// if (_tmp.length == 0) {
|
||||||
let rectask = (await G.mongodb.collection('task').find(
|
// let rectask = (await G.mongodb.collection('task').find(
|
||||||
{ uid: call.uid, type: _type }, { projection: { taskid: 1, _id: 0 } }
|
// { uid: call.uid, type: _type }, { projection: { taskid: 1, _id: 0 } }
|
||||||
).toArray()).map(e => e.taskid);
|
// ).toArray()).map(e => e.taskid);
|
||||||
|
|
||||||
for (let taskid of rectask) {
|
// for (let taskid of rectask) {
|
||||||
let conf = G.gc.task[_type][taskid];
|
// let conf = G.gc.task[_type][taskid];
|
||||||
// 配置不存在
|
// // 配置不存在
|
||||||
// 没有后续任务
|
// // 没有后续任务
|
||||||
// 后续任务已完成
|
// // 后续任务已完成
|
||||||
if (!conf || !conf.followtask || rectask.includes(conf.followtask)) {
|
// if (!conf || !conf.followtask || rectask.includes(conf.followtask)) {
|
||||||
continue
|
// continue
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 生成后续任务
|
// // 生成后续任务
|
||||||
await this.setTaskInfo(call, conf.followtask, { type: _type });
|
// await this.setTaskInfo(call, conf.followtask, { type: _type });
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
_tmp = await this.getUserTaksList(call.uid, _w);
|
// _tmp = await this.getUserTaksList(call.uid, _w);
|
||||||
}
|
// }
|
||||||
_r[_type] = _tmp;
|
_r[_type] = _tmp;
|
||||||
}
|
}
|
||||||
return _r;
|
return _r;
|
||||||
|
@ -297,16 +297,16 @@ export class UserFun {
|
|||||||
if (val == -1 && !gud.headFrames[conf.id]) {
|
if (val == -1 && !gud.headFrames[conf.id]) {
|
||||||
change = true;
|
change = true;
|
||||||
gud.headFrames[conf.id] = -1;
|
gud.headFrames[conf.id] = -1;
|
||||||
} else if (!gud.headFrames[conf.id] || gud.headFrames[conf.id] < G.time) {
|
} else if (val > 0 && gud.headFrames[conf.id] != -1) {
|
||||||
change = true;
|
change = true;
|
||||||
gud.headFrames[conf.id] = G.time + val * v;
|
gud.headFrames[conf.id] = G.time + val * v;
|
||||||
} else {
|
}
|
||||||
|
}
|
||||||
|
else if(conf?.cond?.[0] == "jjc_rank") {
|
||||||
change = true;
|
change = true;
|
||||||
gud.headFrames[conf.id] += val * v;
|
gud.headFrames[conf.id] = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (change) {
|
if (change) {
|
||||||
PlayerFun.changeAttr(uid, {headFrames: gud.headFrames});
|
PlayerFun.changeAttr(uid, {headFrames: gud.headFrames});
|
||||||
G.server.sendMsgByUid(uid, 'msg_s2c/PlayerChange', {headFrames: gud.headFrames});
|
G.server.sendMsgByUid(uid, 'msg_s2c/PlayerChange', {headFrames: gud.headFrames});
|
||||||
@ -344,12 +344,9 @@ export class UserFun {
|
|||||||
if (val == -1 && !gud.chatFrames[conf.id]) {
|
if (val == -1 && !gud.chatFrames[conf.id]) {
|
||||||
change = true;
|
change = true;
|
||||||
gud.chatFrames[conf.id] = -1;
|
gud.chatFrames[conf.id] = -1;
|
||||||
} else if (!gud.chatFrames[conf.id] || gud.chatFrames[conf.id] < G.time) {
|
} else if (val > 0 && gud.chatFrames[conf.id] != -1) {
|
||||||
change = true;
|
change = true;
|
||||||
gud.chatFrames[conf.id] = G.time + val * v;
|
gud.chatFrames[conf.id] = G.time + val * v;
|
||||||
} else {
|
|
||||||
change = true;
|
|
||||||
gud.chatFrames[conf.id] += val * v;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,8 +86,8 @@ export async function startAfter() {
|
|||||||
new SchedulerSlzdClean().init();
|
new SchedulerSlzdClean().init();
|
||||||
new SchedulerSlzdPrize().init();
|
new SchedulerSlzdPrize().init();
|
||||||
|
|
||||||
new SchedulerClslPrize().init();
|
// new SchedulerClslPrize().init();
|
||||||
new SchedulerClslLocalCtor().init();
|
// new SchedulerClslLocalCtor().init();
|
||||||
new SchedulerWzryAutoBaoMing().init();
|
new SchedulerWzryAutoBaoMing().init();
|
||||||
new SchedulerWzryjingcaiSendPrize().init();
|
new SchedulerWzryjingcaiSendPrize().init();
|
||||||
new SchedulerWzryendDel().init();
|
new SchedulerWzryendDel().init();
|
||||||
|
@ -152,7 +152,7 @@ export class FightControl {
|
|||||||
this.eachLiveRoles((role) => {
|
this.eachLiveRoles((role) => {
|
||||||
let heroId = role.roleData.heroId;
|
let heroId = role.roleData.heroId;
|
||||||
// let shiwu = role.roleData?.shiwu || {};
|
// 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 || [];
|
let skills = G.gc.heroskill[heroId][role.roleData.jieji || 0].bdskill || [];
|
||||||
skills = skills.concat(role.roleData.attr.skillArr);
|
skills = skills.concat(role.roleData.attr.skillArr);
|
||||||
|
|
||||||
@ -161,15 +161,15 @@ export class FightControl {
|
|||||||
// if (!zhushuan) continue;
|
// if (!zhushuan) continue;
|
||||||
// if (zhushuan.skill) skills.push(zhushuan.skill);
|
// if (zhushuan.skill) skills.push(zhushuan.skill);
|
||||||
// };
|
// };
|
||||||
// const hero_tf = G.gc.hero_tf;
|
const hero_tf = G.gc.hero_tf;
|
||||||
// for (let key in talent) {
|
for (let key in talent) {
|
||||||
// let cdata = hero_tf[key][talent[key]];
|
let cdata = hero_tf[key][talent[key]];
|
||||||
// if (cdata && cdata.skill_effect) skills.push(cdata.skill_effect);
|
if (cdata && cdata.skill_effect) skills.push(cdata.skill_effect);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// skills.push('tx06309');
|
// skills.push('tx06309');
|
||||||
|
|
||||||
//if (!skills) return;
|
if (!skills) return;
|
||||||
skills.forEach(_skill => {
|
skills.forEach(_skill => {
|
||||||
let askillconf = getSkillConf(_skill);
|
let askillconf = getSkillConf(_skill);
|
||||||
if (!askillconf) return console.log('没有技能配置-->', _skill);
|
if (!askillconf) return console.log('没有技能配置-->', _skill);
|
||||||
|
@ -322,7 +322,7 @@ export class HeroShared {
|
|||||||
static amendAttr(buff: k_v<number>) {
|
static amendAttr(buff: k_v<number>) {
|
||||||
for (let k in buff) {
|
for (let k in buff) {
|
||||||
if (typeof buff[k] != 'number') continue;
|
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]);
|
buff[k] = Math.floor(buff[k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
|
|
||||||
# "Asia/Shanghai"
|
# "Asia/Shanghai"
|
||||||
# "Asia/Tokyo"
|
# "Asia/Tokyo"
|
||||||
|
|
||||||
cp "/usr/share/zoneinfo/$1" "/etc/localtime"
|
cp "/usr/share/zoneinfo/$1" "/etc/localtime"
|
||||||
|
|
||||||
echo "$1" > /etc/timezone
|
echo "$1" > /etc/timezone
|
||||||
|
|
||||||
pm2 restart all || true
|
for i in `env | grep -E -i 'SERVER_GAME' | sed 's/=.*//'` ; do
|
||||||
|
unset $i
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user