Commit 2be863e2e1d061fe619c40f41509db1c925c00a8
Merge branch 'tr/bugfix-qa' into tr/develop
* tr/bugfix-qa: relay 修改中继营地解锁条件 防作弊 活动战斗结束不发送战斗奖励 活动免费礼包判断活动是否开启 计算英雄战斗力,天赋,信赖 错误的 多队挂机 电台任务英雄也不能重用
Showing
14 changed files
with
320 additions
and
64 deletions
Show diff stats
src/actions/ActivityAction.lua
| @@ -514,6 +514,7 @@ function _M.startBattleRpc(agent, data) | @@ -514,6 +514,7 @@ function _M.startBattleRpc(agent, data) | ||
| 514 | key = tostring(math.random()), | 514 | key = tostring(math.random()), |
| 515 | actid = actid, | 515 | actid = actid, |
| 516 | id = id, | 516 | id = id, |
| 517 | + format = msg.format, | ||
| 517 | } | 518 | } |
| 518 | SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack({key = role.__actBattleCache.key})) | 519 | SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack({key = role.__actBattleCache.key})) |
| 519 | else | 520 | else |
| @@ -571,7 +572,10 @@ function _M.endBattleRpc(agent, data) | @@ -571,7 +572,10 @@ function _M.endBattleRpc(agent, data) | ||
| 571 | local isWin = msg.isWin | 572 | local isWin = msg.isWin |
| 572 | local heros = msg.heros | 573 | local heros = msg.heros |
| 573 | local support = msg.support | 574 | local support = msg.support |
| 574 | - if not role.activity:isOpenById(actid, "ChallengeLevel") then return 1 end | 575 | + if not role.activity:isOpenById(actid, "ChallengeLevel") then |
| 576 | + SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({})) | ||
| 577 | + return true | ||
| 578 | + end | ||
| 575 | 579 | ||
| 576 | if not role.__actBattleCache then return 2 end | 580 | if not role.__actBattleCache then return 2 end |
| 577 | 581 | ||
| @@ -579,6 +583,18 @@ function _M.endBattleRpc(agent, data) | @@ -579,6 +583,18 @@ function _M.endBattleRpc(agent, data) | ||
| 579 | SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({errorCode = 1})) | 583 | SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({errorCode = 1})) |
| 580 | end | 584 | end |
| 581 | 585 | ||
| 586 | + -- 防作弊 | ||
| 587 | + if not role:checkBattleCheat("act_battle", { | ||
| 588 | + id = id, | ||
| 589 | + isWin = isWin, | ||
| 590 | + info = msg.info, | ||
| 591 | + format = role.__actBattleCache.format | ||
| 592 | + }) then | ||
| 593 | + SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({errorCode = 1})) | ||
| 594 | + return true | ||
| 595 | + end | ||
| 596 | + role.__actBattleCache = nil | ||
| 597 | + | ||
| 582 | local actCfg = csvdb["activity_battleCsv"][actid] | 598 | local actCfg = csvdb["activity_battleCsv"][actid] |
| 583 | if not actCfg then return 3 end | 599 | if not actCfg then return 3 end |
| 584 | 600 |
src/actions/AdvAction.lua
| @@ -57,6 +57,15 @@ local function checkFormat(role, format, checkAdvTeam) | @@ -57,6 +57,15 @@ local function checkFormat(role, format, checkAdvTeam) | ||
| 57 | end | 57 | end |
| 58 | end | 58 | end |
| 59 | 59 | ||
| 60 | + -- 多队挂机 电台任务英雄也不能重用 | ||
| 61 | + local radioTask = role:getProperty("radioTask") | ||
| 62 | + for id, taskInfo in pairs(radioTask) do | ||
| 63 | + local heros = taskInfo["heros"] or {} | ||
| 64 | + for _, heroId in ipairs(heros) do | ||
| 65 | + hadHero[heroId] = true | ||
| 66 | + end | ||
| 67 | + end | ||
| 68 | + | ||
| 60 | if not format.leader then return end | 69 | if not format.leader then return end |
| 61 | if format.leader2 == format.leader then return end | 70 | if format.leader2 == format.leader then return end |
| 62 | local hadLeader = false | 71 | local hadLeader = false |
| @@ -125,10 +134,11 @@ function _M.startAdvRpc( agent, data ) | @@ -125,10 +134,11 @@ function _M.startAdvRpc( agent, data ) | ||
| 125 | else -- 普通模式判断 | 134 | else -- 普通模式判断 |
| 126 | if layer >= chapterData.limitlevel then return 4 end | 135 | if layer >= chapterData.limitlevel then return 4 end |
| 127 | 136 | ||
| 128 | - local relayData = role:getAdvData():isHaveRelay(layer, chapterId) | 137 | + local relayData = role:getAdvData():isHaveRelay(layer, chapterId, true) |
| 129 | if not relayData then return 6 end -- 不是中继层 | 138 | if not relayData then return 6 end -- 不是中继层 |
| 130 | if layer ~= 1 then | 139 | if layer ~= 1 then |
| 131 | - if (advPass[chapterId] or 0) < relayData.floor then return 21 end | 140 | + local advRelay = role:getProperty("advRelay") |
| 141 | + if not (advRelay[chapterId] or {})[layer] then return 21 end -- 没有开放 | ||
| 132 | end | 142 | end |
| 133 | if not role:checkAdvCount(relayData.supply) then return 2 end -- 是否有体力 | 143 | if not role:checkAdvCount(relayData.supply) then return 2 end -- 是否有体力 |
| 134 | -- 关卡开放判断 | 144 | -- 关卡开放判断 |
| @@ -182,7 +192,7 @@ function _M.startHangRpc(agent, data) | @@ -182,7 +192,7 @@ function _M.startHangRpc(agent, data) | ||
| 182 | local format = msg.format --编队 | 192 | local format = msg.format --编队 |
| 183 | local index = msg.index or 1--时间索引id | 193 | local index = msg.index or 1--时间索引id |
| 184 | 194 | ||
| 185 | - local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] | 195 | + local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] |
| 186 | if not chapterData then return 1 end | 196 | if not chapterData then return 1 end |
| 187 | local campSiteData = chapterData[campId] | 197 | local campSiteData = chapterData[campId] |
| 188 | if not campSiteData then return 1 end | 198 | if not campSiteData then return 1 end |
| @@ -204,7 +214,7 @@ function _M.startHangRpc(agent, data) | @@ -204,7 +214,7 @@ function _M.startHangRpc(agent, data) | ||
| 204 | if AdvCommon.isEndless(chapterId) then return 5 end -- 无尽没有代理 | 214 | if AdvCommon.isEndless(chapterId) then return 5 end -- 无尽没有代理 |
| 205 | 215 | ||
| 206 | local advRelay = role:getProperty("advRelay") | 216 | local advRelay = role:getProperty("advRelay") |
| 207 | - if not next(advRelay[chapterId] or {}) then return 6 end -- 没有开放 | 217 | + if not (advRelay[chapterId] or {})[campSiteData.floor] then return 6 end -- 没有开放 |
| 208 | 218 | ||
| 209 | 219 | ||
| 210 | if not role:checkAdvCount(adv_idle_energy) then return 7 end -- 是否有体力 | 220 | if not role:checkAdvCount(adv_idle_energy) then return 7 end -- 是否有体力 |
| @@ -226,7 +236,8 @@ function _M.startHangRpc(agent, data) | @@ -226,7 +236,8 @@ function _M.startHangRpc(agent, data) | ||
| 226 | + 0.226 * player["hit"] | 236 | + 0.226 * player["hit"] |
| 227 | + 0.26 * player["miss"] | 237 | + 0.26 * player["miss"] |
| 228 | 238 | ||
| 229 | - if battleV < campSiteData.idleValue then return 9 end -- 战斗力是否满足 | 239 | + --print(math.ceil(battleV), campSiteData.idleValue) |
| 240 | + if math.ceil(battleV) < campSiteData.idleValue then return 9 end -- 战斗力是否满足 | ||
| 230 | 241 | ||
| 231 | local info = {} | 242 | local info = {} |
| 232 | info.format = {} | 243 | info.format = {} |
src/actions/GmAction.lua
| @@ -36,26 +36,15 @@ function _M.ban(role, pms) | @@ -36,26 +36,15 @@ function _M.ban(role, pms) | ||
| 36 | local time = tonum(pms.pm1, 1) | 36 | local time = tonum(pms.pm1, 1) |
| 37 | local ctype = tonum(pms.pm2, 0) | 37 | local ctype = tonum(pms.pm2, 0) |
| 38 | 38 | ||
| 39 | - local isBan = role:getProperty("banTime") <= now | ||
| 40 | role:setBan(time, ctype) | 39 | role:setBan(time, ctype) |
| 41 | - if time > 0 then | ||
| 42 | - role:sendGmMsg("server_accountBanned_1") | ||
| 43 | - local agent = datacenter.get("agent", role:getProperty("id")) | ||
| 44 | - if agent then | ||
| 45 | - skynet.timeout(50, function () | ||
| 46 | - skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd) | ||
| 47 | - end) | ||
| 48 | - end | ||
| 49 | - end | ||
| 50 | - | ||
| 51 | role:mylog("gm_action", {desc = "ban", int1 = time, int2 = ctype, key1 = pms.sender}) | 40 | role:mylog("gm_action", {desc = "ban", int1 = time, int2 = ctype, key1 = pms.sender}) |
| 52 | - | ||
| 53 | - return isBan and "解封杀成功" or "封杀成功" | 41 | + return "封杀成功" |
| 54 | end | 42 | end |
| 55 | 43 | ||
| 44 | + | ||
| 56 | function _M.unban(role, pms) | 45 | function _M.unban(role, pms) |
| 57 | role:setBan(0, 0) | 46 | role:setBan(0, 0) |
| 58 | - | 47 | + role:setProperty("cheatCount", 0) -- 清除作弊次数 |
| 59 | role:mylog("gm_action", {desc = "unban", key1 = pms.sender}) | 48 | role:mylog("gm_action", {desc = "unban", key1 = pms.sender}) |
| 60 | 49 | ||
| 61 | return "解封杀成功" | 50 | return "解封杀成功" |
| @@ -63,18 +52,17 @@ end | @@ -63,18 +52,17 @@ end | ||
| 63 | 52 | ||
| 64 | function _M.gmmsg(role, pms) | 53 | function _M.gmmsg(role, pms) |
| 65 | role:sendGmMsg(pms.pm1, true) | 54 | role:sendGmMsg(pms.pm1, true) |
| 66 | - | ||
| 67 | - local agent = datacenter.get("agent", role:getProperty("id")) | ||
| 68 | - if agent then | ||
| 69 | - skynet.timeout(50, function () | ||
| 70 | - skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd) | ||
| 71 | - end) | ||
| 72 | - end | ||
| 73 | role:mylog("gm_action", {desc = "gmmsg", text1 = pms.pm1, key1 = pms.sender}) | 55 | role:mylog("gm_action", {desc = "gmmsg", text1 = pms.pm1, key1 = pms.sender}) |
| 74 | - | ||
| 75 | return "指令成功" | 56 | return "指令成功" |
| 76 | end | 57 | end |
| 77 | 58 | ||
| 59 | + | ||
| 60 | +function _M.reset_rank(role, pms) | ||
| 61 | + role:resetRank() | ||
| 62 | + role:mylog("gm_action", {desc = "reset_rank", key1 = pms.sender}) | ||
| 63 | + return "封杀成功" | ||
| 64 | +end | ||
| 65 | + | ||
| 78 | function _M.silent(role, pms) | 66 | function _M.silent(role, pms) |
| 79 | local pm1 = tonum(pms.pm1) | 67 | local pm1 = tonum(pms.pm1) |
| 80 | if pm1 < 1 then | 68 | if pm1 < 1 then |
src/actions/HangAction.lua
| @@ -235,6 +235,16 @@ function _M.endBattleRpc(agent, data) | @@ -235,6 +235,16 @@ function _M.endBattleRpc(agent, data) | ||
| 235 | return 4 | 235 | return 4 |
| 236 | end | 236 | end |
| 237 | 237 | ||
| 238 | + -- 防作弊 | ||
| 239 | + if not role:checkBattleCheat("hang", { | ||
| 240 | + id = carbonId, | ||
| 241 | + isWin = isWin, | ||
| 242 | + info = msg.info | ||
| 243 | + }) then | ||
| 244 | + SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({errorCode = 1})) | ||
| 245 | + return true | ||
| 246 | + end | ||
| 247 | + | ||
| 238 | local reward, change | 248 | local reward, change |
| 239 | if isWin then --win | 249 | if isWin then --win |
| 240 | role:hangFinish(carbonId) | 250 | role:hangFinish(carbonId) |
| @@ -609,6 +619,18 @@ function _M.endBonusBattleRpc(agent, data) | @@ -609,6 +619,18 @@ function _M.endBonusBattleRpc(agent, data) | ||
| 609 | SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({errorCode = 1})) | 619 | SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({errorCode = 1})) |
| 610 | return true | 620 | return true |
| 611 | end | 621 | end |
| 622 | + role.__bonusBattleCache = nil | ||
| 623 | + | ||
| 624 | + -- 防作弊 | ||
| 625 | + if not role:checkBattleCheat("bonus", { | ||
| 626 | + id = id, | ||
| 627 | + isWin = starNum and starNum > 0, | ||
| 628 | + info = msg.info | ||
| 629 | + }) then | ||
| 630 | + SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({errorCode = 1})) | ||
| 631 | + return true | ||
| 632 | + end | ||
| 633 | + | ||
| 612 | local bonusData = csvdb["bonus_battleCsv"][id] | 634 | local bonusData = csvdb["bonus_battleCsv"][id] |
| 613 | 635 | ||
| 614 | local reward, change = {} | 636 | local reward, change = {} |
src/actions/PvpAction.lua
| @@ -372,6 +372,16 @@ function _M.endBattleRpc(agent, data) | @@ -372,6 +372,16 @@ function _M.endBattleRpc(agent, data) | ||
| 372 | 372 | ||
| 373 | if not match then return end | 373 | if not match then return end |
| 374 | 374 | ||
| 375 | + -- 防作弊 | ||
| 376 | + if not role:checkBattleCheat("pvpc", { | ||
| 377 | + isWin = isWin, | ||
| 378 | + info = msg.info, | ||
| 379 | + format = _pvpStartBattleCacheC.pvpTC, | ||
| 380 | + }) then | ||
| 381 | + SendPacket(actionCodes.Pvp_endBattleRpc, MsgPack.pack({errorCode = 1})) | ||
| 382 | + return true | ||
| 383 | + end | ||
| 384 | + | ||
| 375 | local temp = string.randWeight(csvdb["player_expCsv"][role:getProperty("level")].pvpBonus, true) | 385 | local temp = string.randWeight(csvdb["player_expCsv"][role:getProperty("level")].pvpBonus, true) |
| 376 | local reward, change = role:award({[temp[1]] = temp[2]}, {log = {desc = "pvpBattleC"}}) | 386 | local reward, change = role:award({[temp[1]] = temp[2]}, {log = {desc = "pvpBattleC"}}) |
| 377 | local myScore, matchScore, oldmyScore, oldMatchScore, myRank, oldMyRank = 0, 0, 0, 0, -1, -1 | 387 | local myScore, matchScore, oldmyScore, oldMatchScore, myRank, oldMyRank = 0, 0, 0, 0, -1, -1 |
| @@ -652,13 +662,22 @@ function _M.endBattleHRpc(agent, data) | @@ -652,13 +662,22 @@ function _M.endBattleHRpc(agent, data) | ||
| 652 | end | 662 | end |
| 653 | end | 663 | end |
| 654 | 664 | ||
| 665 | + -- 防作弊 | ||
| 666 | + if not role:checkBattleCheat("pvph", { | ||
| 667 | + isWin = isWin, | ||
| 668 | + info = msg.info, | ||
| 669 | + format = _pvpStartBattleCacheH.pvpTH[#_pvpStartBattleCacheH.result] | ||
| 670 | + }) then | ||
| 671 | + SendPacket(actionCodes.Pvp_endBattleHRpc, MsgPack.pack({errorCode = 1})) | ||
| 672 | + return true | ||
| 673 | + end | ||
| 674 | + | ||
| 655 | if winCount >= 2 then | 675 | if winCount >= 2 then |
| 656 | isWin = true | 676 | isWin = true |
| 657 | elseif loseCount >= 2 then | 677 | elseif loseCount >= 2 then |
| 658 | isWin = false | 678 | isWin = false |
| 659 | else -- 没结束 | 679 | else -- 没结束 |
| 660 | -- 返回继续战斗 | 680 | -- 返回继续战斗 |
| 661 | - | ||
| 662 | local key = tostring(math.random()) | 681 | local key = tostring(math.random()) |
| 663 | _pvpStartBattleCacheH.key = key | 682 | _pvpStartBattleCacheH.key = key |
| 664 | local round = #_pvpStartBattleCacheH.result + 1 | 683 | local round = #_pvpStartBattleCacheH.result + 1 |
src/actions/StoreAction.lua
| @@ -232,6 +232,13 @@ function _M.getFreeChestRpc(agent, data) | @@ -232,6 +232,13 @@ function _M.getFreeChestRpc(agent, data) | ||
| 232 | local config = csvdb["shop_rechargeCsv"][id] | 232 | local config = csvdb["shop_rechargeCsv"][id] |
| 233 | if not config then return end | 233 | if not config then return end |
| 234 | 234 | ||
| 235 | + --判断是否是活动商品 | ||
| 236 | + if config.activity_id ~= 0 then | ||
| 237 | + local actCfg = csvdb["activity_ctrlCsv"][config.activity_id] | ||
| 238 | + if not actCfg then return 2 end | ||
| 239 | + if not role.activity:isOpenById(config.activity_id, "ActShopGoods") then return 3 end | ||
| 240 | + end | ||
| 241 | + | ||
| 235 | local rechargeRecord = role.storeData:getProperty("payR") | 242 | local rechargeRecord = role.storeData:getProperty("payR") |
| 236 | local getCount = (rechargeRecord[id] or 0) | 243 | local getCount = (rechargeRecord[id] or 0) |
| 237 | if getCount >= config.limit then | 244 | if getCount >= config.limit then |
src/actions/TowerAction.lua
| @@ -65,6 +65,15 @@ function _M.endBattleRpc(agent, data) | @@ -65,6 +65,15 @@ function _M.endBattleRpc(agent, data) | ||
| 65 | local curTower = csvdb["tower_battleCsv"][id] | 65 | local curTower = csvdb["tower_battleCsv"][id] |
| 66 | if not curTower then return 2 end | 66 | if not curTower then return 2 end |
| 67 | 67 | ||
| 68 | + -- 防作弊 | ||
| 69 | + if not role:checkBattleCheat("tower", { | ||
| 70 | + isWin = msg.starNum and msg.starNum > 0, | ||
| 71 | + info = msg.info | ||
| 72 | + }) then | ||
| 73 | + SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({errorCode = 1})) | ||
| 74 | + return true | ||
| 75 | + end | ||
| 76 | + | ||
| 68 | local curCount, nextTime = getUpdateTime(towerInfo.c, towerInfo.t) | 77 | local curCount, nextTime = getUpdateTime(towerInfo.c, towerInfo.t) |
| 69 | 78 | ||
| 70 | 79 |
src/adv/Adv.lua
| @@ -61,10 +61,10 @@ function Adv:initByInfo(advInfo) | @@ -61,10 +61,10 @@ function Adv:initByInfo(advInfo) | ||
| 61 | self:initBattle(advInfo) | 61 | self:initBattle(advInfo) |
| 62 | end | 62 | end |
| 63 | -- 找出level 是否存在中继层 | 63 | -- 找出level 是否存在中继层 |
| 64 | -function Adv:isHaveRelay(level, chapterId) | 64 | +function Adv:isHaveRelay(level, chapterId, force) |
| 65 | level = level or self.level | 65 | level = level or self.level |
| 66 | chapterId = chapterId or self.chapterId | 66 | chapterId = chapterId or self.chapterId |
| 67 | - if level == 1 then return end | 67 | + if level == 1 and not force then return end |
| 68 | 68 | ||
| 69 | local campsiteCsv = csvdb["adv_chapter_campsiteCsv"][chapterId] | 69 | local campsiteCsv = csvdb["adv_chapter_campsiteCsv"][chapterId] |
| 70 | for _, campsite in ipairs(campsiteCsv) do | 70 | for _, campsite in ipairs(campsiteCsv) do |
| @@ -140,9 +140,6 @@ function Adv:initByChapter(params) | @@ -140,9 +140,6 @@ function Adv:initByChapter(params) | ||
| 140 | local chapter = self:isEndless() and -1 or self.chapterId | 140 | local chapter = self:isEndless() and -1 or self.chapterId |
| 141 | if not (advRelay[chapter] or {})[self.level] then | 141 | if not (advRelay[chapter] or {})[self.level] then |
| 142 | isNewRelay = true | 142 | isNewRelay = true |
| 143 | - advRelay[chapter] = advRelay[chapter] or {} | ||
| 144 | - advRelay[chapter][self.level] = 1 | ||
| 145 | - self.owner:updateProperty({field = "advRelay", value = advRelay}) | ||
| 146 | end | 143 | end |
| 147 | end | 144 | end |
| 148 | 145 | ||
| @@ -157,8 +154,6 @@ function Adv:initByChapter(params) | @@ -157,8 +154,6 @@ function Adv:initByChapter(params) | ||
| 157 | 154 | ||
| 158 | self:initLayerTask() | 155 | self:initLayerTask() |
| 159 | 156 | ||
| 160 | - | ||
| 161 | - | ||
| 162 | self:checkTask(Adv.TaskType.Arrive) | 157 | self:checkTask(Adv.TaskType.Arrive) |
| 163 | self:checkAdvUnlock(1, self.level) | 158 | self:checkAdvUnlock(1, self.level) |
| 164 | 159 | ||
| @@ -172,6 +167,20 @@ function Adv:initByChapter(params) | @@ -172,6 +167,20 @@ function Adv:initByChapter(params) | ||
| 172 | end | 167 | end |
| 173 | end | 168 | end |
| 174 | 169 | ||
| 170 | +function Adv:passAdvRelay() | ||
| 171 | + local advRelay = self.owner:getProperty("advRelay") | ||
| 172 | + local chapter = self:isEndless() and -1 or self.chapterId | ||
| 173 | + if not (advRelay[chapter] or {})[self.level] then | ||
| 174 | + advRelay[chapter] = advRelay[chapter] or {} | ||
| 175 | + advRelay[chapter][self.level] = 1 | ||
| 176 | + self.owner:updateProperty({field = "advRelay", value = advRelay}) | ||
| 177 | + local relayData = self:isHaveRelay() | ||
| 178 | + if relayData and relayData.award ~= "" then | ||
| 179 | + self:pushBackEvent(AdvBackEventType.RelayReward, {items = self:award(relayData.award:toNumMap(), {log = {desc = "relayReward"}})}) | ||
| 180 | + end | ||
| 181 | + end | ||
| 182 | +end | ||
| 183 | + | ||
| 175 | function Adv:clear() | 184 | function Adv:clear() |
| 176 | self.chapterId = nil | 185 | self.chapterId = nil |
| 177 | self.level = nil | 186 | self.level = nil |
| @@ -1168,6 +1177,7 @@ local function clickOut(self, room, block, params, isExit) | @@ -1168,6 +1177,7 @@ local function clickOut(self, room, block, params, isExit) | ||
| 1168 | end | 1177 | end |
| 1169 | 1178 | ||
| 1170 | if not self:isEndless() and (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel) then --关卡结束 | 1179 | if not self:isEndless() and (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel) then --关卡结束 |
| 1180 | + self:passAdvRelay() | ||
| 1171 | self:over(true) | 1181 | self:over(true) |
| 1172 | else | 1182 | else |
| 1173 | self.battle.player:triggerPassive(Passive.DOWN_LAYER) | 1183 | self.battle.player:triggerPassive(Passive.DOWN_LAYER) |
| @@ -1720,10 +1730,7 @@ function Adv:clickBlock(roomId, blockId, params) | @@ -1720,10 +1730,7 @@ function Adv:clickBlock(roomId, blockId, params) | ||
| 1720 | if self.isRelay or checkAroundBlocks() then --开放 | 1730 | if self.isRelay or checkAroundBlocks() then --开放 |
| 1721 | self:getCurMap():openBlock(roomId, blockId, true, true) | 1731 | self:getCurMap():openBlock(roomId, blockId, true, true) |
| 1722 | if self.isRelay and self:getCurMap():isAllOpen() then -- 发放翻开的奖励 | 1732 | if self.isRelay and self:getCurMap():isAllOpen() then -- 发放翻开的奖励 |
| 1723 | - local relayData = self:isHaveRelay() | ||
| 1724 | - if relayData and relayData.award ~= "" then | ||
| 1725 | - self:pushBackEvent(AdvBackEventType.RelayReward, {items = self:award(relayData.award:toNumMap(), {log = {desc = "relayReward"}})}) | ||
| 1726 | - end | 1733 | + self:passAdvRelay() |
| 1727 | end | 1734 | end |
| 1728 | status = true | 1735 | status = true |
| 1729 | end | 1736 | end |
src/models/HeroPlugin.lua
| @@ -53,22 +53,25 @@ function HeroPlugin.bind(Hero) | @@ -53,22 +53,25 @@ function HeroPlugin.bind(Hero) | ||
| 53 | local talentAttrS = {} | 53 | local talentAttrS = {} |
| 54 | 54 | ||
| 55 | -- 四个基础属性 | 55 | -- 四个基础属性 |
| 56 | - local curData = csvdb["unit_talentCsv"][talent:getv(0, 1)] | ||
| 57 | - local curTalentLvl = 0 | ||
| 58 | - if not curData then -- 已经满阶段了 | ||
| 59 | - local cfgName = "unit_talent_"..heroCfgId.."Csv" | ||
| 60 | - curData = csvdb[cfgName][#csvdb[cfgName]] | ||
| 61 | - else | ||
| 62 | - curTalentLvl = talent:getv(1, 1) | ||
| 63 | - end | ||
| 64 | - for lvl, cfg in pairs(curData) do | ||
| 65 | - if lvl < curTalentLvl or curTalentLvl == 0 then | ||
| 66 | - if cfg.effect ~= 99 then | ||
| 67 | - local curVal = talentAttrS[cfg.effect] or 0 | ||
| 68 | - if curVal < cfg.strength then | ||
| 69 | - talentAttrS[cfg.effect] = cfg.strength | 56 | + local cfgName = "unit_talent_"..heroCfgId.."Csv" |
| 57 | + local curRank = talent:getv(0, 1) | ||
| 58 | + local curLv = talent:getv(1,1) - 1 | ||
| 59 | + for i, value in ipairs(csvdb[cfgName]) do | ||
| 60 | + if i <= curRank then | ||
| 61 | + for lv, cfg in ipairs(value) do | ||
| 62 | + if i < curRank or lv <= curLv then | ||
| 63 | + if cfg.effect ~= 99 then | ||
| 64 | + if not talentAttrS[cfg.effect] then | ||
| 65 | + talentAttrS[AttsEnumEx[cfg.effect]] = 0 | ||
| 66 | + end | ||
| 67 | + talentAttrS[AttsEnumEx[cfg.effect]] = cfg.strength | ||
| 68 | + end | ||
| 69 | + else | ||
| 70 | + break | ||
| 70 | end | 71 | end |
| 71 | end | 72 | end |
| 73 | + else | ||
| 74 | + break | ||
| 72 | end | 75 | end |
| 73 | end | 76 | end |
| 74 | 77 | ||
| @@ -85,7 +88,7 @@ function HeroPlugin.bind(Hero) | @@ -85,7 +88,7 @@ function HeroPlugin.bind(Hero) | ||
| 85 | for lvl = 1, #faithConfig do | 88 | for lvl = 1, #faithConfig do |
| 86 | if faith >= faithConfig[lvl].exp then | 89 | if faith >= faithConfig[lvl].exp then |
| 87 | local add = faithConfig[lvl]["position_"..unitData.position]:toArray(true, "=") | 90 | local add = faithConfig[lvl]["position_"..unitData.position]:toArray(true, "=") |
| 88 | - faithAttr[add[1]] = (faithAttr[add[1]] or 0) + add[2] | 91 | + faithAttr[AttsEnumEx[add[1]]] = (faithAttr[AttsEnumEx[add[1]]] or 0) + add[2] |
| 89 | end | 92 | end |
| 90 | end | 93 | end |
| 91 | for _, attrName in pairs(AttsEnumEx) do | 94 | for _, attrName in pairs(AttsEnumEx) do |
src/models/Role.lua
| @@ -53,6 +53,7 @@ Role.schema = { | @@ -53,6 +53,7 @@ Role.schema = { | ||
| 53 | banTime = {"number", 0}, | 53 | banTime = {"number", 0}, |
| 54 | banType = {"number", 0}, | 54 | banType = {"number", 0}, |
| 55 | heartWarning = {"number", 0}, | 55 | heartWarning = {"number", 0}, |
| 56 | + cheatCount = {"number", 0}, | ||
| 56 | ltime = {"number", 0}, -- 最后登录时间 | 57 | ltime = {"number", 0}, -- 最后登录时间 |
| 57 | ctime = {"number", skynet.timex()}, -- 创建时间 | 58 | ctime = {"number", skynet.timex()}, -- 创建时间 |
| 58 | ignoreMt = {"number", 0}, -- 忽略维护拦截 | 59 | ignoreMt = {"number", 0}, -- 忽略维护拦截 |
| @@ -356,6 +357,7 @@ function Role:data() | @@ -356,6 +357,7 @@ function Role:data() | ||
| 356 | advSup = self:getProperty("advSup"), | 357 | advSup = self:getProperty("advSup"), |
| 357 | advC = self:getProperty("advC"), | 358 | advC = self:getProperty("advC"), |
| 358 | advCT = self:getProperty("advCT"), | 359 | advCT = self:getProperty("advCT"), |
| 360 | + advRelay = self:getProperty("advRelay"), | ||
| 359 | 361 | ||
| 360 | hangPass = self:getProperty("hangPass"), | 362 | hangPass = self:getProperty("hangPass"), |
| 361 | hangGift = self:getProperty("hangGift"), | 363 | hangGift = self:getProperty("hangGift"), |
src/models/RoleBattle.lua
| @@ -21,13 +21,153 @@ local BattleType = { | @@ -21,13 +21,153 @@ local BattleType = { | ||
| 21 | 21 | ||
| 22 | RoleBattle.bind = function (Role) | 22 | RoleBattle.bind = function (Role) |
| 23 | 23 | ||
| 24 | +local checkCheatAttrs = { | ||
| 25 | + ["hp"] = 1, | ||
| 26 | + ["atk"] = 1, | ||
| 27 | + ["def"] = 1, | ||
| 28 | + ["hit"] = 1, | ||
| 29 | + ["miss"] = 1, | ||
| 30 | + ["crit"] = 1, | ||
| 31 | + ["atkSpeed"] = 1, | ||
| 32 | + ["critHurt"] = 1, | ||
| 33 | + -- ["vampire"] = 1, | ||
| 34 | + -- ["pierce"] = 1, | ||
| 35 | +} | ||
| 24 | 36 | ||
| 25 | --- TODO 检查战斗是否作弊 | ||
| 26 | -local function checkBattleCheat() | ||
| 27 | - | 37 | +local function checkOneCheat(selfTeamClient, selfTeamServer, enemyClient, enemyServer) |
| 38 | + if not selfTeamClient or type(selfTeamClient) ~= "table" then return end | ||
| 39 | + for unitType, clientInfo in pairs(selfTeamClient) do | ||
| 40 | + local serverInfo = selfTeamServer[unitType] | ||
| 41 | + if not serverInfo then return end | ||
| 42 | + for attr, pm in pairs(checkCheatAttrs) do | ||
| 43 | + if not clientInfo[attr] then return end | ||
| 44 | + end | ||
| 45 | + local b1 = ((clientInfo["hp"] + clientInfo["def"] * 7 + clientInfo["miss"] * 4) * (clientInfo["atk"] * 4 + clientInfo["hit"] * 2) * (1 + clientInfo["crit"]/100 * clientInfo["critHurt"]/100) * clientInfo["atkSpeed"] / 600000) ^ 0.8 | ||
| 46 | + local b2 = ((serverInfo["hp"] + serverInfo["def"] * 7 + serverInfo["miss"] * 4) * (serverInfo["atk"] * 4 + serverInfo["hit"] * 2) * (1 + serverInfo["crit"]/100 * serverInfo["critHurt"]/100) * serverInfo["atkSpeed"] / 600000) ^ 0.8 | ||
| 47 | + if b1 >= b2 * 2 then | ||
| 48 | + return | ||
| 49 | + end | ||
| 50 | + end | ||
| 51 | + return true | ||
| 28 | end | 52 | end |
| 29 | 53 | ||
| 54 | +-- local function getRobotAttrs(info, strength) | ||
| 55 | +-- strength = strength or 10000 | ||
| 56 | +-- local unitData = csvdb["unitCsv"][info.unitType] | ||
| 57 | +-- local enemy = {} | ||
| 58 | +-- for arr, _ in pairs(checkCheatAttrs) do | ||
| 59 | +-- enemy[arr] = unitData[attr] * info[attr] * strength / 10000 | ||
| 60 | +-- end | ||
| 61 | +-- return enemy | ||
| 62 | +-- end | ||
| 63 | + | ||
| 64 | +-- --通过配表构建敌人队伍 通用 | ||
| 65 | +-- function BattleEnter:packBattleEnemyCommon( carbonData ) | ||
| 66 | +-- local enemys = {} | ||
| 67 | +-- local monsterSet = csvdb[carbonData.monster:match("/([^/]*)$") .. "Csv"] | ||
| 68 | +-- for phase = 1, #monsterSet do | ||
| 69 | +-- local allEnemys = table.values(monsterSet[phase]) | ||
| 70 | +-- table.sort(allEnemys, function(a, b) return a.id < b.id end) | ||
| 71 | +-- local heros = {} | ||
| 72 | +-- for idx, enemy in ipairs(allEnemys) do | ||
| 73 | +-- local info = getRobotAttrs(enemy, carbonData.strength) | ||
| 74 | +-- enemys[idx] = info | ||
| 75 | +-- end | ||
| 76 | +-- break | ||
| 77 | +-- end | ||
| 78 | +-- return enemys | ||
| 79 | +-- end | ||
| 80 | + | ||
| 81 | +-- 检查战斗是否作弊 | ||
| 82 | +function Role:checkBattleCheat(battleType, params) | ||
| 83 | + if not params.isWin then return true end | ||
| 84 | + local clientInfo = params.info or {} | ||
| 85 | + | ||
| 86 | + if not BattleType[battleType] then | ||
| 87 | + print(string.format("NO find battleType: %s", battleType)) | ||
| 88 | + return true | ||
| 89 | + end | ||
| 90 | + local selfTeamServer = {} | ||
| 91 | + local enemyServer = {} | ||
| 92 | + | ||
| 93 | + local cheat = {} | ||
| 94 | + cheat["hang"] = function() | ||
| 95 | + local team = self:getTeamBattleInfo(self:getTeamFormatByType(TeamSystemType.Hang)) | ||
| 96 | + for slot, hero in pairs(team.heros) do | ||
| 97 | + local temp = {} | ||
| 98 | + for arr, _ in pairs(checkCheatAttrs) do | ||
| 99 | + temp[arr] = hero[arr] | ||
| 100 | + end | ||
| 101 | + selfTeamServer[hero.type] = temp | ||
| 102 | + end | ||
| 103 | + -- local carbonData = csvdb["idle_battleCsv"][params.id] | ||
| 104 | + -- enemyServer = packBattleEnemyCommon(carbonData) | ||
| 105 | + end | ||
| 106 | + cheat["tower"] = function() | ||
| 107 | + local team = self:getTeamBattleInfo(self:getTeamFormatByType(TeamSystemType.Tower)) | ||
| 108 | + for slot, hero in pairs(team.heros) do | ||
| 109 | + local temp = {} | ||
| 110 | + for arr, _ in pairs(checkCheatAttrs) do | ||
| 111 | + temp[arr] = hero[arr] | ||
| 112 | + end | ||
| 113 | + selfTeamServer[hero.type] = temp | ||
| 114 | + end | ||
| 115 | + -- local carbonData = csvdb["tower_battleCsv"][params.id] | ||
| 116 | + -- enemyServer = packBattleEnemyCommon(carbonData) | ||
| 117 | + end | ||
| 118 | + cheat["bonus"] = function() | ||
| 119 | + local team = self:getTeamBattleInfo(self:getTeamFormatByType(TeamSystemType.BonusBattle)) | ||
| 120 | + for slot, hero in pairs(team.heros) do | ||
| 121 | + local temp = {} | ||
| 122 | + for arr, _ in pairs(checkCheatAttrs) do | ||
| 123 | + temp[arr] = hero[arr] | ||
| 124 | + end | ||
| 125 | + selfTeamServer[hero.type] = temp | ||
| 126 | + end | ||
| 127 | + -- local carbonData = csvdb["bonus_battleCsv"][params.id] | ||
| 128 | + -- enemyServer = packBattleEnemyCommon(carbonData) | ||
| 129 | + end | ||
| 130 | + cheat["pvpc"] = function() | ||
| 131 | + if not params.format then return end | ||
| 132 | + local team = self:getTeamBattleInfo(params.format) | ||
| 133 | + for slot, hero in pairs(team.heros) do | ||
| 134 | + local temp = {} | ||
| 135 | + for arr, _ in pairs(checkCheatAttrs) do | ||
| 136 | + temp[arr] = hero[arr] | ||
| 137 | + end | ||
| 138 | + selfTeamServer[hero.type] = temp | ||
| 139 | + end | ||
| 140 | + end | ||
| 141 | + cheat["pvph"] = cheat["pvpc"] | ||
| 142 | + cheat["act_battle"] = cheat["pvpc"] | ||
| 143 | + | ||
| 144 | + cheat[battleType]() | ||
| 30 | 145 | ||
| 146 | + local status = checkOneCheat(clientInfo.selfAttr, selfTeamServer, clientInfo.enemyAttr, enemyServer) | ||
| 147 | + if not status then | ||
| 148 | + local cheatCount = self:getProperty("cheatCount") | ||
| 149 | + cheatCount = cheatCount + 1 | ||
| 150 | + self:setProperty("cheatCount", cheatCount) | ||
| 151 | + | ||
| 152 | + local result = {clientSelf = {}, serverSelf = {}} | ||
| 153 | + for k , v in pairs(clientInfo.selfAttr) do | ||
| 154 | + result.clientSelf[tostring(k)] = v | ||
| 155 | + end | ||
| 156 | + for k , v in pairs(selfTeamServer) do | ||
| 157 | + result.serverSelf[tostring(k)] = v | ||
| 158 | + end | ||
| 159 | + result = json.encode(result) | ||
| 160 | + self:mylog("cheat", {desc = battleType, int1 = cheatCount, text1 = result}) | ||
| 161 | + | ||
| 162 | + for _, v in ipairs(globalCsv.cheat_check) do | ||
| 163 | + if cheatCount == v[1] then | ||
| 164 | + self:setBan(v[2] / 86400, 5) | ||
| 165 | + break | ||
| 166 | + end | ||
| 167 | + end | ||
| 168 | + end | ||
| 169 | + return status | ||
| 170 | +end | ||
| 31 | 171 | ||
| 32 | function Role:checkBattle(battleType, params) | 172 | function Role:checkBattle(battleType, params) |
| 33 | local clientInfo = params.info or {} | 173 | local clientInfo = params.info or {} |
src/models/RoleLog.lua
| @@ -595,6 +595,7 @@ local LogType = { | @@ -595,6 +595,7 @@ local LogType = { | ||
| 595 | guide = "common", | 595 | guide = "common", |
| 596 | newdevice = "common", | 596 | newdevice = "common", |
| 597 | cbback = "common", | 597 | cbback = "common", |
| 598 | + cheat = "common", | ||
| 598 | 599 | ||
| 599 | in_item = "common", | 600 | in_item = "common", |
| 600 | out_item = "common", | 601 | out_item = "common", |
src/models/RolePlugin.lua
| @@ -864,7 +864,6 @@ function RolePlugin.bind(Role) | @@ -864,7 +864,6 @@ function RolePlugin.bind(Role) | ||
| 864 | self:setProperty("heartWarning", heartWarning) | 864 | self:setProperty("heartWarning", heartWarning) |
| 865 | if heartWarning == 50 then | 865 | if heartWarning == 50 then |
| 866 | self:setBan(30, 1) --封禁 30天 | 866 | self:setBan(30, 1) --封禁 30天 |
| 867 | - self:sendGmMsg("server_accountBanned_inGame_1") | ||
| 868 | return | 867 | return |
| 869 | end | 868 | end |
| 870 | if heartWarning < 50 and heartWarning % 5 == 0 then | 869 | if heartWarning < 50 and heartWarning % 5 == 0 then |
| @@ -877,21 +876,53 @@ function RolePlugin.bind(Role) | @@ -877,21 +876,53 @@ function RolePlugin.bind(Role) | ||
| 877 | time = time or 0 | 876 | time = time or 0 |
| 878 | banType = banType or 0 | 877 | banType = banType or 0 |
| 879 | local now = skynet.timex() | 878 | local now = skynet.timex() |
| 880 | - if time == 0 then | 879 | + if time <= 0 then |
| 881 | self:setProperty("banTime", 0) | 880 | self:setProperty("banTime", 0) |
| 882 | self:setProperty("banType", 0) | 881 | self:setProperty("banType", 0) |
| 883 | self:setProperty("heartWarning", 0) | 882 | self:setProperty("heartWarning", 0) |
| 884 | - | ||
| 885 | self:mylog("role_action", {desc = "ban_rm"}) | 883 | self:mylog("role_action", {desc = "ban_rm"}) |
| 886 | else | 884 | else |
| 887 | - self:setProperty("banTime", now + 86400 * time) | 885 | + self:sendGmMsg(globalCsv.ban_tips[banType] or globalCsv.ban_tips[0]) |
| 886 | + print(86400 * time) | ||
| 887 | + self:setProperty("banTime", math.ceil(now + 86400 * time)) | ||
| 888 | self:setProperty("banType", banType) | 888 | self:setProperty("banType", banType) |
| 889 | - self:mylog("role_action", {desc = "ban", int1 = time, int2 = banType}) | 889 | + self:resetRank() |
| 890 | + self:mylog("role_action", {desc = "ban", int1 = math.ceil(time), int2 = banType}) | ||
| 890 | end | 891 | end |
| 891 | end | 892 | end |
| 892 | 893 | ||
| 894 | + -- 清掉所有排行榜 | ||
| 895 | + function Role:resetRank() | ||
| 896 | + local roleId = self:getProperty("id") | ||
| 897 | + redisproxy:pipelining(function (red) | ||
| 898 | + red:zrem(RANK_TOWER, roleId) | ||
| 899 | + for _, rk in pairs(RANK_ADV) do | ||
| 900 | + red:zrem(rk, roleId) | ||
| 901 | + end | ||
| 902 | + for _, rk in pairs(RANK_DINER) do | ||
| 903 | + red:zrem(rk, roleId) | ||
| 904 | + end | ||
| 905 | + for _, rk in pairs(RANK_PVP_COMMON_KEY) do | ||
| 906 | + red:zrem(rk, roleId) | ||
| 907 | + end | ||
| 908 | + for _, rk in pairs(RANK_PVP_HIGHT_KEY) do | ||
| 909 | + red:zrem(rk, roleId) | ||
| 910 | + end | ||
| 911 | + for _, ct in pairs(RANK_TYPE) do | ||
| 912 | + red:zrem(RANK_COMMON .. ct, roleId) | ||
| 913 | + end | ||
| 914 | + end) | ||
| 915 | + end | ||
| 916 | + | ||
| 893 | function Role:sendGmMsg(text, isNotKey) | 917 | function Role:sendGmMsg(text, isNotKey) |
| 894 | SendPacket(actionCodes.Sys_maintainNotice, MsgPack.pack({ body = text, iskey = not isNotKey})) | 918 | SendPacket(actionCodes.Sys_maintainNotice, MsgPack.pack({ body = text, iskey = not isNotKey})) |
| 919 | + | ||
| 920 | + local agent = datacenter.get("agent", self:getProperty("id")) | ||
| 921 | + if agent then | ||
| 922 | + skynet.timeout(50, function () | ||
| 923 | + skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd) | ||
| 924 | + end) | ||
| 925 | + end | ||
| 895 | end | 926 | end |
| 896 | 927 | ||
| 897 | -- function Role:getHeroActiveRelationData(heros) | 928 | -- function Role:getHeroActiveRelationData(heros) |