diff --git a/Fk/Cheat/PlayerDetail.qml b/Fk/Cheat/PlayerDetail.qml index bd44565b..d54ccbc1 100644 --- a/Fk/Cheat/PlayerDetail.qml +++ b/Fk/Cheat/PlayerDetail.qml @@ -112,18 +112,27 @@ Flickable { screenName.text = extra_data.photo.screenName; - const gamedata = JSON.parse(Backend.callLuaFunction("GetPlayerGameData", [id])); - const total = gamedata[0]; - const win = gamedata[1]; - const run = gamedata[2]; - const winRate = (win / total) * 100; - const runRate = (run / total) * 100; - playerGameData.text = Backend.translate("Win=%1 Run=%2 Total=%3").arg(winRate.toFixed(2)) - .arg(runRate.toFixed(2)).arg(total); + if (!config.observing) { + const gamedata = JSON.parse(Backend.callLuaFunction("GetPlayerGameData", [id])); + const total = gamedata[0]; + const win = gamedata[1]; + const run = gamedata[2]; + const winRate = (win / total) * 100; + const runRate = (run / total) * 100; + playerGameData.text = Backend.translate("Win=%1 Run=%2 Total=%3").arg(winRate.toFixed(2)) + .arg(runRate.toFixed(2)).arg(total); + } const data = JSON.parse(Backend.callLuaFunction("GetPlayerSkills", [id])); data.forEach(t => { skillDesc.append("" + Backend.translate(t.name) + ": " + t.description) }); + + const equips = JSON.parse(Backend.callLuaFunction("GetPlayerEquips", [id])); + equips.forEach(cid => { + const t = JSON.parse(Backend.callLuaFunction("GetCardData", [cid])); + skillDesc.append("--------------------"); + skillDesc.append("" + Backend.translate(t.name) + ": " + Backend.translate(":" + t.name)); + }); } } diff --git a/lua/client/client_util.lua b/lua/client/client_util.lua index d1fe0383..99023634 100644 --- a/lua/client/client_util.lua +++ b/lua/client/client_util.lua @@ -216,25 +216,12 @@ end function GetPlayerSkills(id) local p = ClientInstance:getPlayerById(id) - local equip = {} - local ret = {} - table.forEach(p.player_skills, function(s) - if s:isEquipmentSkill() then - table.insert(equip, s.attached_equip) - elseif s.visible then - table.insert(ret, { - name = s.name, - description = Fk:getDescription(s.name), - }) - end - end) - table.insertTable(ret, table.map(equip, function(e) - return { - name = e, - description = Fk:getDescription(e), - } + return json.encode(table.map(p.player_skills, function(s) + return s.visible and { + name = s.name, + description = Fk:getDescription(s.name), + } or nil end)) - return json.encode(ret) end ---@param card string | integer @@ -572,6 +559,12 @@ function GetPlayerHandcards(pid) return json.encode(p.player_cards[Player.Hand]) end +function GetPlayerEquips(pid) + local c = ClientInstance + local p = c:getPlayerById(pid) + return json.encode(p.player_cards[Player.Equip]) +end + function ResetClientLua() local data = ClientInstance.room_settings Self = ClientPlayer:new(fk.Self) diff --git a/lua/server/room.lua b/lua/server/room.lua index fc1ae13b..4c94e8d3 100644 --- a/lua/server/room.lua +++ b/lua/server/room.lua @@ -710,10 +710,8 @@ function Room:doRaceRequest(command, players, jsonData) if p.reply_cancel then table.removeOne(players, p) table.insertIfNeed(canceled_players, p) - end - - -- 骗过调度器让他以为自己尚未就绪 - if p.id > 0 then + elseif p.id > 0 then + -- 骗过调度器让他以为自己尚未就绪 p.request_timeout = remainTime - elapsed p.serverplayer:setThinking(true) end diff --git a/lua/server/scheduler.lua b/lua/server/scheduler.lua index 57a97694..b8014ff6 100644 --- a/lua/server/scheduler.lua +++ b/lua/server/scheduler.lua @@ -121,6 +121,8 @@ local function mainLoop() -- verbose('[.] Sleeping for %d ms...', time) local cur = os.getms() + time = math.min((time <= 0 and 9999999 or time), 200) + -- 调用RoomThread的trySleep函数开始真正的睡眠。会被wakeUp(c++)唤醒。 requestRoom.thread:trySleep(time)