Commit f317b790c35df27a23d10e30d6115ddd3508c6ef
1 parent
b115474f
pvp 遗留
Showing
2 changed files
with
9 additions
and
8 deletions
Show diff stats
src/actions/PvpAction.lua
... | ... | @@ -13,9 +13,8 @@ local _pvpStartBattleCache = nil -- |
13 | 13 | |
14 | 14 | local _pvpRecordInfoCache = {} -- 记录缓存 |
15 | 15 | local _pvpRecordBattleInfoCache = {} -- 记录战斗数据缓存 |
16 | -local _responseRecord = {} -- 复仇对单人1分钟间隔 | |
17 | - | |
18 | -local ResponseWaitTime = 60 | |
16 | +local _revengeRecord = {} -- 复仇对单人1分钟间隔 | |
17 | +local RevengeWaitTime = 60 | |
19 | 18 | |
20 | 19 | function _M.formatCommonRpc(agent , data) |
21 | 20 | local role = agent.role |
... | ... | @@ -164,7 +163,7 @@ function _M.startBattleRpc(agent, data) |
164 | 163 | local temp = _pvpRecordInfoCache[idx] |
165 | 164 | if not temp then return 2 end |
166 | 165 | |
167 | - if not _responseRecord[temp.id] or now >= _responseRecord[temp.id] then | |
166 | + if not _revengeRecord[temp.id] or now >= _revengeRecord[temp.id] then | |
168 | 167 | if temp.t == 1 then |
169 | 168 | matchInfo = _pvpRecordBattleInfoCache[temp.id] |
170 | 169 | elseif temp.t == 2 then |
... | ... | @@ -172,7 +171,7 @@ function _M.startBattleRpc(agent, data) |
172 | 171 | end |
173 | 172 | else |
174 | 173 | result = 1 |
175 | - wait = _responseRecord[temp.id] - now | |
174 | + wait = _revengeRecord[temp.id] - now | |
176 | 175 | end |
177 | 176 | else --打正常 |
178 | 177 | local pvpMC = role:getProperty("pvpMC") |
... | ... | @@ -227,7 +226,7 @@ function _M.endBattleRpc(agent, data) |
227 | 226 | local match |
228 | 227 | if revenge then |
229 | 228 | match = _pvpRecordInfoCache[msg.idx] |
230 | - _responseRecord[match.id] = now + ResponseWaitTime -- 1分钟内不能再打 | |
229 | + _revengeRecord[match.id] = now + RevengeWaitTime -- 1分钟内不能再打 | |
231 | 230 | else |
232 | 231 | local pvpMC = role:getProperty("pvpMC") |
233 | 232 | match = pvpMC[msg.idx] |
... | ... | @@ -306,6 +305,7 @@ end |
306 | 305 | function _M.rankListRpc(agent, data) |
307 | 306 | local role = agent.role |
308 | 307 | local roleId = role:getProperty("id") |
308 | + local msg = MsgPack.unpack(data) | |
309 | 309 | local ptype = msg.ptype or 1 |
310 | 310 | |
311 | 311 | local response = {} |
... | ... | @@ -322,8 +322,8 @@ function _M.rankListRpc(agent, data) |
322 | 322 | end |
323 | 323 | local rankList = {} |
324 | 324 | for i = 1, #redret[3], 2 do |
325 | - local roleId = tonumber(redret[i]) | |
326 | - local score = role:unpackPvpScore(redret[i + 1]) | |
325 | + local roleId = tonumber(redret[3][i]) | |
326 | + local score = role:unpackPvpScore(redret[3][i + 1]) | |
327 | 327 | local online, curInfo = rpcRole(roleId, "friendSInfo") |
328 | 328 | curInfo.score = score |
329 | 329 | curInfo.roleId = roleId | ... | ... |
src/models/RolePlugin.lua
... | ... | @@ -620,6 +620,7 @@ function RolePlugin.bind(Role) |
620 | 620 | end |
621 | 621 | |
622 | 622 | function Role:getRealBattleValue(heros, activeRelation) -- 获取队伍战斗力 羁绊加成 |
623 | + heros = heros or {} | |
623 | 624 | local activeRelation = activeRelation or self:getHeroActiveRelation(heros) |
624 | 625 | local battleValue = 0 |
625 | 626 | for _, id in pairs(heros) do | ... | ... |