Merge remote-tracking branch 'origin/bugfix' into dev

# Conflicts:
#	src/public/player.ts
#	src/shared/fightControl/fightCntrol.ts
This commit is contained in:
xichaoyin 2024-01-11 16:05:21 +08:00
commit f0df93cdd1
18 changed files with 468 additions and 187 deletions

View File

@ -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
}); });
} }

View File

@ -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
} }
// 设置任务改变数据 // 设置任务改变数据

View File

@ -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]));

View File

@ -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数据里所有英雄穿戴中的配件的 _idobjectId
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) {
// 修复数据 // 修复数据

View File

@ -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()
} }

View File

@ -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);

View 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();

View 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();

View File

@ -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[]

View File

@ -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}`)
} }
} }

View File

@ -1,25 +1,27 @@
import { ObjectId, OptionalId } from 'mongodb'; import {ObjectId, OptionalId} from 'mongodb';
import { ApiCall, BaseConnection, TsrpcError } from 'tsrpc'; import {ApiCall, BaseConnection, TsrpcError} from 'tsrpc';
import { checkPlayerGift } from '../api_s2c/event/xianshilibao/fun'; import {checkPlayerGift} from '../api_s2c/event/xianshilibao/fun';
import { md_redPoint_check } from '../api_s2c/gongyu/mingdao/ApiOpen'; import {md_redPoint_check} from '../api_s2c/gongyu/mingdao/ApiOpen';
import { CollectionPeiJian } from '../module/collection_peijian'; import {CollectionPeiJian} from '../module/collection_peijian';
import { Wjjl } from '../module/collection_wjjl'; import {Wjjl} from '../module/collection_wjjl';
import { MongodbCollections } from '../module/mongodb'; import {MongodbCollections} from '../module/mongodb';
import { G123 } from '../sdk/G123'; import {G123} from '../sdk/G123';
import { ResGetList } from '../shared/protocols/item/PtlGetList'; import {ResGetList} from '../shared/protocols/item/PtlGetList';
import { ResLogin } from '../shared/protocols/user/PtlLogin'; import {ResLogin} from '../shared/protocols/user/PtlLogin';
import { player } from '../shared/protocols/user/type'; import {player} from '../shared/protocols/user/type';
import { HeroShared, otherBuff } from '../shared/public/hero'; import {HeroShared, otherBuff} from '../shared/public/hero';
import { PublicShared } from '../shared/public/public'; import {PublicShared} from '../shared/public/public';
import { HeroFun } from './hero'; import {HeroFun} from './hero';
import { ShiwuFun } from './shiwu'; import {ShiwuFun} from './shiwu';
import { UserFun } from './user'; import {UserFun} from './user';
import { getItemByItemId, getItemNum } from './item'; import {getItemByItemId, getItemNum} from './item';
import { getGud, setGud } from './gud'; 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数量
*/ */
@ -70,13 +107,13 @@ export class PlayerFun {
if (err) { if (err) {
// 消耗不足 触发推送礼包 // 消耗不足 触发推送礼包
PushGiftFun.chkItemGift(call.uid, atn) PushGiftFun.chkItemGift(call.uid, atn)
throw new TsrpcError('', { code: -104, atn: atn }); throw new TsrpcError('', {code: -104, atn: atn});
} else { } else {
return { isOk: false, atn: atn }; return {isOk: false, atn: atn};
} }
} }
} }
return { isOk: true, atn: null }; return {isOk: true, atn: null};
} }
/** /**
@ -94,7 +131,7 @@ export class PlayerFun {
atn: need atn: need
}; };
if (args.length < 1) { if (args.length < 1) {
throw new TsrpcError('', { code: -104, atn: meet.atn }); throw new TsrpcError('', {code: -104, atn: meet.atn});
} }
return await this.checkNeedByArgs(call, ...args); return await this.checkNeedByArgs(call, ...args);
} }
@ -117,10 +154,10 @@ export class PlayerFun {
all.push(this.addItem(call, item)); all.push(this.addItem(call, item));
} }
// 记录消耗 // 记录消耗
addGameLog(call.uid, call.service.name, call.req, { need: val }) addGameLog(call.uid, call.service.name, call.req, {need: val})
await Promise.all(all); await Promise.all(all);
G.emit('USE_ITEM', call.conn.gud, needArr.map(need => { G.emit('USE_ITEM', call.conn.gud, needArr.map(need => {
return { ...need, n: Math.abs(need.n) }; return {...need, n: Math.abs(need.n)};
})); }));
} }
@ -182,9 +219,9 @@ export class PlayerFun {
} }
} }
if ((atn.t == 'rmbmoney' || atn.t == 'jinbi') && atn.n > 0) { if( (atn.t == 'rmbmoney' || atn.t == 'jinbi') && atn.n > 0 ){
//统计今日获取的金币和钻石 //统计今日获取的金币和钻石
ActionLog.addDayLog(call.conn.uid, { key: 'got_' + atn.t, val: atn.n }); ActionLog.addDayLog(call.conn.uid, { key: 'got_'+atn.t, val: atn.n });
} }
// 增加vip经验的任务监听 // 增加vip经验的任务监听
@ -192,7 +229,7 @@ export class PlayerFun {
G.emit("Class_task_157", 'Class_task_157', call, atn.n, 0); G.emit("Class_task_157", 'Class_task_157', call, atn.n, 0);
} }
all.push(this.changeAttr(call.conn.uid, change)); all.push(this.changeAttr(call.conn.uid, change));
all.push(this.upAttr(call, { ...atn, n: change[atn.t] })); all.push(this.upAttr(call, {...atn, n: change[atn.t]}));
//await this.changeAttr(call.conn.uid, change); //await this.changeAttr(call.conn.uid, change);
//await this.upAttr(call, {...atn, n: change[atn.t]}); //await this.upAttr(call, {...atn, n: change[atn.t]});
} }
@ -235,17 +272,17 @@ export class PlayerFun {
G.mongodb.collection('rmbuse').insertOne(data); G.mongodb.collection('rmbuse').insertOne(data);
// 消费竞赛开启时写入跨服数据库 // 消费竞赛开启时写入跨服数据库
if (G.huodong.xfjs && !data.isAdd && typeof data.change == 'number') { if (G.huodong.xfjs && !data.isAdd && typeof data.change == 'number') {
G.crossmongodb.collection('rmbuse').updateOne({ uid: data.uid, type: `xfjs_${G.huodong.xfjsId}` }, { G.crossmongodb.collection('rmbuse').updateOne({uid: data.uid, type: `xfjs_${G.huodong.xfjsId}`}, {
$set: { time: G.time }, $set: {time: G.time},
$inc: { change: data.change } $inc: {change: data.change}
}, { upsert: true }); }, {upsert: true});
} }
} }
static async changeAttr(uid: string, change: Partial<player>) { static async changeAttr(uid: string, change: Partial<player>) {
setGud(uid, change); setGud(uid, change);
G.mongodb.collection('user').updateOne({ uid: uid }, { $set: change }); G.mongodb.collection('user').updateOne({uid: uid}, {$set: change});
if (G.server.uid_connections[uid]) { if (G.server.uid_connections[uid]) {
checkPlayerGift(G.server.uid_connections[uid].gud, change); checkPlayerGift(G.server.uid_connections[uid].gud, change);
@ -267,9 +304,9 @@ export class PlayerFun {
const curLv = call.conn.gud.lv; const curLv = call.conn.gud.lv;
while (conf[curLv + addLv + 1] && atn.n >= conf[curLv + addLv + 1].need) { while (conf[curLv + addLv + 1] && atn.n >= conf[curLv + addLv + 1].need) {
addLv++; addLv++;
G123.sendUserLevelUp({ ...call.conn.gud, lv: curLv + addLv, nexp: atn.n }); G123.sendUserLevelUp({...call.conn.gud, lv: curLv + addLv, nexp: atn.n});
} }
addLv && await this.addAttr(call, { lv: curLv + addLv }); addLv && await this.addAttr(call, {lv: curLv + addLv});
break; break;
case 'payExp': case 'payExp':
let addVip = 0; let addVip = 0;
@ -278,7 +315,7 @@ export class PlayerFun {
while (vipConf[curVip + addVip + 1] && atn.n >= vipConf[curVip + addVip + 1].exp) { while (vipConf[curVip + addVip + 1] && atn.n >= vipConf[curVip + addVip + 1].exp) {
addVip++; addVip++;
} }
addVip && await this.addAttr(call, { vip: curVip + addVip }); addVip && await this.addAttr(call, {vip: curVip + addVip});
break; break;
} }
} }
@ -289,7 +326,7 @@ export class PlayerFun {
static async addItem(call: call, val: atn[]) { static async addItem(call: call, val: atn[]) {
for (let atn of val) { for (let atn of val) {
let upObj = { let upObj = {
filter: { uid: call.uid, itemId: atn.t }, filter: {uid: call.uid, itemId: atn.t},
update: { update: {
$setOnInsert: { $setOnInsert: {
firstTime: G.time, firstTime: G.time,
@ -321,7 +358,7 @@ export class PlayerFun {
}; };
G.mongodb.collection('item').updateOne(upObj.filter, upObj.update, upObj.options); G.mongodb.collection('item').updateOne(upObj.filter, upObj.update, upObj.options);
call.addEventMsg('msg_s2c/ItemChange', atn.t, data); call.addEventMsg('msg_s2c/ItemChange', atn.t, data);
addGameLog(call.uid, "_itemChange", { "additem": 1 }, { addGameLog(call.uid, "_itemChange", {"additem": 1}, {
"filter": upObj.filter, "filter": upObj.filter,
"update": upObj.update, "update": upObj.update,
"options": upObj.options "options": upObj.options
@ -329,10 +366,10 @@ export class PlayerFun {
} else { } else {
if (item.num + atn.n <= 0) { if (item.num + atn.n <= 0) {
await Promise.all([ await Promise.all([
G.mongodb.collection('item').deleteOne({ uid: call.uid, itemId: atn.t }) G.mongodb.collection('item').deleteOne({uid: call.uid, itemId: atn.t})
]); ]);
call.addEventMsg('msg_s2c/ItemChange', atn.t, { num: 0 }); call.addEventMsg('msg_s2c/ItemChange', atn.t, {num: 0});
addGameLog(call.uid, "_itemChange", { "delitem": 1 }, { "itemId": atn.t }) addGameLog(call.uid, "_itemChange", {"delitem": 1}, {"itemId": atn.t})
} else { } else {
await Promise.all([ await Promise.all([
G.mongodb.collection('item').updateOne(upObj.filter, upObj.update, upObj.options) G.mongodb.collection('item').updateOne(upObj.filter, upObj.update, upObj.options)
@ -341,7 +378,7 @@ export class PlayerFun {
num: item.num + atn.n, num: item.num + atn.n,
lastTime: upObj.update.$set.lastTime lastTime: upObj.update.$set.lastTime
}); });
addGameLog(call.uid, "_itemChange", { "attritem": 1 }, { addGameLog(call.uid, "_itemChange", {"attritem": 1}, {
"filter": upObj.filter, "filter": upObj.filter,
"update": upObj.update, "update": upObj.update,
"options": upObj.options, "options": upObj.options,
@ -376,7 +413,7 @@ export class PlayerFun {
insertData.forEach((v, key) => { insertData.forEach((v, key) => {
let id = result.insertedIds[key].toHexString(); let id = result.insertedIds[key].toHexString();
let { _id, ...ops } = v; let {_id, ...ops} = v;
Wjjl.setVal(call.uid, `has_equip_color_${G.gc.equip[ops.equipId].colour}`, 1, false); Wjjl.setVal(call.uid, `has_equip_color_${G.gc.equip[ops.equipId].colour}`, 1, false);
@ -410,10 +447,10 @@ export class PlayerFun {
*/ */
static async cutEquip(call: call, _idArr: string[]) { static async cutEquip(call: call, _idArr: string[]) {
for (let _id of _idArr) { for (let _id of _idArr) {
G.mongodb.collection('equip').deleteOne({ uid: call.uid, _id: new ObjectId(_id) }); G.mongodb.collection('equip').deleteOne({uid: call.uid, _id: new ObjectId(_id)});
call.addEventMsg('msg_s2c/EquipChange', _id, { num: 0 }); call.addEventMsg('msg_s2c/EquipChange', _id, {num: 0});
addGameLog(call.uid, "_cutEquip", {}, { _id: _id }) addGameLog(call.uid, "_cutEquip", {}, {_id: _id})
} }
} }
@ -447,7 +484,7 @@ export class PlayerFun {
let v = insertData[key] let v = insertData[key]
let id = result.insertedIds[key].toHexString(); let id = result.insertedIds[key].toHexString();
let { _id, ...ops } = v; let {_id, ...ops} = v;
call.addEventMsg('msg_s2c/HeroChange', id, { call.addEventMsg('msg_s2c/HeroChange', id, {
_id: id, _id: id,
@ -480,9 +517,9 @@ export class PlayerFun {
static async cutHero(call: call, _idArr: string[]) { static async cutHero(call: call, _idArr: string[]) {
for (let _id of _idArr) { for (let _id of _idArr) {
await HeroFun.delHero(call, _id); await HeroFun.delHero(call, _id);
G.mongodb.collection('hero').deleteOne({ uid: call.uid, _id: new ObjectId(_id) }); G.mongodb.collection('hero').deleteOne({uid: call.uid, _id: new ObjectId(_id)});
call.addEventMsg('msg_s2c/HeroChange', _id, { num: 0 }); call.addEventMsg('msg_s2c/HeroChange', _id, {num: 0});
addGameLog(call.uid, "_cutHero", {}, { _id: _id }) addGameLog(call.uid, "_cutHero", {}, {_id: _id})
} }
} }
@ -497,7 +534,7 @@ export class PlayerFun {
colour: v.colour, colour: v.colour,
wearId: '', wearId: '',
shiwuId: v.t, shiwuId: v.t,
jichu: ShiwuFun.randomJichu({ colour: v.colour, shiwuId: v.t }), jichu: ShiwuFun.randomJichu({colour: v.colour, shiwuId: v.t}),
fujia: [] fujia: []
}; };
if (v.shiwuBuff) { if (v.shiwuBuff) {
@ -517,7 +554,7 @@ export class PlayerFun {
insertData.forEach((v, key) => { insertData.forEach((v, key) => {
let id = result.insertedIds[key].toHexString(); let id = result.insertedIds[key].toHexString();
let { _id, ...ops } = v; let {_id, ...ops} = v;
call.addEventMsg('msg_s2c/ShiwuChange', id, { call.addEventMsg('msg_s2c/ShiwuChange', id, {
_id: id, _id: id,
...ops ...ops
@ -536,9 +573,9 @@ export class PlayerFun {
*/ */
static async cutShiwu(call: call, _idArr: string[]) { static async cutShiwu(call: call, _idArr: string[]) {
for (let _id of _idArr) { for (let _id of _idArr) {
G.mongodb.collection('shiwu').deleteOne({ uid: call.uid, _id: new ObjectId(_id) }); G.mongodb.collection('shiwu').deleteOne({uid: call.uid, _id: new ObjectId(_id)});
call.addEventMsg('msg_s2c/ShiwuChange', _id, { num: 0 }); call.addEventMsg('msg_s2c/ShiwuChange', _id, {num: 0});
addGameLog(call.uid, "_cutShiwu", {}, { _id: _id }) addGameLog(call.uid, "_cutShiwu", {}, {_id: _id})
} }
} }
@ -563,7 +600,7 @@ export class PlayerFun {
addGameLog(call.uid, "_addPeiJian", {}, insertData) addGameLog(call.uid, "_addPeiJian", {}, insertData)
insertData.forEach((v, key) => { insertData.forEach((v, key) => {
let { _id, uid, ...ops } = v; let {_id, uid, ...ops} = v;
let id = _id.toHexString(); let id = _id.toHexString();
if (G.gc.peijian[v.peijianId].colour != 5) { if (G.gc.peijian[v.peijianId].colour != 5) {
@ -571,8 +608,8 @@ export class PlayerFun {
lshd[v.peijianId]++; lshd[v.peijianId]++;
} }
G.redis.set('peijian', call.uid, id, { _id: id, ...ops }); G.redis.set('peijian', call.uid, id, {_id: id, ...ops});
call.addEventMsg('msg_s2c/PeijianChange', id, { _id: id, ...ops }); call.addEventMsg('msg_s2c/PeijianChange', id, {_id: id, ...ops});
}); });
G.mongodb.collection('playerInfo', 'lshd_peijian').updateOne( G.mongodb.collection('playerInfo', 'lshd_peijian').updateOne(
@ -623,9 +660,9 @@ export class PlayerFun {
static async cutPeijian(call: call, _idArr: string[]) { static async cutPeijian(call: call, _idArr: string[]) {
for (let _id of _idArr) { for (let _id of _idArr) {
G.redis.del('peijian', call.uid, _id); G.redis.del('peijian', call.uid, _id);
G.mongodb.collection('peijian').deleteOne({ uid: call.uid, _id: new ObjectId(_id) }); G.mongodb.collection('peijian').deleteOne({uid: call.uid, _id: new ObjectId(_id)});
call.addEventMsg('msg_s2c/PeijianChange', _id, { num: 0 }); call.addEventMsg('msg_s2c/PeijianChange', _id, {num: 0});
addGameLog(call.uid, "_cutPeijian", {}, { _id: _id }) addGameLog(call.uid, "_cutPeijian", {}, {_id: _id})
} }
} }
@ -634,7 +671,7 @@ export class PlayerFun {
*/ */
static async getAttr(uid: string, where: { ctype: string; }) { static async getAttr(uid: string, where: { ctype: string; }) {
let _w = where; let _w = where;
Object.assign(_w, { uid: uid }); Object.assign(_w, {uid: uid});
const _res = await G.mongodb.collection('playattr').find(_w).toArray(); const _res = await G.mongodb.collection('playattr').find(_w).toArray();
_res.forEach(v => { _res.forEach(v => {
if (v._id) { if (v._id) {
@ -649,7 +686,7 @@ export class PlayerFun {
*/ */
static async getAttrOne(uid: string, where: { ctype: string; }) { static async getAttrOne(uid: string, where: { ctype: string; }) {
let _w = where; let _w = where;
Object.assign(_w, { uid: uid }); Object.assign(_w, {uid: uid});
const _res = await G.mongodb.collection('playattr').findOne(_w); const _res = await G.mongodb.collection('playattr').findOne(_w);
if (_res) { if (_res) {
delete _res['_id']; delete _res['_id'];
@ -665,10 +702,10 @@ export class PlayerFun {
time = G.time; time = G.time;
} }
let _zeroTime = PublicShared.getToDayZeroTime(time); let _zeroTime = PublicShared.getToDayZeroTime(time);
let _tmp = { lasttime: { $gte: _zeroTime, $lte: _zeroTime + 24 * 60 * 60 - 1 } }; let _tmp = {lasttime: {$gte: _zeroTime, $lte: _zeroTime + 24 * 60 * 60 - 1}};
let _w = where; let _w = where;
Object.assign(_w, { uid: uid, ..._tmp }); Object.assign(_w, {uid: uid, ..._tmp});
const _res = await G.mongodb.collection('playattr').find(_w).toArray(); const _res = await G.mongodb.collection('playattr').find(_w).toArray();
_res.forEach(v => { _res.forEach(v => {
if (v._id) { if (v._id) {
@ -683,7 +720,7 @@ export class PlayerFun {
*/ */
static async setAttr(uid: string, where: { ctype: string; }, data: {}, islasttime = 1) { static async setAttr(uid: string, where: { ctype: string; }, data: {}, islasttime = 1) {
let _w = where; let _w = where;
Object.assign(_w, { uid: uid }); Object.assign(_w, {uid: uid});
if (islasttime == 1) { if (islasttime == 1) {
data["lasttime"] = G.time; data["lasttime"] = G.time;
@ -694,7 +731,7 @@ export class PlayerFun {
// 加入创建数据时间 // 加入创建数据时间
data["ctime"] = G.time; data["ctime"] = G.time;
} }
let _res = await G.mongodb.collection('playattr').updateMany(_w, { $set: data }, { upsert: true }); let _res = await G.mongodb.collection('playattr').updateMany(_w, {$set: data}, {upsert: true});
return _res; return _res;
} }
} }

View File

@ -1,7 +1,7 @@
import {PublicShared} from '../../shared/public/public'; import { PublicShared } from '../../shared/public/public';
import {EmailFun} from '../email'; import { EmailFun } from '../email';
import {RankClslCross} from '../rank/rank_clsl'; import { RankClslCross } from '../rank/rank_clsl';
import {Scheduler, schedulerType} from './scheduler'; import { Scheduler, schedulerType } from './scheduler';
/** /**
* *
@ -26,12 +26,12 @@ export class SchedulerClslLocalCtor extends Scheduler {
// 修改clslCrossUser表中的uid为del_uid_week 并且 设置ttltime为当前时间 // 修改clslCrossUser表中的uid为del_uid_week 并且 设置ttltime为当前时间
await G.mongodb.collection('clslCrossUser').updateMany( await G.mongodb.collection('clslCrossUser').updateMany(
{ {
ttltime: {$exists: false} ttltime: { $exists: false }
}, {$rename: {"uid": `del_uid_${week}`}, $set: {"ttltime": new Date()}} }, { $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) => { Object.keys(groups.groups).forEach((group) => {
// 清理排行数据 // 清理排行数据
new RankClslCross(group).clear(); new RankClslCross(group).clear();
@ -64,7 +64,7 @@ export class SchedulerClslCrossCtor extends Scheduler {
async start() { async start() {
let week = PublicShared.getToWeek(); let week = PublicShared.getToWeek();
let users = await G.mongodb.collection('clslCrossUser').find({ let users = await G.mongodb.collection('clslCrossUser').find({
ttltime: {$exists: false} ttltime: { $exists: false }
}, { }, {
projection: { projection: {
"uid": 1, "uid": 1,
@ -118,15 +118,15 @@ export class SchedulerClslCrossCtor extends Scheduler {
// 更新玩家分组id // 更新玩家分组id
for (let group in groups) { 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({ G.mongodb.collection('clslCrossUser').find({
allStar: {$gte: this.star}, ttltime: {$exists: false} allStar: { $gte: this.star }, ttltime: { $exists: false }
}).toArray().then(users => { }).toArray().then(users => {
users.forEach(u => { users.forEach(u => {
new RankClslCross(u.group).addNew({ new RankClslCross(u.group).addNew({
@ -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 {

View File

@ -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;

View File

@ -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;
} }
} }
} }

View File

@ -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();

View File

@ -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);

View File

@ -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]);
} }
} }

View File

@ -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