Commit 33de037fb7fb80345a70d266aef13a0beef4cf2c
Merge branch 'tr/bugfix' into tr/publish/qa-out
Showing
32 changed files
with
609 additions
and
210 deletions
Show diff stats
src/GlobalVar.lua
| ... | ... | @@ -16,6 +16,7 @@ TIME_ZONE = math.floor(os.difftime(START_RESET_TIME_BASE, os.time(os.date("!*t", |
| 16 | 16 | |
| 17 | 17 | START_RESET_TIME = START_RESET_TIME_BASE - TIME_ZONE * 3600 |
| 18 | 18 | |
| 19 | +STRUCT_VERSION = 3 -- 数据结构版本 | |
| 19 | 20 | |
| 20 | 21 | MAX_ROLE_NUM = 1000000 |
| 21 | 22 | -- 属性枚举 |
| ... | ... | @@ -141,7 +142,6 @@ ItemId = { |
| 141 | 142 | TimeReset = { |
| 142 | 143 | CrossDay = 1, --通用跨天 |
| 143 | 144 | CrossWeek = 2, --通用跨周 |
| 144 | - CrossMonth = 1, --通用跨月 索引使用跨天,在回调方法中判断是否跨越 跨月的前置条件是跨天 | |
| 145 | 145 | DinerRank = 1, -- 餐厅排行榜 |
| 146 | 146 | PvpRank = 2, -- pvp排行榜 |
| 147 | 147 | PvpHight = 11, --高级竞技场 |
| ... | ... | @@ -324,6 +324,7 @@ MailId = { |
| 324 | 324 | PayBackAward = 242, |
| 325 | 325 | CBBackAward = 243, |
| 326 | 326 | CBBackAward2 = 244, |
| 327 | + ActivityPoolRet = 280, | |
| 327 | 328 | } |
| 328 | 329 | |
| 329 | 330 | TriggerEventType = { | ... | ... |
src/actions/ActivityAction.lua
| ... | ... | @@ -375,6 +375,8 @@ function _M.hangDropRpc(agent, data) |
| 375 | 375 | local msg = MsgPack.unpack(data) |
| 376 | 376 | local actid = msg.actid |
| 377 | 377 | if not role.activity:isOpenById(actid, "HangDrop") then return 1 end |
| 378 | + local actCtrlData = csvdb["activity_ctrlCsv"][actid] | |
| 379 | + if not actCtrlData then return end | |
| 378 | 380 | |
| 379 | 381 | local actCfg = csvdb["activity_putCsv"][actid] |
| 380 | 382 | if not actCfg then return 2 end |
| ... | ... | @@ -407,7 +409,7 @@ function _M.hangDropRpc(agent, data) |
| 407 | 409 | return 4 |
| 408 | 410 | end |
| 409 | 411 | local num = math.floor((timeNow - actData)/ period) |
| 410 | - num = num > 8 and 8 or num | |
| 412 | + num = num > actCtrlData.condition and actCtrlData.condition or num | |
| 411 | 413 | if num == 0 then |
| 412 | 414 | return 5 |
| 413 | 415 | end |
| ... | ... | @@ -483,8 +485,16 @@ function _M.startBattleRpc(agent, data) |
| 483 | 485 | local bi = actData[id] |
| 484 | 486 | if not bi then return 8 end |
| 485 | 487 | local star = bi["star"] or 0 |
| 486 | - if star < 1 then | |
| 487 | - return 9 | |
| 488 | + local maxP = bi["maxP"] or 0 | |
| 489 | + -- 世界boss | |
| 490 | + if battleCfg.worldBoss_award ~= 0 then | |
| 491 | + if maxP < 1 then | |
| 492 | + return 9 | |
| 493 | + end | |
| 494 | + else | |
| 495 | + if star < 1 then | |
| 496 | + return 9 | |
| 497 | + end | |
| 488 | 498 | end |
| 489 | 499 | num = num * count |
| 490 | 500 | end |
| ... | ... | @@ -501,6 +511,7 @@ function _M.startBattleRpc(agent, data) |
| 501 | 511 | key = tostring(math.random()), |
| 502 | 512 | actid = actid, |
| 503 | 513 | id = id, |
| 514 | + format = msg.format, | |
| 504 | 515 | } |
| 505 | 516 | SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack({key = role.__actBattleCache.key})) |
| 506 | 517 | else |
| ... | ... | @@ -511,7 +522,7 @@ function _M.startBattleRpc(agent, data) |
| 511 | 522 | return 7 |
| 512 | 523 | end |
| 513 | 524 | local bi = actData[id] |
| 514 | - local star = bi["star"] | |
| 525 | + local star = bi["star"] or 0 | |
| 515 | 526 | local award = battleCfg.item_clear:toNumMap() |
| 516 | 527 | if getStarCount(battleCfg, star) == 3 then |
| 517 | 528 | local aw = battleCfg.perfect_reward:toNumMap() |
| ... | ... | @@ -526,10 +537,10 @@ function _M.startBattleRpc(agent, data) |
| 526 | 537 | SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack(role:packReward(reward, change))) |
| 527 | 538 | |
| 528 | 539 | if battleCfg.worldBoss_award ~= 0 and (bi["maxP"] or 0) > 0 then |
| 529 | - bi["bossP"] = (bi["bossP"] or 0) + bi["maxP"] | |
| 540 | + bi["bossP"] = (bi["bossP"] or 0) + bi["maxP"] * count | |
| 530 | 541 | end |
| 531 | 542 | |
| 532 | - bi["sum"] = bi["sum"] + bi["top"] | |
| 543 | + bi["sum"] = bi["sum"] + bi["top"] * count | |
| 533 | 544 | actData["ticket"] = ticket - num |
| 534 | 545 | actData[id] = bi |
| 535 | 546 | changeFlag = true |
| ... | ... | @@ -558,7 +569,10 @@ function _M.endBattleRpc(agent, data) |
| 558 | 569 | local isWin = msg.isWin |
| 559 | 570 | local heros = msg.heros |
| 560 | 571 | local support = msg.support |
| 561 | - if not role.activity:isOpenById(actid, "ChallengeLevel") then return 1 end | |
| 572 | + if not role.activity:isOpenById(actid, "ChallengeLevel") then | |
| 573 | + SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({})) | |
| 574 | + return true | |
| 575 | + end | |
| 562 | 576 | |
| 563 | 577 | if not role.__actBattleCache then return 2 end |
| 564 | 578 | |
| ... | ... | @@ -566,6 +580,18 @@ function _M.endBattleRpc(agent, data) |
| 566 | 580 | SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({errorCode = 1})) |
| 567 | 581 | end |
| 568 | 582 | |
| 583 | + -- 防作弊 | |
| 584 | + if not role:checkBattleCheat("act_battle", { | |
| 585 | + id = id, | |
| 586 | + isWin = isWin, | |
| 587 | + info = msg.info, | |
| 588 | + format = role.__actBattleCache.format | |
| 589 | + }) then | |
| 590 | + SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({errorCode = 1})) | |
| 591 | + return true | |
| 592 | + end | |
| 593 | + role.__actBattleCache = nil | |
| 594 | + | |
| 569 | 595 | local actCfg = csvdb["activity_battleCsv"][actid] |
| 570 | 596 | if not actCfg then return 3 end |
| 571 | 597 | |
| ... | ... | @@ -831,6 +857,7 @@ function _M.bossRewardRpc(agent, data) |
| 831 | 857 | local awardCfg = actCfg[index] |
| 832 | 858 | if not awardCfg then return 6 end |
| 833 | 859 | |
| 860 | + local totalAwardCnt = #actCfg | |
| 834 | 861 | local preList = awardCfg.condition1:toArray(true, "=") |
| 835 | 862 | |
| 836 | 863 | local actData = role.activity:getActData("ChallengeLevel") or {} |
| ... | ... | @@ -858,6 +885,16 @@ function _M.bossRewardRpc(agent, data) |
| 858 | 885 | if not ok then return 8 end |
| 859 | 886 | |
| 860 | 887 | battleInfo["bossR"] = string.setbit(bossRecord, index) |
| 888 | + local allFinish = true | |
| 889 | + for i = 1, totalAwardCnt do | |
| 890 | + if string.char(string.getbit(battleInfo["bossR"], i)) == "0" then | |
| 891 | + allFinish = false | |
| 892 | + break | |
| 893 | + end | |
| 894 | + end | |
| 895 | + if allFinish then | |
| 896 | + battleInfo["bossR"] = "" | |
| 897 | + end | |
| 861 | 898 | battleInfo["bossP"] = bossPoint - 1 |
| 862 | 899 | actData[id] = battleInfo |
| 863 | 900 | role.activity:updateActData("ChallengeLevel", actData) | ... | ... |
src/actions/AdvAction.lua
| ... | ... | @@ -57,6 +57,15 @@ local function checkFormat(role, format, checkAdvTeam) |
| 57 | 57 | end |
| 58 | 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 | 69 | if not format.leader then return end |
| 61 | 70 | if format.leader2 == format.leader then return end |
| 62 | 71 | local hadLeader = false |
| ... | ... | @@ -102,6 +111,8 @@ function _M.startAdvRpc( agent, data ) |
| 102 | 111 | |
| 103 | 112 | local advPass = role:getProperty("advPass") |
| 104 | 113 | |
| 114 | + if not checkFormat(role) then return 7 end | |
| 115 | + | |
| 105 | 116 | if AdvCommon.isEndless(chapterId) then -- 无尽模式判断 |
| 106 | 117 | |
| 107 | 118 | if chapterId ~= role.advElChapter then return end -- 不是当前进行的章节 |
| ... | ... | @@ -118,37 +129,24 @@ function _M.startAdvRpc( agent, data ) |
| 118 | 129 | if not relayData then return 14 end -- 不是中继层 |
| 119 | 130 | if advElM < relayData.unlockfloor then return 15 end --未解锁 |
| 120 | 131 | end |
| 132 | + | |
| 133 | + role.dailyData:updateProperty({field = "advElC", delta = 1}) | |
| 121 | 134 | else -- 普通模式判断 |
| 122 | - if not role:checkAdvCount(chapterData.limitlevel) then return 2 end -- 是否有体力 | |
| 123 | 135 | if layer >= chapterData.limitlevel then return 4 end |
| 124 | - -- 关卡开放判断 | |
| 125 | - if not role:advChapterIsOpen(chapterId) then return 5 end | |
| 126 | 136 | |
| 137 | + local relayData = role:getAdvData():isHaveRelay(layer, chapterId, true) | |
| 138 | + if not relayData then return 6 end -- 不是中继层 | |
| 127 | 139 | if layer ~= 1 then |
| 128 | - local relayData = role:getAdvData():isHaveRelay(layer, chapterId) | |
| 129 | - if not relayData then return 6 end -- 不是中继层 | |
| 130 | - 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 -- 没有开放 | |
| 131 | 142 | end |
| 132 | - end | |
| 133 | - | |
| 134 | - if not checkFormat(role) then return 7 end | |
| 135 | - | |
| 136 | - --local advTeam = role:getProperty("advTeam") | |
| 137 | - --table.clear(advTeam) | |
| 143 | + if not role:checkAdvCount(relayData.supply) then return 2 end -- 是否有体力 | |
| 144 | + -- 关卡开放判断 | |
| 145 | + if not role:advChapterIsOpen(chapterId) then return 5 end | |
| 138 | 146 | |
| 139 | - --advTeam.heros = {} | |
| 140 | - --for slot, heroId in pairs(format.heros) do | |
| 141 | - -- advTeam.heros[slot] = heroId | |
| 142 | - --end | |
| 143 | - --advTeam.leader = format.leader | |
| 144 | - --advTeam.leader2 = format.leader2 | |
| 145 | - --role:updateProperty({field = "advTeam", value = advTeam}) | |
| 146 | - if AdvCommon.isEndless(chapterId) then | |
| 147 | - role.dailyData:updateProperty({field = "advElC", delta = 1}) | |
| 148 | - else | |
| 149 | - role:changeAdvCount(chapterData.limitlevel) | |
| 147 | + role:changeAdvCount(relayData.supply) | |
| 150 | 148 | end |
| 151 | - | |
| 149 | + | |
| 152 | 150 | local support = {} -- 支援效果 |
| 153 | 151 | if AdvCommon.isEndless(chapterId) then |
| 154 | 152 | -- 选择的支援效果 |
| ... | ... | @@ -168,6 +166,7 @@ function _M.startAdvRpc( agent, data ) |
| 168 | 166 | end |
| 169 | 167 | end |
| 170 | 168 | end |
| 169 | + | |
| 171 | 170 | role:getAdvData():initByChapter({ |
| 172 | 171 | chapterId = chapterId, |
| 173 | 172 | level = layer, |
| ... | ... | @@ -175,6 +174,7 @@ function _M.startAdvRpc( agent, data ) |
| 175 | 174 | isEnter = true, |
| 176 | 175 | support = support, |
| 177 | 176 | }) |
| 177 | + | |
| 178 | 178 | role:checkTaskEnter("AdvStart", {id = chapterId}) |
| 179 | 179 | role:checkTaskEnter("AdvStartSelf", {id = chapterId}) |
| 180 | 180 | role:getAdvData():popBackEvents() -- 清一下事件 |
| ... | ... | @@ -192,7 +192,7 @@ function _M.startHangRpc(agent, data) |
| 192 | 192 | local format = msg.format --编队 |
| 193 | 193 | local index = msg.index or 1--时间索引id |
| 194 | 194 | |
| 195 | - local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] | |
| 195 | + local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] | |
| 196 | 196 | if not chapterData then return 1 end |
| 197 | 197 | local campSiteData = chapterData[campId] |
| 198 | 198 | if not campSiteData then return 1 end |
| ... | ... | @@ -214,7 +214,7 @@ function _M.startHangRpc(agent, data) |
| 214 | 214 | if AdvCommon.isEndless(chapterId) then return 5 end -- 无尽没有代理 |
| 215 | 215 | |
| 216 | 216 | local advRelay = role:getProperty("advRelay") |
| 217 | - if not next(advRelay[chapterId] or {}) then return 6 end -- 没有开放 | |
| 217 | + if not (advRelay[chapterId] or {})[campSiteData.floor] then return 6 end -- 没有开放 | |
| 218 | 218 | |
| 219 | 219 | |
| 220 | 220 | if not role:checkAdvCount(adv_idle_energy) then return 7 end -- 是否有体力 |
| ... | ... | @@ -236,7 +236,8 @@ function _M.startHangRpc(agent, data) |
| 236 | 236 | + 0.226 * player["hit"] |
| 237 | 237 | + 0.26 * player["miss"] |
| 238 | 238 | |
| 239 | - 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 -- 战斗力是否满足 | |
| 240 | 241 | |
| 241 | 242 | local info = {} |
| 242 | 243 | info.format = {} |
| ... | ... | @@ -962,6 +963,9 @@ function _M.roleFormatRpc(agent , data) |
| 962 | 963 | local index = msg.index -- 阵容索引 |
| 963 | 964 | local title = msg.title -- 阵容名称 |
| 964 | 965 | local team = {} |
| 966 | + | |
| 967 | + if role:getAdvData():isRunning() then return 3 end | |
| 968 | + | |
| 965 | 969 | for slot, heroId in pairs(msg.heros) do |
| 966 | 970 | if not role.heros[heroId] then |
| 967 | 971 | return 1 |
| ... | ... | @@ -1004,6 +1008,9 @@ function _M.selectTeamRpc(agent, data) |
| 1004 | 1008 | local role = agent.role |
| 1005 | 1009 | local msg = MsgPack.unpack(data) |
| 1006 | 1010 | local index = msg.index -- 阵容索引 |
| 1011 | + | |
| 1012 | + if role:getAdvData():isRunning() then return 1 end | |
| 1013 | + | |
| 1007 | 1014 | local team = role:getAdvTeamFormat(index) |
| 1008 | 1015 | if not next(team) then return end |
| 1009 | 1016 | team["index"] = index | ... | ... |
src/actions/CarAction.lua
| ... | ... | @@ -129,8 +129,8 @@ function _M.runeUpRpc( agent, data ) |
| 129 | 129 | local runeData = runeSet[id] |
| 130 | 130 | if not runeData then return 5 end |
| 131 | 131 | |
| 132 | - local maxLv = #csvdb["rune_buildCsv"] | |
| 133 | - if level >= maxLv then return 6 end | |
| 132 | + --local maxLv = #csvdb["rune_buildCsv"] | |
| 133 | + if level >= runeData.lvLimit then return 6 end | |
| 134 | 134 | local lvData = csvdb["rune_buildCsv"][level] |
| 135 | 135 | local cost = lvData.cost:toNumMap() |
| 136 | 136 | if not role:checkItemEnough(cost) then | ... | ... |
src/actions/DinerAction.lua
| ... | ... | @@ -305,7 +305,7 @@ function _M.expediteSellRpc( agent, data ) |
| 305 | 305 | local gift = reward:toNumMap() |
| 306 | 306 | |
| 307 | 307 | -- 特权卡获取加速获得额外道具 |
| 308 | - local coef = role.storeData:getProduceItemSpeedCoef() | |
| 308 | + local coef = 1 --role.storeData:getProduceItemSpeedCoef() | |
| 309 | 309 | for k, v in pairs(gift) do |
| 310 | 310 | if coef > 1 then |
| 311 | 311 | v = math.floor(v * coef) | ... | ... |
src/actions/EmailAction.lua
| ... | ... | @@ -40,10 +40,17 @@ function _M.listRpc(agent, data) |
| 40 | 40 | local count = 1 |
| 41 | 41 | for _, data in ipairs(result) do |
| 42 | 42 | local email = tarr2tab(data) |
| 43 | - if tonum(email.createtime) > role:getProperty("ctime") | |
| 44 | - and ( not email.mid or tonum(email.mid) == mid ) | |
| 43 | + -- 0 需要判斷創角時間小於郵件創建時間 1 只需要在時間段內登陸即可領取 | |
| 44 | + local delayType = tonum(email.delayType) | |
| 45 | + local flag = false | |
| 46 | + if delayType == 1 then | |
| 47 | + flag = skynet.timex() > tonum(email.createtime) | |
| 48 | + else | |
| 49 | + flag = tonum(email.createtime) > role:getProperty("ctime") | |
| 50 | + end | |
| 51 | + if flag and ( not email.mid or tonum(email.mid) == mid ) | |
| 45 | 52 | and ( not email.endtime or tonum(email.endtime) > now )then |
| 46 | - local time = math.max(tonum(email.timestamp, 0) or email.createtime) | |
| 53 | + local time = math.max(tonum(email.timestamp, 0) , tonum(email.createtime)) | |
| 47 | 54 | redisproxy:insertEmail({ |
| 48 | 55 | roleId = roleId, |
| 49 | 56 | emailId = 0, | ... | ... |
src/actions/GmAction.lua
| ... | ... | @@ -36,26 +36,15 @@ function _M.ban(role, pms) |
| 36 | 36 | local time = tonum(pms.pm1, 1) |
| 37 | 37 | local ctype = tonum(pms.pm2, 0) |
| 38 | 38 | |
| 39 | - local isBan = role:getProperty("banTime") <= now | |
| 40 | 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 | 40 | role:mylog("gm_action", {desc = "ban", int1 = time, int2 = ctype, key1 = pms.sender}) |
| 52 | - | |
| 53 | - return isBan and "解封杀成功" or "封杀成功" | |
| 41 | + return "封杀成功" | |
| 54 | 42 | end |
| 55 | 43 | |
| 44 | + | |
| 56 | 45 | function _M.unban(role, pms) |
| 57 | 46 | role:setBan(0, 0) |
| 58 | - | |
| 47 | + role:setProperty("cheatCount", 0) -- 清除作弊次数 | |
| 59 | 48 | role:mylog("gm_action", {desc = "unban", key1 = pms.sender}) |
| 60 | 49 | |
| 61 | 50 | return "解封杀成功" |
| ... | ... | @@ -63,18 +52,17 @@ end |
| 63 | 52 | |
| 64 | 53 | function _M.gmmsg(role, pms) |
| 65 | 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 | 55 | role:mylog("gm_action", {desc = "gmmsg", text1 = pms.pm1, key1 = pms.sender}) |
| 74 | - | |
| 75 | 56 | return "指令成功" |
| 76 | 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 | 66 | function _M.silent(role, pms) |
| 79 | 67 | local pm1 = tonum(pms.pm1) |
| 80 | 68 | if pm1 < 1 then | ... | ... |
src/actions/HangAction.lua
| ... | ... | @@ -235,6 +235,16 @@ function _M.endBattleRpc(agent, data) |
| 235 | 235 | return 4 |
| 236 | 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 | 248 | local reward, change |
| 239 | 249 | if isWin then --win |
| 240 | 250 | role:hangFinish(carbonId) |
| ... | ... | @@ -607,6 +617,18 @@ function _M.endBonusBattleRpc(agent, data) |
| 607 | 617 | SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({errorCode = 1})) |
| 608 | 618 | return true |
| 609 | 619 | end |
| 620 | + role.__bonusBattleCache = nil | |
| 621 | + | |
| 622 | + -- 防作弊 | |
| 623 | + if not role:checkBattleCheat("bonus", { | |
| 624 | + id = id, | |
| 625 | + isWin = starNum and starNum > 0, | |
| 626 | + info = msg.info | |
| 627 | + }) then | |
| 628 | + SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({errorCode = 1})) | |
| 629 | + return true | |
| 630 | + end | |
| 631 | + | |
| 610 | 632 | local bonusData = csvdb["bonus_battleCsv"][id] |
| 611 | 633 | |
| 612 | 634 | local reward, change = {} | ... | ... |
src/actions/HeroAction.lua
| ... | ... | @@ -663,7 +663,8 @@ function _M.getResetRewardRpc(agent, data) |
| 663 | 663 | |
| 664 | 664 | while stage > 0 do |
| 665 | 665 | local curData = csvdb["unit_talent_"..heroCfgId.."Csv"][stage] |
| 666 | - for lvl = 1, curTalentLvl - 1 do | |
| 666 | + local offset = stage == talent:getv(0,1) and curTalentLvl - 1 or #curData | |
| 667 | + for lvl = 1, offset do | |
| 667 | 668 | local talentData = curData[lvl] |
| 668 | 669 | for itemId, count in pairs(talentData.money:toNumMap()) do |
| 669 | 670 | reward[itemId] = (reward[itemId] or 0) + count |
| ... | ... | @@ -853,6 +854,10 @@ function _M.drawHeroRpc(agent, data) |
| 853 | 854 | elseif values[1] == HeroQuality.SSR then |
| 854 | 855 | weight = unitPool["up_ssr_weight"] |
| 855 | 856 | up_pool = unitPool["up_ssr_id"] |
| 857 | + if btype == 5 then | |
| 858 | + local wishPool = role:getProperty("wishPool") or {} | |
| 859 | + weight = weight * #wishPool | |
| 860 | + end | |
| 856 | 861 | end |
| 857 | 862 | --print(poolId, rand_v, weight, up_pool, values[1]) |
| 858 | 863 | if rand_v < weight and up_pool then |
| ... | ... | @@ -879,6 +884,15 @@ function _M.drawHeroRpc(agent, data) |
| 879 | 884 | if heroData[field] ~= values[idx] then ok = false break end |
| 880 | 885 | end |
| 881 | 886 | end |
| 887 | + -- 随机剔除up池中的角色 | |
| 888 | + if up_pool then | |
| 889 | + for k, v in ipairs(up_pool) do | |
| 890 | + if v == itemData.id then | |
| 891 | + ok = false | |
| 892 | + break | |
| 893 | + end | |
| 894 | + end | |
| 895 | + end | |
| 882 | 896 | if not ok then break end |
| 883 | 897 | if oneData[pool_str] > 0 then |
| 884 | 898 | resultPool[itemId] = {oneData[pool_str]} -- itemId, count, 概率 |
| ... | ... | @@ -913,6 +927,7 @@ function _M.drawHeroRpc(agent, data) |
| 913 | 927 | local itemId = math.randWeight(resultPool, 1) |
| 914 | 928 | if guideHero then |
| 915 | 929 | itemId = guideHero |
| 930 | + guideHero = nil | |
| 916 | 931 | end |
| 917 | 932 | |
| 918 | 933 | local itemData = csvdb["itemCsv"][itemId] | ... | ... |
src/actions/PvpAction.lua
| ... | ... | @@ -372,6 +372,16 @@ function _M.endBattleRpc(agent, data) |
| 372 | 372 | |
| 373 | 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 | 385 | local temp = string.randWeight(csvdb["player_expCsv"][role:getProperty("level")].pvpBonus, true) |
| 376 | 386 | local reward, change = role:award({[temp[1]] = temp[2]}, {log = {desc = "pvpBattleC"}}) |
| 377 | 387 | local myScore, matchScore, oldmyScore, oldMatchScore, myRank, oldMyRank = 0, 0, 0, 0, -1, -1 |
| ... | ... | @@ -652,13 +662,22 @@ function _M.endBattleHRpc(agent, data) |
| 652 | 662 | end |
| 653 | 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 | 675 | if winCount >= 2 then |
| 656 | 676 | isWin = true |
| 657 | 677 | elseif loseCount >= 2 then |
| 658 | 678 | isWin = false |
| 659 | 679 | else -- 没结束 |
| 660 | 680 | -- 返回继续战斗 |
| 661 | - | |
| 662 | 681 | local key = tostring(math.random()) |
| 663 | 682 | _pvpStartBattleCacheH.key = key |
| 664 | 683 | local round = #_pvpStartBattleCacheH.result + 1 | ... | ... |
src/actions/RadioAction.lua
| ... | ... | @@ -101,7 +101,26 @@ function _M.startQuestRpc(agent, data) |
| 101 | 101 | radioTask[id] = taskData |
| 102 | 102 | role:updateProperty({field="radioTask", value=radioTask, notNotify=true}) |
| 103 | 103 | |
| 104 | - SendPacket(actionCodes.Radio_startQuestRpc, MsgPack.pack({id=id, task=taskData})) | |
| 104 | + SendPacket(actionCodes.Radio_startQuestRpc, MsgPack.pack({id=id, task=taskData})) | |
| 105 | + | |
| 106 | + local herolist = {} | |
| 107 | + for _, heroId in ipairs(heros) do | |
| 108 | + local hero = role.heros[heroId] | |
| 109 | + if hero then | |
| 110 | + table.insert(herolist, hero:getProperty("type")) | |
| 111 | + end | |
| 112 | + end | |
| 113 | + | |
| 114 | + -- 讨伐行动 | |
| 115 | + role:log("punitive_action", { | |
| 116 | + mission_id = id, --关卡ID | |
| 117 | + mission_herolist = herolist, -- 英雄ID,排序以玩家出战设置为准,示例:[111, 222, 333, 444, 555] | |
| 118 | + mission_success_rate = 0, -- 大成功几率 | |
| 119 | + mission_reward = {}, -- 获得奖励,建议使用json格式记录。示例:{ itemid1: 1, itemid2: 3, itemid3: 5} | |
| 120 | + mission_result = 0, -- 战斗结果(0-无效,1-胜利,2-失败) | |
| 121 | + mission_roundtime = 0, -- 完成耗时(秒) | |
| 122 | + mission_cleartype = 1, -- 1-开始; 2-完成(领取奖励时) | |
| 123 | + }) | |
| 105 | 124 | return true |
| 106 | 125 | end |
| 107 | 126 | |
| ... | ... | @@ -176,7 +195,8 @@ function _M.finishQuestRpc(agent, data) |
| 176 | 195 | mission_success_rate = totalCoef, -- 大成功几率 |
| 177 | 196 | mission_reward = r, -- 获得奖励,建议使用json格式记录。示例:{ itemid1: 1, itemid2: 3, itemid3: 5} |
| 178 | 197 | mission_result = 1, -- 战斗结果(0-无效,1-胜利,2-失败) |
| 179 | - mission_roundtime = config.time, -- 完成耗时(秒) | |
| 198 | + mission_roundtime = config.time, -- 完成耗时(秒) | |
| 199 | + mission_cleartype = 2, -- 1-开始; 2-完成(领取奖励时) | |
| 180 | 200 | }) |
| 181 | 201 | |
| 182 | 202 | return true | ... | ... |
src/actions/RoleAction.lua
| ... | ... | @@ -586,9 +586,9 @@ function _M.openTimeBoxRpc(agent, data) |
| 586 | 586 | else |
| 587 | 587 | local oldId, process, time = boxL[slot].id, boxL[slot].process, boxL[slot].time |
| 588 | 588 | local unitTime = globalCsv.box_key_time[oldId] * 60 |
| 589 | - local doneCnt = math.floor((process + skynet.timex() - time) / unitTime) | |
| 589 | + local doneCnt = time == 0 and 0 or math.floor((process + skynet.timex() - time) / unitTime) | |
| 590 | 590 | if doneCnt > 0 then |
| 591 | - reward = role:award({[oldId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot}}) | |
| 591 | + reward = role:award({[oldId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}}) | |
| 592 | 592 | end |
| 593 | 593 | end |
| 594 | 594 | local limit = globalCsv.box_key_max[itemId] or 5 |
| ... | ... | @@ -610,7 +610,7 @@ function _M.openTimeBoxRpc(agent, data) |
| 610 | 610 | local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") |
| 611 | 611 | local costKey = math.ceil((stopTime - nowTime) / (cost_pre[1] * 60)) * cost_pre[2] |
| 612 | 612 | if not role:checkItemEnough({[ItemId.Diamond] = costKey}) then return 5 end |
| 613 | - role:costItems({[ItemId.Diamond] = costKey}, {log = {desc = "openTimeBox", int1 = slot}}) | |
| 613 | + role:costItems({[ItemId.Diamond] = costKey}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}}) | |
| 614 | 614 | else |
| 615 | 615 | stopTime = math.min(nowTime,time + globalCsv.box_productLine_time * 3600) |
| 616 | 616 | end |
| ... | ... | @@ -618,7 +618,7 @@ function _M.openTimeBoxRpc(agent, data) |
| 618 | 618 | |
| 619 | 619 | local doneCnt = math.floor((process + stopTime - time) / unitTime) |
| 620 | 620 | if doneCnt > 0 then |
| 621 | - reward = role:award({[itemId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot}}) | |
| 621 | + reward = role:award({[itemId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}}) | |
| 622 | 622 | end |
| 623 | 623 | if role:getItemCount(itemId) >= globalCsv.box_key_max[itemId] then |
| 624 | 624 | nowTime = 0 |
| ... | ... | @@ -640,6 +640,7 @@ function _M.openTimeBoxRpc(agent, data) |
| 640 | 640 | end |
| 641 | 641 | |
| 642 | 642 | if role:getItemCount(costId) < count then return 8 end |
| 643 | + if not role:checkItemEnough(costs) then return 9 end | |
| 643 | 644 | |
| 644 | 645 | role:costItems({[costId] = count}, {log = {desc = "openTimeBox"}}) |
| 645 | 646 | |
| ... | ... | @@ -686,7 +687,7 @@ function _M.openTimeBoxRpc(agent, data) |
| 686 | 687 | reward[id] = (reward[id] or 0) + num |
| 687 | 688 | end |
| 688 | 689 | end |
| 689 | - reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = costId}}) | |
| 690 | + reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = costId, int2 = oper}}) | |
| 690 | 691 | else |
| 691 | 692 | return |
| 692 | 693 | end |
| ... | ... | @@ -1012,6 +1013,10 @@ function _M.chatRpc(agent, data) |
| 1012 | 1013 | result = 1 |
| 1013 | 1014 | return |
| 1014 | 1015 | end |
| 1016 | + if role:getProperty("level") < (globalCsv.chat_level or 15) then | |
| 1017 | + result = 3 | |
| 1018 | + return | |
| 1019 | + end | |
| 1015 | 1020 | |
| 1016 | 1021 | role._worldChatLimit = role._worldChatLimit or {start = 0, count = 0, canSayt = 0} --第一次开始说话时间 从第一次说话次数 能说话的时间 |
| 1017 | 1022 | ... | ... |
src/actions/StoreAction.lua
| ... | ... | @@ -232,6 +232,13 @@ function _M.getFreeChestRpc(agent, data) |
| 232 | 232 | local config = csvdb["shop_rechargeCsv"][id] |
| 233 | 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 | 242 | local rechargeRecord = role.storeData:getProperty("payR") |
| 236 | 243 | local getCount = (rechargeRecord[id] or 0) |
| 237 | 244 | if getCount >= config.limit then | ... | ... |
src/actions/TowerAction.lua
| ... | ... | @@ -65,6 +65,15 @@ function _M.endBattleRpc(agent, data) |
| 65 | 65 | local curTower = csvdb["tower_battleCsv"][id] |
| 66 | 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 | 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 | 61 | self:initBattle(advInfo) |
| 62 | 62 | end |
| 63 | 63 | -- 找出level 是否存在中继层 |
| 64 | -function Adv:isHaveRelay(level, chapterId) | |
| 64 | +function Adv:isHaveRelay(level, chapterId, force) | |
| 65 | 65 | level = level or self.level |
| 66 | 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 | 69 | local campsiteCsv = csvdb["adv_chapter_campsiteCsv"][chapterId] |
| 70 | 70 | for _, campsite in ipairs(campsiteCsv) do |
| ... | ... | @@ -140,12 +140,8 @@ function Adv:initByChapter(params) |
| 140 | 140 | local chapter = self:isEndless() and -1 or self.chapterId |
| 141 | 141 | if not (advRelay[chapter] or {})[self.level] then |
| 142 | 142 | isNewRelay = true |
| 143 | - advRelay[chapter] = advRelay[chapter] or {} | |
| 144 | - advRelay[chapter][self.level] = 1 | |
| 145 | - self.owner:updateProperty({field = "advRelay", value = advRelay}) | |
| 146 | 143 | end |
| 147 | 144 | end |
| 148 | - | |
| 149 | 145 | self.maps = {} |
| 150 | 146 | self.maps[1] = AdvMap.new(self, 1, mapId, isEnter, isNewRelay) |
| 151 | 147 | |
| ... | ... | @@ -153,8 +149,6 @@ function Adv:initByChapter(params) |
| 153 | 149 | |
| 154 | 150 | self:initLayerTask() |
| 155 | 151 | |
| 156 | - | |
| 157 | - | |
| 158 | 152 | self:checkTask(Adv.TaskType.Arrive) |
| 159 | 153 | self:checkAdvUnlock(1, self.level) |
| 160 | 154 | |
| ... | ... | @@ -168,6 +162,20 @@ function Adv:initByChapter(params) |
| 168 | 162 | end |
| 169 | 163 | end |
| 170 | 164 | |
| 165 | +function Adv:passAdvRelay() | |
| 166 | + local advRelay = self.owner:getProperty("advRelay") | |
| 167 | + local chapter = self:isEndless() and -1 or self.chapterId | |
| 168 | + if not (advRelay[chapter] or {})[self.level] then | |
| 169 | + advRelay[chapter] = advRelay[chapter] or {} | |
| 170 | + advRelay[chapter][self.level] = 1 | |
| 171 | + self.owner:updateProperty({field = "advRelay", value = advRelay}) | |
| 172 | + local relayData = self:isHaveRelay() | |
| 173 | + if relayData and relayData.award ~= "" then | |
| 174 | + self:pushBackEvent(AdvBackEventType.RelayReward, {items = self:award(relayData.award:toNumMap(), {log = {desc = "relayReward"}})}) | |
| 175 | + end | |
| 176 | + end | |
| 177 | +end | |
| 178 | + | |
| 171 | 179 | function Adv:clear() |
| 172 | 180 | self.chapterId = nil |
| 173 | 181 | self.level = nil |
| ... | ... | @@ -400,7 +408,7 @@ function Adv:forceOver(notNotify) |
| 400 | 408 | for itemId, count in pairs(reward) do |
| 401 | 409 | reward[itemId] = math.ceil(count * globalCsv.adv_fail_reward_ratio / 100) -- 奖励相当于失败 |
| 402 | 410 | end |
| 403 | - self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) | |
| 411 | + self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}, notNotify = notNotify}) | |
| 404 | 412 | |
| 405 | 413 | self:clear() |
| 406 | 414 | self.owner:updateProperties({ |
| ... | ... | @@ -811,28 +819,29 @@ function Adv:over(success, rewardRatio, overType) |
| 811 | 819 | if not self:isEndless() and self.level >= chapterData.limitlevel then |
| 812 | 820 | self.owner:checkTaskEnter("AdvAllPass", {id = self.chapterId}) |
| 813 | 821 | end |
| 822 | + end | |
| 814 | 823 | |
| 815 | - local roleId = self.owner:getProperty("id") | |
| 816 | - local oldMaxScore = tonum(redisproxy:zscore(self.owner:getAdvRankKey(), roleId)) | |
| 817 | - if score > oldMaxScore then | |
| 818 | - local team = self.owner:getProperty("advTeam") | |
| 819 | - local curInfo = { | |
| 820 | - name = self.owner:getProperty("name"), | |
| 821 | - headId = self.owner:getProperty("headId"), | |
| 822 | - lv = self.owner:getProperty("level"), | |
| 823 | - batteV = self.owner:getTeamBattleValue(team.heros), | |
| 824 | - chapter = self.chapterId, | |
| 825 | - format = self.owner:getTeamHerosInfo(team).heros, | |
| 826 | - } | |
| 827 | - redisproxy:pipelining(function (red) | |
| 828 | - red:zadd(self.owner:getAdvRankKey(), score, roleId) --更新分数 | |
| 829 | - red:hset(RANK_ADV_INFO, roleId, MsgPack.pack(curInfo)) | |
| 830 | - end) | |
| 831 | - end | |
| 832 | - -- 通关的时候要把引导步骤设定到成就引导 | |
| 833 | - if not self.owner:checkOverGuide(57) then | |
| 834 | - self.owner:saveGuide(57,1,true) | |
| 835 | - end | |
| 824 | + local roleId = self.owner:getProperty("id") | |
| 825 | + local oldMaxScore = tonum(redisproxy:zscore(self.owner:getAdvRankKey(), roleId)) | |
| 826 | + if score > oldMaxScore then | |
| 827 | + local team = self.owner:getProperty("advTeam") | |
| 828 | + local curInfo = { | |
| 829 | + name = self.owner:getProperty("name"), | |
| 830 | + headId = self.owner:getProperty("headId"), | |
| 831 | + lv = self.owner:getProperty("level"), | |
| 832 | + batteV = self.owner:getTeamBattleValue(team.heros), | |
| 833 | + chapter = self.chapterId, | |
| 834 | + format = self.owner:getTeamHerosInfo(team).heros, | |
| 835 | + } | |
| 836 | + redisproxy:pipelining(function (red) | |
| 837 | + red:zadd(self.owner:getAdvRankKey(), score, roleId) --更新分数 | |
| 838 | + red:hset(RANK_ADV_INFO, roleId, MsgPack.pack(curInfo)) | |
| 839 | + end) | |
| 840 | + end | |
| 841 | + | |
| 842 | + -- 通关的时候要把引导步骤设定到成就引导 | |
| 843 | + if not self.owner:checkOverGuide(57) then | |
| 844 | + self.owner:saveGuide(57,1,true) | |
| 836 | 845 | end |
| 837 | 846 | self:clearAdvUnlockCache() |
| 838 | 847 | |
| ... | ... | @@ -963,7 +972,7 @@ function Adv:award(gift, params, backRewardParams) |
| 963 | 972 | |
| 964 | 973 | local autoUse = {} |
| 965 | 974 | for itemId, count in pairs(tgift) do |
| 966 | - if count > 0 then | |
| 975 | + if count > 0 and self.battle.player then | |
| 967 | 976 | local buffAdd = self.battle.player:getRewardChange(itemId) |
| 968 | 977 | count = math.floor(math.max(0, (count + buffAdd[0]) * (1 + buffAdd[1]))) --附加 buff 的影响 |
| 969 | 978 | self:checkTask(Adv.TaskType.Item, count, itemId) |
| ... | ... | @@ -1112,6 +1121,11 @@ local function clickOut(self, room, block, params, isExit) |
| 1112 | 1121 | else |
| 1113 | 1122 | if self.level > (advPass[self.chapterId] or 0) then |
| 1114 | 1123 | self.owner:changeUpdates({{type = "advPass", field = self.chapterId, value = self.level}}) |
| 1124 | + | |
| 1125 | + if (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel) then --关卡结束 | |
| 1126 | + self.owner:checkTaskEnter("AdvPassFirst", {id = self.chapterId}) | |
| 1127 | + end | |
| 1128 | + | |
| 1115 | 1129 | end |
| 1116 | 1130 | end |
| 1117 | 1131 | |
| ... | ... | @@ -1124,6 +1138,7 @@ local function clickOut(self, room, block, params, isExit) |
| 1124 | 1138 | end |
| 1125 | 1139 | |
| 1126 | 1140 | if not self:isEndless() and (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel) then --关卡结束 |
| 1141 | + self:passAdvRelay() | |
| 1127 | 1142 | self:over(true) |
| 1128 | 1143 | else |
| 1129 | 1144 | self.battle.player:triggerPassive(Passive.DOWN_LAYER) |
| ... | ... | @@ -1675,12 +1690,6 @@ function Adv:clickBlock(roomId, blockId, params) |
| 1675 | 1690 | if not block.isOpen then |
| 1676 | 1691 | if self.isRelay or checkAroundBlocks() then --开放 |
| 1677 | 1692 | self:getCurMap():openBlock(roomId, blockId, true, true) |
| 1678 | - if self.isRelay and self:getCurMap():isAllOpen() then -- 发放翻开的奖励 | |
| 1679 | - local relayData = self:isHaveRelay() | |
| 1680 | - if relayData and relayData.award ~= "" then | |
| 1681 | - self:pushBackEvent(AdvBackEventType.RelayReward, {items = self:award(relayData.award:toNumMap(), {log = {desc = "relayReward"}})}) | |
| 1682 | - end | |
| 1683 | - end | |
| 1684 | 1693 | status = true |
| 1685 | 1694 | end |
| 1686 | 1695 | else | ... | ... |
src/adv/AdvBlock.lua
| ... | ... | @@ -60,9 +60,9 @@ function Block:updateEvent(event, isInit) |
| 60 | 60 | end |
| 61 | 61 | self:randomEvent() |
| 62 | 62 | end |
| 63 | - self:quickDrop() | |
| 64 | 63 | |
| 65 | 64 | if not isInit and self.isOpen then |
| 65 | + self:quickDrop() | |
| 66 | 66 | local newet = self:getEventType() |
| 67 | 67 | if oldet ~= newet then |
| 68 | 68 | local em = {} | ... | ... |
src/adv/AdvMap.lua
| ... | ... | @@ -272,6 +272,10 @@ function Map:openBlock(roomId, blockId, isPlayer, ignoreBack) |
| 272 | 272 | if not ignoreBack then |
| 273 | 273 | self.adv:backBlockChange(roomId, blockId) |
| 274 | 274 | end |
| 275 | + | |
| 276 | + if self.adv.isRelay and self:isAllOpen() then -- 发放翻开的奖励 | |
| 277 | + self.adv:passAdvRelay() | |
| 278 | + end | |
| 275 | 279 | end |
| 276 | 280 | return status |
| 277 | 281 | end | ... | ... |
src/adv/AdvPassive.lua
| ... | ... | @@ -532,7 +532,7 @@ function Passive:effect8(dropId) |
| 532 | 532 | end |
| 533 | 533 | |
| 534 | 534 | --9=直接获得item(可在结算触发时使用) |
| 535 | -function Passive:effect9(itemId, triggerPms, ratio, max) | |
| 535 | +function Passive:effect9(itemId, triggerPms, ratio, ratio2, max) | |
| 536 | 536 | local cond = nil |
| 537 | 537 | if self.passiveData.value == 0 then |
| 538 | 538 | cond = triggerPms.score |
| ... | ... | @@ -542,7 +542,7 @@ function Passive:effect9(itemId, triggerPms, ratio, max) |
| 542 | 542 | return |
| 543 | 543 | end |
| 544 | 544 | if not cond then return end |
| 545 | - self.owner.battle.adv:award({[itemId] = math.floor(math.max(0, math.min(max, cond / ratio)))}, {log = {desc = "passive", int1 = self.id}}, {roomId = self.owner.roomId, blockId = self.owner.blockId}) | |
| 545 | + self.owner.battle.adv:award({[itemId] = math.floor(math.max(0, math.min(max, cond / ratio * ratio2)))}, {log = {desc = "passive", int1 = self.id}}, {roomId = self.owner.roomId, blockId = self.owner.blockId}) | |
| 546 | 546 | end |
| 547 | 547 | |
| 548 | 548 | --10=战斗额外掉落次数 | ... | ... |
src/models/Activity.lua
| ... | ... | @@ -91,6 +91,7 @@ function Activity:data() |
| 91 | 91 | act18 = self:getProperty("act18"), |
| 92 | 92 | act19 = self:getProperty("act19"), |
| 93 | 93 | act20 = self:getProperty("act20"), |
| 94 | + act24 = self:getProperty("act24"), | |
| 94 | 95 | act26 = self:getProperty("act26"), |
| 95 | 96 | } |
| 96 | 97 | end |
| ... | ... | @@ -277,38 +278,56 @@ function Activity:checkWeeklyAct(actType, notify, count, pool) |
| 277 | 278 | local totalCnt = 0 |
| 278 | 279 | local finishCnt = 0 |
| 279 | 280 | local maxCondition = 0 |
| 280 | - for k, cfg in pairs(csvdb[info.table] or {}) do | |
| 281 | - totalCnt = totalCnt + 1 | |
| 282 | - if maxCondition < cfg.condition1 then | |
| 283 | - maxCondition = cfg.condition1 | |
| 284 | - end | |
| 285 | - if not curData[cfg.id] and curData[0] >= cfg.condition1 then | |
| 286 | - if info.mailId then | |
| 281 | + local flag = true | |
| 282 | + while flag do | |
| 283 | + --print("tatal number :", curData[0]) | |
| 284 | + for i = 1, #csvdb[info.table] do | |
| 285 | + local cfg = csvdb[info.table][i] | |
| 286 | + --for k, cfg in pairs(csvdb[info.table] or {}) do | |
| 287 | + totalCnt = totalCnt + 1 | |
| 288 | + if maxCondition < cfg.condition1 then | |
| 289 | + maxCondition = cfg.condition1 | |
| 290 | + end | |
| 291 | + --print("cur condition", cfg.condition1) | |
| 292 | + if curData[0] < cfg.condition1 then | |
| 293 | + flag = false | |
| 294 | + break | |
| 295 | + end | |
| 296 | + | |
| 297 | + --print(curData[0], cfg.condition1) | |
| 298 | + if not curData[cfg.id] and curData[0] >= cfg.condition1 then | |
| 299 | + if info.mailId then | |
| 287 | 300 | |
| 288 | - self.owner:log("activity", { | |
| 289 | - activity_id = cfg.id, -- 活动ID(或活动指定任务的ID) | |
| 290 | - activity_type = actType, -- 活动类型,见活动类型枚举表 | |
| 291 | - activity_reward = cfg.reward:toNumMap(), -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | |
| 292 | - }) | |
| 301 | + self.owner:log("activity", { | |
| 302 | + activity_id = cfg.id, -- 活动ID(或活动指定任务的ID) | |
| 303 | + activity_type = actType, -- 活动类型,见活动类型枚举表 | |
| 304 | + activity_reward = cfg.reward:toNumMap(), -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | |
| 305 | + }) | |
| 293 | 306 | |
| 294 | - self.owner:sendMail(info.mailId, nil, cfg.reward, {cfg.condition1}) | |
| 295 | - curData[cfg.id] = 1 | |
| 307 | + self.owner:sendMail(info.mailId, nil, cfg.reward, {cfg.condition1}) | |
| 308 | + curData[cfg.id] = 1 | |
| 309 | + end | |
| 310 | + end | |
| 311 | + if curData[cfg.id] then | |
| 312 | + finishCnt = finishCnt + 1 | |
| 296 | 313 | end |
| 297 | 314 | end |
| 298 | - if curData[cfg.id] then | |
| 299 | - finishCnt = finishCnt + 1 | |
| 300 | - end | |
| 301 | - end | |
| 302 | - if totalCnt == finishCnt then | |
| 303 | - roundData[actType] = curRound + 1 | |
| 304 | - for k,v in pairs(curData) do | |
| 305 | - if k == 0 then | |
| 306 | - curData[k] = curData[0] >= maxCondition and curData[0] - maxCondition or 0 | |
| 307 | - else | |
| 308 | - curData[k] = nil | |
| 315 | + if totalCnt == finishCnt then | |
| 316 | + roundData[actType] = (roundData[actType] or 0) + 1 | |
| 317 | + for k,v in pairs(curData) do | |
| 318 | + if k == 0 then | |
| 319 | + curData[k] = curData[0] >= maxCondition and curData[0] - maxCondition or 0 | |
| 320 | + else | |
| 321 | + curData[k] = nil | |
| 322 | + end | |
| 309 | 323 | end |
| 324 | + --print("cur round ".. roundData[actType], ctrlData.condition) | |
| 325 | + if roundData[actType] >= ctrlData.condition then | |
| 326 | + curData[0] = maxCondition | |
| 327 | + flag = false | |
| 328 | + end | |
| 329 | + self:updateProperty({field = "round", value = roundData, notNotify = not notify}) | |
| 310 | 330 | end |
| 311 | - self:updateProperty({field = "round", value = roundData, notNotify = not notify}) | |
| 312 | 331 | end |
| 313 | 332 | self:updateActData(actType, curData, not notify) |
| 314 | 333 | end |
| ... | ... | @@ -463,6 +482,9 @@ activityFunc[Activity.ActivityType.Exchange] = { |
| 463 | 482 | actData[actId] = {} |
| 464 | 483 | self:updateActData(actType, actData, not notify) |
| 465 | 484 | end, |
| 485 | + ["login"] = function(self, actType, actId) | |
| 486 | + activityFunc[Activity.ActivityType.Exchange]["crossDay"](self, actType, true, actId) | |
| 487 | + end, | |
| 466 | 488 | ["crossDay"] = function(self, actType, notify, actId) |
| 467 | 489 | local actData = self:getActData(actType) or {} |
| 468 | 490 | local lastTs = actData["ts"] or 0 |
| ... | ... | @@ -471,14 +493,14 @@ activityFunc[Activity.ActivityType.Exchange] = { |
| 471 | 493 | if not cfg then return end |
| 472 | 494 | local refreshTimes = cfg.condition2:toArray(false, "=") |
| 473 | 495 | for i = 1, #refreshTimes do |
| 474 | - local rt = toUnixtime(refreshTimes[1]..string_format("%02x", RESET_TIME)) | |
| 496 | + local rt = toUnixtime(refreshTimes[i]..string_format("%02x", RESET_TIME)) | |
| 475 | 497 | if timeNow >= rt and rt > lastTs then |
| 476 | 498 | lastTs = rt |
| 477 | 499 | actData = {} |
| 478 | 500 | end |
| 479 | 501 | end |
| 480 | - if next(actData) then | |
| 481 | - actData["ts"] = lastTs | |
| 502 | + if not next(actData) then | |
| 503 | + actData["ts"] = timeNow | |
| 482 | 504 | self:updateActData(actType, actData, not notify) |
| 483 | 505 | end |
| 484 | 506 | end, |
| ... | ... | @@ -507,6 +529,12 @@ activityFunc[Activity.ActivityType.ActHeroPool] = { |
| 507 | 529 | local actData = self:getActData(actType) |
| 508 | 530 | local cfg = csvdb["activity_ctrlCsv"][actId] |
| 509 | 531 | if not cfg then return end |
| 532 | + -- 保底次数转换成万能碎片 | |
| 533 | + --local count = math.ceil(((actData[cfg.condition] or 0) / 100) * 60) | |
| 534 | + --if count > 0 then | |
| 535 | + -- local gift = {[723] = count} | |
| 536 | + -- self.owner:sendMail(MailId.ActivityPoolRet, nil, gift, {}) | |
| 537 | + --end | |
| 510 | 538 | actData[cfg.condition] = nil |
| 511 | 539 | self:updateActData(actType, actData, not notify) |
| 512 | 540 | end, |
| ... | ... | @@ -680,7 +708,7 @@ function Activity:recycleActItem(actId) |
| 680 | 708 | local itemCount = role:getItemCount(fromId) |
| 681 | 709 | if itemCount > 0 then |
| 682 | 710 | costs[fromId] = (costs[fromId] or 0) + itemCount |
| 683 | - gift[toId] = toNum * itemCount | |
| 711 | + gift[toId] = (gift[toId] or 0) + toNum * itemCount | |
| 684 | 712 | end |
| 685 | 713 | end |
| 686 | 714 | if next(costs) then | ... | ... |
src/models/HeroPlugin.lua
| ... | ... | @@ -53,22 +53,25 @@ function HeroPlugin.bind(Hero) |
| 53 | 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 | 71 | end |
| 71 | 72 | end |
| 73 | + else | |
| 74 | + break | |
| 72 | 75 | end |
| 73 | 76 | end |
| 74 | 77 | |
| ... | ... | @@ -85,7 +88,7 @@ function HeroPlugin.bind(Hero) |
| 85 | 88 | for lvl = 1, #faithConfig do |
| 86 | 89 | if faith >= faithConfig[lvl].exp then |
| 87 | 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 | 92 | end |
| 90 | 93 | end |
| 91 | 94 | for _, attrName in pairs(AttsEnumEx) do | ... | ... |
src/models/Role.lua
| ... | ... | @@ -53,10 +53,11 @@ Role.schema = { |
| 53 | 53 | banTime = {"number", 0}, |
| 54 | 54 | banType = {"number", 0}, |
| 55 | 55 | heartWarning = {"number", 0}, |
| 56 | + cheatCount = {"number", 0}, | |
| 56 | 57 | ltime = {"number", 0}, -- 最后登录时间 |
| 57 | 58 | ctime = {"number", skynet.timex()}, -- 创建时间 |
| 58 | 59 | ignoreMt = {"number", 0}, -- 忽略维护拦截 |
| 59 | - sversion = {"number", globalCsv.StructVersion or 0}, -- 重整数据版本 | |
| 60 | + sversion = {"number", STRUCT_VERSION or 0}, -- 重整数据版本 | |
| 60 | 61 | timeReset = {"table", {}}, --重置轮回记录 |
| 61 | 62 | diamond = {"number", 0}, |
| 62 | 63 | reDiamond = {"number", 0}, |
| ... | ... | @@ -355,6 +356,7 @@ function Role:data() |
| 355 | 356 | advSup = self:getProperty("advSup"), |
| 356 | 357 | advC = self:getProperty("advC"), |
| 357 | 358 | advCT = self:getProperty("advCT"), |
| 359 | + advRelay = self:getProperty("advRelay"), | |
| 358 | 360 | |
| 359 | 361 | hangPass = self:getProperty("hangPass"), |
| 360 | 362 | hangGift = self:getProperty("hangGift"), | ... | ... |
src/models/RoleBattle.lua
| ... | ... | @@ -21,13 +21,153 @@ local BattleType = { |
| 21 | 21 | |
| 22 | 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 | 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]() | |
| 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 or {}) 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 = 1, text1 = result}) | |
| 30 | 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 true | |
| 170 | +end | |
| 31 | 171 | |
| 32 | 172 | function Role:checkBattle(battleType, params) |
| 33 | 173 | local clientInfo = params.info or {} | ... | ... |
src/models/RoleChangeStruct.lua
| ... | ... | @@ -31,6 +31,7 @@ local awardGift = createVersionFunc(VersionType.Override ,function(role, params) |
| 31 | 31 | print("awardGift" .. " >>> " .. params) |
| 32 | 32 | end) |
| 33 | 33 | |
| 34 | + | |
| 34 | 35 | local bugFixSuduku = createVersionFunc(VersionType.DoOnly, function(role, params) |
| 35 | 36 | local sudoku = role:getProperty("sudoku") |
| 36 | 37 | local phase = sudoku[-1] or 1 |
| ... | ... | @@ -48,11 +49,38 @@ local bugFixSuduku = createVersionFunc(VersionType.DoOnly, function(role, params |
| 48 | 49 | end |
| 49 | 50 | end) |
| 50 | 51 | |
| 52 | +local bugFixRune = createVersionFunc(VersionType.DoOnly, function(role, params) | |
| 53 | + local had = false | |
| 54 | + for id, rune in pairs(role.runeBag) do | |
| 55 | + if math.floor(rune:getProperty("id") / 1000) == 16 then | |
| 56 | + local attrs = rune:getProperty("attrs") | |
| 57 | + local atk = attrs:getv(2, 0) | |
| 58 | + if atk ~= 0 then | |
| 59 | + attrs = attrs:delk(2):setv(1, atk) | |
| 60 | + had = true | |
| 61 | + rune:setProperty("attrs",attrs) | |
| 62 | + end | |
| 63 | + end | |
| 64 | + end | |
| 65 | + if had then | |
| 66 | + -- 补偿 | |
| 67 | + end | |
| 68 | +end) | |
| 69 | + | |
| 70 | +-- 清除 player 消失 的冒险 | |
| 71 | +local bugFixAdvPlayer = createVersionFunc(VersionType.Override, function(role, params) | |
| 72 | + if role:getAdvData():isRunning() and not role:getProperty("advTeam").player then | |
| 73 | + role:getAdvData():forceOver(true) | |
| 74 | + end | |
| 75 | +end) | |
| 76 | + | |
| 51 | 77 | ---------------------版本方法 end ---------------------- |
| 52 | 78 | |
| 53 | 79 | -- version 罗列start |
| 54 | 80 | local versionList = {} -- version 列表 |
| 55 | 81 | versionList[1] = {bugFixSuduku, {}} |
| 82 | +versionList[2] = {bugFixRune, {}} | |
| 83 | +versionList[3] = {bugFixAdvPlayer, {}} | |
| 56 | 84 | -- versionList[2] = {clearActivity, {5, 7}} |
| 57 | 85 | -- versionList[3] = {changeStructF, "test1"} |
| 58 | 86 | -- versionList[4] = {changeStructF, "test2"} |
| ... | ... | @@ -69,11 +97,11 @@ function RoleChangeStruct.bind(Role) |
| 69 | 97 | |
| 70 | 98 | function Role:changeStructVersion() |
| 71 | 99 | local curVersion = self:getProperty("sversion") |
| 72 | - if not globalCsv.StructVersion or curVersion >= globalCsv.StructVersion then return end | |
| 100 | + if not STRUCT_VERSION or curVersion >= STRUCT_VERSION then return end | |
| 73 | 101 | |
| 74 | 102 | local jumpVersion = {} |
| 75 | 103 | local versionTemp = {} |
| 76 | - for version = curVersion + 1, globalCsv.StructVersion do | |
| 104 | + for version = curVersion + 1, STRUCT_VERSION do | |
| 77 | 105 | local versionData = versionList[version] |
| 78 | 106 | if versionData then |
| 79 | 107 | if versionData[1].vType == VersionType.DoOnly then |
| ... | ... | @@ -106,7 +134,7 @@ function RoleChangeStruct.bind(Role) |
| 106 | 134 | end |
| 107 | 135 | end |
| 108 | 136 | |
| 109 | - for version = curVersion + 1, globalCsv.StructVersion do | |
| 137 | + for version = curVersion + 1, STRUCT_VERSION do | |
| 110 | 138 | if not jumpVersion[version] then |
| 111 | 139 | local versionData = versionList[version] |
| 112 | 140 | if versionData[1].vType == VersionType.DoOnly or versionData[1].vType == VersionType.Override then |
| ... | ... | @@ -116,7 +144,7 @@ function RoleChangeStruct.bind(Role) |
| 116 | 144 | end |
| 117 | 145 | end |
| 118 | 146 | end |
| 119 | - self:setProperty("sversion", globalCsv.StructVersion) | |
| 147 | + self:setProperty("sversion", STRUCT_VERSION) | |
| 120 | 148 | end |
| 121 | 149 | |
| 122 | 150 | end | ... | ... |
src/models/RoleLog.lua
| ... | ... | @@ -122,6 +122,7 @@ local ItemReason = { |
| 122 | 122 | |
| 123 | 123 | -- pvp |
| 124 | 124 | pvpCHead = 1301, -- pvp 跨服竞技场头像 |
| 125 | + crossPvpBet = 1302, -- 竞猜 | |
| 125 | 126 | |
| 126 | 127 | --adv |
| 127 | 128 | chooseEvent = 1351, -- 冒险选择 |
| ... | ... | @@ -506,11 +507,12 @@ local MethodType = { |
| 506 | 507 | }, |
| 507 | 508 | punitive_action = { -- 讨伐行动 --TODO |
| 508 | 509 | mission_id = true, --关卡ID |
| 509 | - mission_herolist = true, -- 英雄ID,排序以玩家出战设置为准,示例:[111, 222, 333, 444, 555] | |
| 510 | + mission_herolist = "json", -- 英雄ID,排序以玩家出战设置为准,示例:[111, 222, 333, 444, 555] | |
| 510 | 511 | mission_success_rate = true, -- 大成功几率 |
| 511 | - mission_reward = true, -- 获得奖励,建议使用json格式记录。示例:{ itemid1: 1, itemid2: 3, itemid3: 5} | |
| 512 | + mission_reward = "json", -- 获得奖励,建议使用json格式记录。示例:{ itemid1: 1, itemid2: 3, itemid3: 5} | |
| 512 | 513 | mission_result = true, -- 战斗结果(0-无效,1-胜利,2-失败) |
| 513 | 514 | mission_roundtime = true, -- 完成耗时(秒) |
| 515 | + mission_cleartype = true, -- 1-开始; 2-完成(领取奖励时) | |
| 514 | 516 | }, |
| 515 | 517 | hero_talent = { --英雄精进(原英雄天赋升级) TODO |
| 516 | 518 | hero_id = true, --英雄ID |
| ... | ... | @@ -542,20 +544,26 @@ local function isIos(self) |
| 542 | 544 | return sid == 2 |
| 543 | 545 | end |
| 544 | 546 | |
| 545 | -local appid, sdkId | |
| 547 | +local sdkId | |
| 548 | +local AppId = { | |
| 549 | + [1] = 4787, | |
| 550 | + [2] = 4788, | |
| 551 | + [3] = 4789, | |
| 552 | +} | |
| 546 | 553 | local function getBaseLog(self) |
| 547 | 554 | local uid = self:getProperty("uid") |
| 548 | - if not appid then | |
| 549 | - appid, sdkId = string.match(uid, "(.*)_(.*)") | |
| 550 | - if not appid then | |
| 555 | + local sid = self:getProperty("sid") | |
| 556 | + if not sdkId then | |
| 557 | + _, sdkId = string.match(uid, "(.*)_(.*)") | |
| 558 | + if not _ then | |
| 551 | 559 | sdkId = uid |
| 552 | - appid = 0 | |
| 553 | 560 | end |
| 554 | 561 | end |
| 562 | + | |
| 555 | 563 | local log = { |
| 556 | 564 | server_id = server_id, |
| 557 | 565 | timestamp = skynet.timex(), |
| 558 | - app_id = appid, | |
| 566 | + app_id = AppId[sid] or 0, | |
| 559 | 567 | plat_id = isIos(self) and 0 or 1, |
| 560 | 568 | sdk_uid = sdkId, |
| 561 | 569 | account_id = uid, |
| ... | ... | @@ -584,6 +592,7 @@ local LogType = { |
| 584 | 592 | guide = "common", |
| 585 | 593 | newdevice = "common", |
| 586 | 594 | cbback = "common", |
| 595 | + cheat = "common", | |
| 587 | 596 | |
| 588 | 597 | in_item = "common", |
| 589 | 598 | out_item = "common", | ... | ... |
src/models/RolePlugin.lua
| ... | ... | @@ -286,7 +286,7 @@ function RolePlugin.bind(Role) |
| 286 | 286 | print("addPlayExp no log ", debug.traceback()) |
| 287 | 287 | end |
| 288 | 288 | |
| 289 | - self:updateProperties({level = level, exp = newExp}) | |
| 289 | + self:updateProperties({level = level, exp = newExp}, params.notNotify) | |
| 290 | 290 | self:changeCrossServerPvpSelfInfo("level") |
| 291 | 291 | end |
| 292 | 292 | |
| ... | ... | @@ -356,13 +356,14 @@ function RolePlugin.bind(Role) |
| 356 | 356 | if not self:costDiamond(pms) then |
| 357 | 357 | return |
| 358 | 358 | end |
| 359 | - itemCountT[ItemId.Diamond] = nil | |
| 360 | 359 | end |
| 361 | 360 | for itemId, count in pairs(itemCountT) do |
| 362 | - pms.itemId = itemId | |
| 363 | - pms.count = - count | |
| 364 | - self:addItem(pms) | |
| 365 | - self:itemDeltaEvent(pms) | |
| 361 | + if itemId ~= ItemId.Diamond then | |
| 362 | + pms.itemId = itemId | |
| 363 | + pms.count = - count | |
| 364 | + self:addItem(pms) | |
| 365 | + self:itemDeltaEvent(pms) | |
| 366 | + end | |
| 366 | 367 | end |
| 367 | 368 | return true |
| 368 | 369 | end |
| ... | ... | @@ -386,7 +387,7 @@ function RolePlugin.bind(Role) |
| 386 | 387 | end |
| 387 | 388 | |
| 388 | 389 | if update then |
| 389 | - self:updateProperty({field = "boxL", value = boxL}) | |
| 390 | + self:updateProperty({field = "boxL", value = boxL, notNotify = pms.notNotify}) | |
| 390 | 391 | end |
| 391 | 392 | end |
| 392 | 393 | |
| ... | ... | @@ -829,7 +830,6 @@ function RolePlugin.bind(Role) |
| 829 | 830 | self:setProperty("heartWarning", heartWarning) |
| 830 | 831 | if heartWarning == 50 then |
| 831 | 832 | self:setBan(30, 1) --封禁 30天 |
| 832 | - self:sendGmMsg("server_accountBanned_inGame_1") | |
| 833 | 833 | return |
| 834 | 834 | end |
| 835 | 835 | if heartWarning < 50 and heartWarning % 5 == 0 then |
| ... | ... | @@ -842,21 +842,52 @@ function RolePlugin.bind(Role) |
| 842 | 842 | time = time or 0 |
| 843 | 843 | banType = banType or 0 |
| 844 | 844 | local now = skynet.timex() |
| 845 | - if time == 0 then | |
| 845 | + if time <= 0 then | |
| 846 | 846 | self:setProperty("banTime", 0) |
| 847 | 847 | self:setProperty("banType", 0) |
| 848 | 848 | self:setProperty("heartWarning", 0) |
| 849 | - | |
| 850 | 849 | self:mylog("role_action", {desc = "ban_rm"}) |
| 851 | 850 | else |
| 852 | - self:setProperty("banTime", now + 86400 * time) | |
| 851 | + self:sendGmMsg(globalCsv.ban_tips[banType] or globalCsv.ban_tips[0]) | |
| 852 | + self:setProperty("banTime", math.ceil(now + 86400 * time)) | |
| 853 | 853 | self:setProperty("banType", banType) |
| 854 | - self:mylog("role_action", {desc = "ban", int1 = time, int2 = banType}) | |
| 854 | + self:resetRank() | |
| 855 | + self:mylog("role_action", {desc = "ban", int1 = math.ceil(time), int2 = banType}) | |
| 855 | 856 | end |
| 856 | 857 | end |
| 857 | 858 | |
| 859 | + -- 清掉所有排行榜 | |
| 860 | + function Role:resetRank() | |
| 861 | + local roleId = self:getProperty("id") | |
| 862 | + redisproxy:pipelining(function (red) | |
| 863 | + red:zrem(RANK_TOWER, roleId) | |
| 864 | + for _, rk in pairs(RANK_ADV) do | |
| 865 | + red:zrem(rk, roleId) | |
| 866 | + end | |
| 867 | + for _, rk in pairs(RANK_DINER) do | |
| 868 | + red:zrem(rk, roleId) | |
| 869 | + end | |
| 870 | + for _, rk in pairs(RANK_PVP_COMMON_KEY) do | |
| 871 | + red:zrem(rk, roleId) | |
| 872 | + end | |
| 873 | + for _, rk in pairs(RANK_PVP_HIGHT_KEY) do | |
| 874 | + red:zrem(rk, roleId) | |
| 875 | + end | |
| 876 | + for _, ct in pairs(RANK_TYPE) do | |
| 877 | + red:zrem(RANK_COMMON .. ct, roleId) | |
| 878 | + end | |
| 879 | + end) | |
| 880 | + end | |
| 881 | + | |
| 858 | 882 | function Role:sendGmMsg(text, isNotKey) |
| 859 | 883 | SendPacket(actionCodes.Sys_maintainNotice, MsgPack.pack({ body = text, iskey = not isNotKey})) |
| 884 | + | |
| 885 | + local agent = datacenter.get("agent", self:getProperty("id")) | |
| 886 | + if agent then | |
| 887 | + skynet.timeout(50, function () | |
| 888 | + skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd) | |
| 889 | + end) | |
| 890 | + end | |
| 860 | 891 | end |
| 861 | 892 | |
| 862 | 893 | -- function Role:getHeroActiveRelationData(heros) |
| ... | ... | @@ -1362,7 +1393,7 @@ function RolePlugin.bind(Role) |
| 1362 | 1393 | end |
| 1363 | 1394 | format.heros = heros |
| 1364 | 1395 | format.supports = team.supports or {} |
| 1365 | - format.tactics = team.tactics or {} | |
| 1396 | + format.tactics = team.tactics or nil | |
| 1366 | 1397 | return format |
| 1367 | 1398 | end |
| 1368 | 1399 | |
| ... | ... | @@ -1469,6 +1500,7 @@ function RolePlugin.bind(Role) |
| 1469 | 1500 | return function (now, role) |
| 1470 | 1501 | if name == "email" and role.sendMailFlag then |
| 1471 | 1502 | last_breath = now + sec |
| 1503 | + role.sendMailFlag = false | |
| 1472 | 1504 | return true |
| 1473 | 1505 | end |
| 1474 | 1506 | if now >= last_breath then |
| ... | ... | @@ -1504,8 +1536,15 @@ function RolePlugin.bind(Role) |
| 1504 | 1536 | end) |
| 1505 | 1537 | for _, data in ipairs(redret) do |
| 1506 | 1538 | local email = tarr2tab(data) |
| 1507 | - if tonum(email.createtime) > self:getProperty("ctime") | |
| 1508 | - and ( not email.mid or tonum(email.mid) == mid ) | |
| 1539 | + -- 0 需要判斷創角時間小於郵件創建時間 1 只需要在時間段內登陸即可領取 | |
| 1540 | + local delayType = tonum(email.delayType) | |
| 1541 | + local flag = false | |
| 1542 | + if delayType == 1 then | |
| 1543 | + flag = skynet.timex() > tonum(email.createtime) | |
| 1544 | + else | |
| 1545 | + flag = tonum(email.createtime) > self:getProperty("ctime") | |
| 1546 | + end | |
| 1547 | + if flag and ( not email.mid or tonum(email.mid) == mid ) | |
| 1509 | 1548 | and ( not email.endtime or tonum(email.endtime) > now )then |
| 1510 | 1549 | return true |
| 1511 | 1550 | end |
| ... | ... | @@ -1665,6 +1704,9 @@ function RolePlugin.bind(Role) |
| 1665 | 1704 | local dataSet = csvdb["shop_rechargeCsv"][rechargeId] |
| 1666 | 1705 | |
| 1667 | 1706 | if orderObject:getProperty("finishTime") > 0 then |
| 1707 | + skynet.error(string.format("[recharge] is a finish order cpOrder: %s, platformOrder : %s, hadPlatformOrder: %s, id: %s, overTime : %s", | |
| 1708 | + partnerOrderStr, platformOrder, orderObject:getProperty("transactionId"), rechargeId, orderObject:getProperty("finishTime") | |
| 1709 | + )) | |
| 1668 | 1710 | return false, "finsh" |
| 1669 | 1711 | end |
| 1670 | 1712 | |
| ... | ... | @@ -1713,7 +1755,6 @@ function RolePlugin.bind(Role) |
| 1713 | 1755 | local roleId = self:getProperty("id") |
| 1714 | 1756 | local partnerOrderStr = params.order |
| 1715 | 1757 | |
| 1716 | - | |
| 1717 | 1758 | local status, back = self:updatePurchaseOrder(partnerOrderStr, params.transactionId, "finsh") |
| 1718 | 1759 | if not status then |
| 1719 | 1760 | if back == "finsh" then | ... | ... |
src/models/RolePvp.lua
| ... | ... | @@ -521,7 +521,7 @@ function Role:changeCrossServerPvpSelfInfo(cType) |
| 521 | 521 | change[cType] = self:getProperty(cType) |
| 522 | 522 | elseif cType == "format" then |
| 523 | 523 | -- 是否过了时间 |
| 524 | - local crossTime = skynet.timex() - self:getTimeResetStartTime(TimeReset.PvpCross) | |
| 524 | + local crossTime = skynet.timex() - self:getTimeResetStartTime(TimeReset.PvpCross) + RESET_TIME * 3600 | |
| 525 | 525 | local aday = 3600 * 24 |
| 526 | 526 | local day = math.ceil(crossTime / aday) -- 当前是第几个比赛日 |
| 527 | 527 | local ctime = crossTime % aday -- 当前在本天 经过多少时间 |
| ... | ... | @@ -530,7 +530,7 @@ function Role:changeCrossServerPvpSelfInfo(cType) |
| 530 | 530 | return |
| 531 | 531 | end |
| 532 | 532 | change.battleV = self:getProperty("pvpTBVH") |
| 533 | - change.heros = self:getProperty("pvpTSH") | |
| 533 | + change.team = self:getProperty("pvpTSH") | |
| 534 | 534 | change.battleInfo = self:getProperty("pvpTBH") |
| 535 | 535 | end |
| 536 | 536 | |
| ... | ... | @@ -615,7 +615,7 @@ end |
| 615 | 615 | |
| 616 | 616 | function Role:setCrossServerPvpBet(idx) |
| 617 | 617 | if not self:isTimeResetOpen(TimeReset.PvpCross) then return false , 1 end |
| 618 | - local crossTime = skynet.timex() - self:getTimeResetStartTime(TimeReset.PvpCross) | |
| 618 | + local crossTime = skynet.timex() - self:getTimeResetStartTime(TimeReset.PvpCross) + RESET_TIME * 3600 | |
| 619 | 619 | local aday = 3600 * 24 |
| 620 | 620 | local day = math.ceil(crossTime / aday) -- 当前是第几个比赛日 |
| 621 | 621 | local ctime = crossTime % aday -- 当前在本天 经过多少时间 | ... | ... |
src/models/RoleTask.lua
| ... | ... | @@ -50,6 +50,7 @@ local TaskType = { |
| 50 | 50 | AdvHang = 412, -- 代理拾荒次数 |
| 51 | 51 | AdvMineKill = 413, -- 宝藏怪击杀 |
| 52 | 52 | AdvMineLayer = 414, -- 宝藏洞激活 |
| 53 | + AdvPassFirst = 415, -- 冒险首次通关 - id | |
| 53 | 54 | |
| 54 | 55 | --爬塔相关 |
| 55 | 56 | TowerPass = 501, -- 爬塔通关 - level |
| ... | ... | @@ -240,7 +241,7 @@ local StoreListener = { |
| 240 | 241 | [TaskType.HangPass] = {{TriggerEventType.HangPass, f("id")}}, |
| 241 | 242 | [TaskType.RoleLevelUp] = {{TriggerEventType.LevelUp, f("level")}}, |
| 242 | 243 | [TaskType.TowerPass] = {{TriggerEventType.TowerPass, f("level")}}, |
| 243 | - [TaskType.AdvPass] = {{TriggerEventType.AdvPass, f("id")}}, | |
| 244 | + [TaskType.AdvPassFirst] = {{TriggerEventType.AdvPass, f("id")}}, | |
| 244 | 245 | [TaskType.AddHero] = {{TriggerEventType.AddNewHero, f("heroType")}, {TriggerEventType.SSRCount, f("ssrCount")}}, |
| 245 | 246 | } |
| 246 | 247 | } | ... | ... |
src/models/RoleTimeReset.lua
| ... | ... | @@ -23,6 +23,11 @@ ResetFunc["CrossDay"] = function(self, notify, response, now) |
| 23 | 23 | end |
| 24 | 24 | self:setProperty("advMine", advMine) |
| 25 | 25 | |
| 26 | + local ltime = self:getProperty("ltime") | |
| 27 | + if isCrossMonth(ltime, now) then | |
| 28 | + self.storeData:resetStoreReored(3) --商店跨月重置 time_reset表关联id | |
| 29 | + end | |
| 30 | + | |
| 26 | 31 | response.dTask = {} |
| 27 | 32 | response.advSup = self:getProperty("advSup") |
| 28 | 33 | self:log("onLogin") |
| ... | ... | @@ -43,13 +48,6 @@ ResetFunc["CrossWeek"] = function(self, notify, response) |
| 43 | 48 | response.dinerS = {} |
| 44 | 49 | end |
| 45 | 50 | |
| 46 | -ResetFunc["CrossMonth"] = function(self, notify, response) | |
| 47 | - local ltime = self:getProperty("ltime") | |
| 48 | - if isCrossMonth(ltime, skynet.timex()) then | |
| 49 | - self.storeData:resetStoreReored(3) --商店跨月重置 time_reset表关联id | |
| 50 | - end | |
| 51 | -end | |
| 52 | - | |
| 53 | 51 | |
| 54 | 52 | ResetFunc["DinerRank"] = function(self, notify, response) |
| 55 | 53 | self.dinerData:rankResetData(notify) |
| ... | ... | @@ -89,13 +87,10 @@ function Role:updateTimeReset(now, notify) |
| 89 | 87 | ResetFunc[funcName](self, notify, response, now) |
| 90 | 88 | resetMode[funcName] = true |
| 91 | 89 | end |
| 92 | - if needResetId[resetId] then | |
| 93 | - -- 充值商城购买记录 | |
| 94 | - self.storeData:resetStoreReored(resetId) | |
| 95 | - end | |
| 96 | 90 | end |
| 97 | 91 | |
| 98 | 92 | for resetId, round in pairs(needResetId) do |
| 93 | + self.storeData:resetStoreReored(resetId) | |
| 99 | 94 | timeReset[resetId] = round |
| 100 | 95 | end |
| 101 | 96 | self:setProperties({timeReset = timeReset, ltime = now}) | ... | ... |
src/services/globald.lua
| ... | ... | @@ -69,7 +69,8 @@ local function mailQuene() |
| 69 | 69 | "attachments", email.attachments, |
| 70 | 70 | "endtime", email.endTime, |
| 71 | 71 | "mid", email.mid, |
| 72 | - "timestamp", now | |
| 72 | + "timestamp", now, | |
| 73 | + "delayType", email.delayType | |
| 73 | 74 | ) |
| 74 | 75 | else |
| 75 | 76 | redisproxy:hmset(string_format("globalEmail:%s", gid), |
| ... | ... | @@ -80,7 +81,8 @@ local function mailQuene() |
| 80 | 81 | "content", email.content, |
| 81 | 82 | "attachments", email.attachments, |
| 82 | 83 | "endtime", email.endTime, |
| 83 | - "timestamp", now | |
| 84 | + "timestamp", now, | |
| 85 | + "delayType", email.delayType | |
| 84 | 86 | ) |
| 85 | 87 | end |
| 86 | 88 | end | ... | ... |
src/services/pvpd.lua
| ... | ... | @@ -84,7 +84,7 @@ function CMD.updateRoleInfo(change) |
| 84 | 84 | CMD.refreshRoleInfo(change) |
| 85 | 85 | local pvpd = cluster.query("center", "pvpd") |
| 86 | 86 | if pvpd then |
| 87 | - pcall(cluster.call, "center", pvpd, "updateRoleInfo", change) | |
| 87 | + pcall(cluster.send, "center", pvpd, "updateRoleInfo", change) | |
| 88 | 88 | end |
| 89 | 89 | end |
| 90 | 90 | |
| ... | ... | @@ -92,7 +92,7 @@ local function getDayAndTime() |
| 92 | 92 | local startTime = getStartTime() |
| 93 | 93 | local now = skynet.timex() |
| 94 | 94 | |
| 95 | - local crossTime = now - startTime | |
| 95 | + local crossTime = now - startTime + RESET_TIME * 3600 | |
| 96 | 96 | local aday = 3600 * 24 |
| 97 | 97 | local day = math.ceil(crossTime / aday) -- 当前是第几个比赛日 |
| 98 | 98 | local ctime = crossTime % aday -- 当前在本天 经过多少时间 | ... | ... |
src/utils/CommonFunc.lua
| ... | ... | @@ -100,7 +100,7 @@ end |
| 100 | 100 | -- 判断是不是同一个月 |
| 101 | 101 | function isCrossMonth(target, now) |
| 102 | 102 | now = now or skynet.timex() |
| 103 | - local tarTm = os.date("*t", target) | |
| 103 | + local tarTm = os.date("*t", target - RESET_TIME * 3600) | |
| 104 | 104 | local nowTm = os.date("*t", now - RESET_TIME * 3600) |
| 105 | 105 | if tarTm.year == nowTm.year and tarTm.month == nowTm.month then |
| 106 | 106 | return false | ... | ... |