Commit aaf6a9e6c2a046c54748e10f6dfd69383853a5e4

Authored by zhouhaihai
1 parent 8c20d812

分数默认1000

Showing 2 changed files with 6 additions and 18 deletions   Show diff stats
src/actions/PvpAction.lua
... ... @@ -91,11 +91,9 @@ function _M.infoRpc(agent, data)
91 91 red:zscore(RANK_PVP_COMMON, roleId)
92 92 red:zrevrank(RANK_PVP_COMMON, roleId)
93 93 end)
94   - local score = role:unpackPvpScore(redret[1] or 0)
  94 + local score = role:unpackPvpScore(redret[1])
95 95 local rank = tonumber(redret[2] or -2) + 1 --排名 1 - ... -1 未上榜 没打过pvp
96   - if rank == -1 then
97   - score = globalCsv.pvp_base_score
98   - end
  96 +
99 97 local pvpMC = role:getProperty("pvpMC")
100 98 if not next(pvpMC) then --没有分配过对手
101 99 role:refreshPvpMatchC(score)
... ... @@ -315,11 +313,8 @@ function _M.rankListRpc(agent, data)
315 313 red:zrevrank(RANK_PVP_COMMON, roleId)
316 314 red:zrevrange(RANK_PVP_COMMON, 0, 99, "WITHSCORES")
317 315 end)
318   - local score = role:unpackPvpScore(redret[1] or 0)
  316 + local score = role:unpackPvpScore(redret[1])
319 317 local rank = tonumber(redret[2] or -2) + 1 --排名 1 - ... -1 未上榜 没打过pvp
320   - if rank == -1 then
321   - score = globalCsv.pvp_base_score
322   - end
323 318 local rankList = {}
324 319 for i = 1, #redret[3], 2 do
325 320 local roleId = tonumber(redret[3][i])
... ...
src/models/RolePvp.lua
... ... @@ -10,7 +10,8 @@ local PVP_RANK_ROBOT_SCORE = globalCsv.pvp_base_score -- 机器人积分
10 10  
11 11  
12 12 function Role:unpackPvpScore(score)
13   - score = tonumber(score or 0)
  13 + if not score then return globalCsv.pvp_base_score end
  14 + score = tonumber(score)
14 15 return math.floor(score / PVP_RANK_TIME_SORT_PLACE)
15 16 end
16 17  
... ... @@ -70,15 +71,7 @@ end
70 71  
71 72 function Role:refreshPvpMatchC(score)
72 73 local roleId = self:getProperty("id")
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
  74 + score = score or self:unpackPvpScore(redisproxy:zscore(RANK_PVP_COMMON, roleId))
82 75  
83 76 local function getPlayers(levels)
84 77 local redret = redisproxy:pipelining(function(red)
... ...