Commit 85083dba9b046b99c5406e9172ded2ca8ee2d621
1 parent
4cf74232
拉黑从申请列表移除
Showing
2 changed files
with
37 additions
and
22 deletions
Show diff stats
src/actions/FriendAction.lua
... | ... | @@ -428,6 +428,8 @@ function _M.blockRpc(agent, data) |
428 | 428 | redisproxy:pipelining(function (red) |
429 | 429 | red:hdel(FRIEND_KEY:format(roleId), objectId) |
430 | 430 | red:hdel(FRIEND_KEY:format(objectId), roleId) |
431 | + red:ZREM(FRIEND_APPLY_KEY:format(roleId), objectId) | |
432 | + red:ZREM(FRIEND_APPLY_KEY:format(objectId), roleId) | |
431 | 433 | red:sadd(FRIEND_BLACK_KEY:format(roleId), objectId) |
432 | 434 | end) |
433 | 435 | rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({deleteFriend = 1, roleId = roleId})) | ... | ... |
src/actions/PvpAction.lua
... | ... | @@ -13,6 +13,9 @@ local _pvpStartBattleCache = nil -- |
13 | 13 | |
14 | 14 | local _pvpRecordInfoCache = {} -- 记录缓存 |
15 | 15 | local _pvpRecordBattleInfoCache = {} -- 记录战斗数据缓存 |
16 | +local _responseRecord = {} -- 复仇对单人1分钟间隔 | |
17 | + | |
18 | +local ResponseWaitTime = 60 | |
16 | 19 | |
17 | 20 | function _M.formatCommonRpc(agent , data) |
18 | 21 | local role = agent.role |
... | ... | @@ -148,14 +151,21 @@ function _M.startBattleRpc(agent, data) |
148 | 151 | local idx = msg.idx |
149 | 152 | local revenge = msg.revenge |
150 | 153 | |
151 | - local matchInfo | |
152 | - | |
154 | + local matchInfo, result, key, wait | |
155 | + local now = skynet.timex() | |
153 | 156 | if revenge then --复仇 |
154 | - if not _pvpRecordInfoCache[idx] then return end | |
155 | - if _pvpRecordInfoCache[idx].t == 1 then | |
156 | - matchInfo = _pvpRecordBattleInfoCache[_pvpRecordInfoCache[idx].id] | |
157 | - elseif _pvpRecordInfoCache[idx].t == 2 then | |
158 | - matchInfo = {robot = _pvpRecordInfoCache[idx].id} | |
157 | + local temp = _pvpRecordInfoCache[idx] | |
158 | + if not temp then return end | |
159 | + | |
160 | + if not _responseRecord[temp.id] or now >= _responseRecord[temp.id] then | |
161 | + if temp.t == 1 then | |
162 | + matchInfo = _pvpRecordBattleInfoCache[temp.id] | |
163 | + elseif temp.t == 2 then | |
164 | + matchInfo = {robot = temp.id} | |
165 | + end | |
166 | + else | |
167 | + result = 1 | |
168 | + wait = _responseRecord[temp.id] - now | |
159 | 169 | end |
160 | 170 | else --打正常 |
161 | 171 | local pvpMC = role:getProperty("pvpMC") |
... | ... | @@ -167,22 +177,24 @@ function _M.startBattleRpc(agent, data) |
167 | 177 | end |
168 | 178 | end |
169 | 179 | |
170 | - if not matchInfo then return end | |
180 | + if not result and not matchInfo then return end | |
181 | + | |
182 | + if not result then | |
183 | + -- 次数扣一波 | |
184 | + local pvpFree = role.dailyData:getProperty("pvpFree") | |
185 | + if pvpFree >= globalCsv.pvp_battle_free_count then | |
186 | + local cost = {[ItemId.PvpKey] = 1} | |
187 | + if not role:checkItemEnough(cost) then return end | |
188 | + role:costItems(cost) | |
189 | + else | |
190 | + role.dailyData:updateProperty({field = "pvpFree", delta = 1}) | |
191 | + end | |
171 | 192 | |
172 | - -- 次数扣一波 | |
173 | - local pvpFree = role.dailyData:getProperty("pvpFree") | |
174 | - if pvpFree >= globalCsv.pvp_battle_free_count then | |
175 | - local cost = {[ItemId.PvpKey] = 1} | |
176 | - if not role:checkItemEnough(cost) then return end | |
177 | - role:costItems(cost) | |
178 | - else | |
179 | - role.dailyData:updateProperty({field = "pvpFree", delta = 1}) | |
193 | + key = tostring(math.random()) | |
194 | + _pvpStartBattleCache = {idx = idx, key = key, revenge = revenge} | |
180 | 195 | end |
181 | 196 | |
182 | - local key = tostring(math.random()) | |
183 | - _pvpStartBattleCache = {idx = idx, key = key, revenge = revenge} | |
184 | - | |
185 | - SendPacket(actionCodes.Pvp_startBattleRpc, MsgPack.pack({matchInfo = matchInfo, key = key})) | |
197 | + SendPacket(actionCodes.Pvp_startBattleRpc, MsgPack.pack({matchInfo = matchInfo, key = key, result = result, wait = wait})) | |
186 | 198 | return true |
187 | 199 | end |
188 | 200 | |
... | ... | @@ -199,11 +211,13 @@ function _M.endBattleRpc(agent, data) |
199 | 211 | end |
200 | 212 | |
201 | 213 | local isWin = msg.starNum and msg.starNum > 0 |
214 | + local now = skynet.timex() | |
202 | 215 | |
203 | 216 | local revenge = _pvpStartBattleCache.revenge |
204 | 217 | local match |
205 | 218 | if revenge then |
206 | 219 | match = _pvpRecordInfoCache[msg.idx] |
220 | + _responseRecord[match.id] = now + ResponseWaitTime -- 1分钟内不能再打 | |
207 | 221 | else |
208 | 222 | local pvpMC = role:getProperty("pvpMC") |
209 | 223 | match = pvpMC[msg.idx] |
... | ... | @@ -221,7 +235,6 @@ function _M.endBattleRpc(agent, data) |
221 | 235 | _pvpStartBattleCache = nil |
222 | 236 | |
223 | 237 | -- 请求上传录像 |
224 | - local now = skynet.timex() | |
225 | 238 | local params = { |
226 | 239 | ["roleid"] = roleId, |
227 | 240 | ["key"] = "zhaolugame20191016", |
... | ... | @@ -326,7 +339,7 @@ function _M.recordListRpc(agent, data) |
326 | 339 | local tempList = {} |
327 | 340 | for _, temp in ipairs(rlist) do |
328 | 341 | local one = MsgPack.unpack(temp) |
329 | - if now - one.time <= 24 * 3600 then -- 大于一天的弃之 | |
342 | + if now - one.time <= globalCsv.pvp_record_keep_time then -- 大于一天的弃之 | |
330 | 343 | table.insert(tempList, one) |
331 | 344 | end |
332 | 345 | end | ... | ... |