From 12f768d8870e7e640f20c4a4631d35c1c222c6c5 Mon Sep 17 00:00:00 2001 From: xichaoyin Date: Fri, 12 Jan 2024 18:18:08 +0800 Subject: [PATCH] =?UTF-8?q?json:=E9=85=8D=E7=BD=AE=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/oss/watchdog.json | 2 +- src/public/player.ts | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/oss/watchdog.json b/src/oss/watchdog.json index 1cd80d8..1e97ac3 100644 --- a/src/oss/watchdog.json +++ b/src/oss/watchdog.json @@ -30,7 +30,7 @@ "tips":"单日获取黄旗兑换达到10000" }, { - "key": "event/huangqijiuguan/ZhaoMu", + "key": "huangqijiuguan/ZhaoMu", "limit": 1000, "tips": "单日获取黄旗招募超过1000抽" }, diff --git a/src/public/player.ts b/src/public/player.ts index 61aeea6..46d0b34 100644 --- a/src/public/player.ts +++ b/src/public/player.ts @@ -20,6 +20,9 @@ import { addGameLog } from "../gameLog"; import { PushGiftFun } from "./pushgift"; import { ActionLog } from './actionLog/actionLog'; import HeroSkinFun from './heroskin'; +import { roleDataType } from '../shared/fightControl/fightType'; +import { PlayerShared } from '../shared/public/player'; + export type call = { get otherBuff(): otherBuff; @@ -41,6 +44,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数量 */ @@ -195,6 +233,11 @@ export class PlayerFun { ActionLog.addDayLog(call.conn.uid, { key: 'got_' + atn.t, val: atn.n }); } + if (["huangqijinbi", "huangqiduihuan"].includes(atn.t) && atn.n > 0) { + //统计今日获取的黄旗金币和黄旗对换币 + ActionLog.addDayLog(call.conn.uid, { key: 'got_' + atn.t, val: atn.n }); + } + // 增加vip经验的任务监听 if (atn.t == "payExp" && atn.n > 0) { G.emit("Class_task_157", 'Class_task_157', call, atn.n, 0);