Commit 42327de833d1b029f6090e3a8e110312ab254b50

Authored by zhouhaihai
1 parent 85a09163

高级竞技场红点

src/actions/PvpAction.lua
... ... @@ -824,18 +824,8 @@ function _M.highDivisionGiftRpc(agent, data)
824 824  
825 825 local pvpHGTime = role:getProperty("pvpHGTime")
826 826 if pvpHGTime == 0 then return end
827   - local score = role:unpackPvpScore(redisproxy:zscore(role:getPvpDBKey(RANK_PVP_HIGHT), roleId))
828 827  
829   - local divisionId = nil
830   - for _id, division in ipairs(csvdb["pvp_group_divisionCsv"]) do
831   - if score >= division.division then
832   - divisionId = _id
833   - else
834   - break
835   - end
836   - end
837   -
838   - local newTime, newReward = role:calculatePvpHGift(divisionId)
  828 + local newTime, newReward = role:calculatePvpHGift(role:getPvpHDivision())
839 829 if not next(newReward) then return end
840 830  
841 831 role:updateProperties({
... ...
src/models/RolePlugin.lua
... ... @@ -1291,6 +1291,7 @@ function RolePlugin.bind(Role)
1291 1291 end
1292 1292 local breathes = {
1293 1293 ["email"] = breath(120), -- email
  1294 + ["pvphg"] = breath(300), -- 高级竞技场 奖励满的红点
1294 1295 }
1295 1296 function Role:checkNewEvent(now)
1296 1297 if now - self:getProperty("ltime") < 5 then
... ... @@ -1337,6 +1338,21 @@ function RolePlugin.bind(Role)
1337 1338 end
1338 1339 end
1339 1340 end
  1341 +
  1342 + checks["pvphg"] = function()
  1343 + if not self:isTimeResetOpen(TimeReset.PvpHight) then return end
  1344 +
  1345 + local pvpHGTime = self:getProperty("pvpHGTime")
  1346 + if pvpHGTime == 0 then return end
  1347 + local division = self:getPvpHDivision()
  1348 + local divisionData = csvdb["pvp_group_divisionCsv"][division]
  1349 +
  1350 + local newTime, newReward = self:calculatePvpHGift(division)
  1351 + if table.pack(next(newReward))[2] >= divisionData.limit then
  1352 + return true
  1353 + end
  1354 +
  1355 + end
1340 1356  
1341 1357 local events = {}
1342 1358 for name, breath in pairs(breathes) do
... ...
src/models/RolePvp.lua
... ... @@ -82,6 +82,19 @@ function Role:changePvpScoreCommon(matchId, isWin)
82 82 return table.unpack(result)
83 83 end
84 84  
  85 +function Role:getPvpHDivision(score)
  86 + local score = score or self:unpackPvpScore(redisproxy:zscore(self:getPvpDBKey(RANK_PVP_HIGHT), self:getProperty("id")))
  87 + local divisionId = nil
  88 + for _id, division in ipairs(csvdb["pvp_group_divisionCsv"]) do
  89 + if score >= division.division then
  90 + divisionId = _id
  91 + else
  92 + break
  93 + end
  94 + end
  95 + return divisionId
  96 +end
  97 +
85 98 function Role:calculatePvpHGift(division)
86 99 local now = skynet.timex()
87 100 local oldTime = self:getProperty("pvpHGTime")
... ...