From b115474f7b74ac50b67d437cb65e34bdc48715c7 Mon Sep 17 00:00:00 2001 From: zhouhaihai Date: Fri, 29 Nov 2019 17:56:41 +0800 Subject: [PATCH] 默认积分 1000 --- src/actions/PvpAction.lua | 9 +++++++-- src/models/RolePvp.lua | 14 +++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/actions/PvpAction.lua b/src/actions/PvpAction.lua index 0b91f40..94f8840 100644 --- a/src/actions/PvpAction.lua +++ b/src/actions/PvpAction.lua @@ -94,6 +94,9 @@ function _M.infoRpc(agent, data) end) local score = role:unpackPvpScore(redret[1] or 0) local rank = tonumber(redret[2] or -2) + 1 --排名 1 - ... -1 未上榜 没打过pvp + if rank == -1 then + score = globalCsv.pvp_base_score + end local pvpMC = role:getProperty("pvpMC") if not next(pvpMC) then --没有分配过对手 role:refreshPvpMatchC(score) @@ -101,8 +104,8 @@ function _M.infoRpc(agent, data) end if not next(pvpMC) then return end - response.score = score response.rank = rank + response.score = score response.matches = getMatchInfo(role, pvpMC, _pvpBattleInfoCacheC) elseif ptype == 2 then -- 高级pvp @@ -314,7 +317,9 @@ function _M.rankListRpc(agent, data) end) local score = role:unpackPvpScore(redret[1] or 0) local rank = tonumber(redret[2] or -2) + 1 --排名 1 - ... -1 未上榜 没打过pvp - + if rank == -1 then + score = globalCsv.pvp_base_score + end local rankList = {} for i = 1, #redret[3], 2 do local roleId = tonumber(redret[i]) diff --git a/src/models/RolePvp.lua b/src/models/RolePvp.lua index 6f48377..caf9dc9 100644 --- a/src/models/RolePvp.lua +++ b/src/models/RolePvp.lua @@ -6,7 +6,7 @@ RolePvp.bind = function (Role) local PVP_RANK_TIME_SORT_STD = 1924876800 -- 2030-12-31 00:00:00 local PVP_RANK_TIME_SORT_PLACE = 1000000 -- 时间戳占据 6位数 local PVP_RANK_TIME_SORT_PRECISION = 360 -- 时间精度 每6分钟忽略差异 -local PVP_RANK_ROBOT_SCORE = 1000 -- 机器人积分 +local PVP_RANK_ROBOT_SCORE = globalCsv.pvp_base_score -- 机器人积分 function Role:unpackPvpScore(score) @@ -70,8 +70,16 @@ end function Role:refreshPvpMatchC(score) local roleId = self:getProperty("id") - local score = score or self:unpackPvpScore(redisproxy:zscore(RANK_PVP_COMMON, roleId)) - + + if not score then + local tempScore = redisproxy:zscore(RANK_PVP_COMMON, roleId) + if not tempScore then + score = globalCsv.pvp_base_score + else + score = self:unpackPvpScore(tempScore) + end + end + local function getPlayers(levels) local redret = redisproxy:pipelining(function(red) for _, level in ipairs(levels) do -- libgit2 0.21.2