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