Commit b115474f7b74ac50b67d437cb65e34bdc48715c7

Authored by zhouhaihai
1 parent 763d6396

默认积分 1000

Showing 2 changed files with 18 additions and 5 deletions   Show diff stats
src/actions/PvpAction.lua
@@ -94,6 +94,9 @@ function _M.infoRpc(agent, data) @@ -94,6 +94,9 @@ function _M.infoRpc(agent, data)
94 end) 94 end)
95 local score = role:unpackPvpScore(redret[1] or 0) 95 local score = role:unpackPvpScore(redret[1] or 0)
96 local rank = tonumber(redret[2] or -2) + 1 --排名 1 - ... -1 未上榜 没打过pvp 96 local rank = tonumber(redret[2] or -2) + 1 --排名 1 - ... -1 未上榜 没打过pvp
  97 + if rank == -1 then
  98 + score = globalCsv.pvp_base_score
  99 + end
97 local pvpMC = role:getProperty("pvpMC") 100 local pvpMC = role:getProperty("pvpMC")
98 if not next(pvpMC) then --没有分配过对手 101 if not next(pvpMC) then --没有分配过对手
99 role:refreshPvpMatchC(score) 102 role:refreshPvpMatchC(score)
@@ -101,8 +104,8 @@ function _M.infoRpc(agent, data) @@ -101,8 +104,8 @@ function _M.infoRpc(agent, data)
101 end 104 end
102 if not next(pvpMC) then return end 105 if not next(pvpMC) then return end
103 106
104 - response.score = score  
105 response.rank = rank 107 response.rank = rank
  108 + response.score = score
106 response.matches = getMatchInfo(role, pvpMC, _pvpBattleInfoCacheC) 109 response.matches = getMatchInfo(role, pvpMC, _pvpBattleInfoCacheC)
107 110
108 elseif ptype == 2 then -- 高级pvp 111 elseif ptype == 2 then -- 高级pvp
@@ -314,7 +317,9 @@ function _M.rankListRpc(agent, data) @@ -314,7 +317,9 @@ function _M.rankListRpc(agent, data)
314 end) 317 end)
315 local score = role:unpackPvpScore(redret[1] or 0) 318 local score = role:unpackPvpScore(redret[1] or 0)
316 local rank = tonumber(redret[2] or -2) + 1 --排名 1 - ... -1 未上榜 没打过pvp 319 local rank = tonumber(redret[2] or -2) + 1 --排名 1 - ... -1 未上榜 没打过pvp
317 - 320 + if rank == -1 then
  321 + score = globalCsv.pvp_base_score
  322 + end
318 local rankList = {} 323 local rankList = {}
319 for i = 1, #redret[3], 2 do 324 for i = 1, #redret[3], 2 do
320 local roleId = tonumber(redret[i]) 325 local roleId = tonumber(redret[i])
src/models/RolePvp.lua
@@ -6,7 +6,7 @@ RolePvp.bind = function (Role) @@ -6,7 +6,7 @@ RolePvp.bind = function (Role)
6 local PVP_RANK_TIME_SORT_STD = 1924876800 -- 2030-12-31 00:00:00 6 local PVP_RANK_TIME_SORT_STD = 1924876800 -- 2030-12-31 00:00:00
7 local PVP_RANK_TIME_SORT_PLACE = 1000000 -- 时间戳占据 6位数 7 local PVP_RANK_TIME_SORT_PLACE = 1000000 -- 时间戳占据 6位数
8 local PVP_RANK_TIME_SORT_PRECISION = 360 -- 时间精度 每6分钟忽略差异 8 local PVP_RANK_TIME_SORT_PRECISION = 360 -- 时间精度 每6分钟忽略差异
9 -local PVP_RANK_ROBOT_SCORE = 1000 -- 机器人积分 9 +local PVP_RANK_ROBOT_SCORE = globalCsv.pvp_base_score -- 机器人积分
10 10
11 11
12 function Role:unpackPvpScore(score) 12 function Role:unpackPvpScore(score)
@@ -70,8 +70,16 @@ end @@ -70,8 +70,16 @@ end
70 70
71 function Role:refreshPvpMatchC(score) 71 function Role:refreshPvpMatchC(score)
72 local roleId = self:getProperty("id") 72 local roleId = self:getProperty("id")
73 - local score = score or self:unpackPvpScore(redisproxy:zscore(RANK_PVP_COMMON, roleId))  
74 - 73 +
  74 + if not score then
  75 + local tempScore = redisproxy:zscore(RANK_PVP_COMMON, roleId)
  76 + if not tempScore then
  77 + score = globalCsv.pvp_base_score
  78 + else
  79 + score = self:unpackPvpScore(tempScore)
  80 + end
  81 + end
  82 +
75 local function getPlayers(levels) 83 local function getPlayers(levels)
76 local redret = redisproxy:pipelining(function(red) 84 local redret = redisproxy:pipelining(function(red)
77 for _, level in ipairs(levels) do 85 for _, level in ipairs(levels) do