Commit a8e6aef728148e51282c66fd937eb273c5124619

Authored by zhouhaihai
2 parents a42753c3 b2de779a

Merge branch 'tr/bugfix' into tr/publish/release

* tr/bugfix:
  输出删掉
  登入刷新兑换活动商店
  兑换活动上线检测是否需要刷新
  修复存在的冒险进不去的玩家
  兑换商店不刷新bug
  新增倍数
  bugfix
  同单号充值输出
  relay
  修改中继营地解锁条件
  防作弊
  活动战斗结束不发送战斗奖励
  活动免费礼包判断活动是否开启

# Conflicts:
#	src/csvdata
@@ -16,6 +16,7 @@ TIME_ZONE = math.floor(os.difftime(START_RESET_TIME_BASE, os.time(os.date("!*t", @@ -16,6 +16,7 @@ TIME_ZONE = math.floor(os.difftime(START_RESET_TIME_BASE, os.time(os.date("!*t",
16 16
17 START_RESET_TIME = START_RESET_TIME_BASE - TIME_ZONE * 3600 17 START_RESET_TIME = START_RESET_TIME_BASE - TIME_ZONE * 3600
18 18
  19 +STRUCT_VERSION = 3 -- 数据结构版本
19 20
20 MAX_ROLE_NUM = 1000000 21 MAX_ROLE_NUM = 1000000
21 -- 属性枚举 22 -- 属性枚举
src/actions/ActivityAction.lua
@@ -511,6 +511,7 @@ function _M.startBattleRpc(agent, data) @@ -511,6 +511,7 @@ function _M.startBattleRpc(agent, data)
511 key = tostring(math.random()), 511 key = tostring(math.random()),
512 actid = actid, 512 actid = actid,
513 id = id, 513 id = id,
  514 + format = msg.format,
514 } 515 }
515 SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack({key = role.__actBattleCache.key})) 516 SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack({key = role.__actBattleCache.key}))
516 else 517 else
@@ -568,7 +569,10 @@ function _M.endBattleRpc(agent, data) @@ -568,7 +569,10 @@ function _M.endBattleRpc(agent, data)
568 local isWin = msg.isWin 569 local isWin = msg.isWin
569 local heros = msg.heros 570 local heros = msg.heros
570 local support = msg.support 571 local support = msg.support
571 - 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
572 576
573 if not role.__actBattleCache then return 2 end 577 if not role.__actBattleCache then return 2 end
574 578
@@ -576,6 +580,18 @@ function _M.endBattleRpc(agent, data) @@ -576,6 +580,18 @@ function _M.endBattleRpc(agent, data)
576 SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({errorCode = 1})) 580 SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({errorCode = 1}))
577 end 581 end
578 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.Hang_endBonusBattleRpc, MsgPack.pack({errorCode = 1}))
  591 + return true
  592 + end
  593 + role.__actBattleCache = nil
  594 +
579 local actCfg = csvdb["activity_battleCsv"][actid] 595 local actCfg = csvdb["activity_battleCsv"][actid]
580 if not actCfg then return 3 end 596 if not actCfg then return 3 end
581 597
src/actions/AdvAction.lua
@@ -137,7 +137,8 @@ function _M.startAdvRpc( agent, data ) @@ -137,7 +137,8 @@ function _M.startAdvRpc( agent, data )
137 local relayData = role:getAdvData():isHaveRelay(layer, chapterId, true) 137 local relayData = role:getAdvData():isHaveRelay(layer, chapterId, true)
138 if not relayData then return 6 end -- 不是中继层 138 if not relayData then return 6 end -- 不是中继层
139 if layer ~= 1 then 139 if layer ~= 1 then
140 - 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 -- 没有开放
141 end 142 end
142 if not role:checkAdvCount(relayData.supply) then return 2 end -- 是否有体力 143 if not role:checkAdvCount(relayData.supply) then return 2 end -- 是否有体力
143 -- 关卡开放判断 144 -- 关卡开放判断
@@ -191,7 +192,7 @@ function _M.startHangRpc(agent, data) @@ -191,7 +192,7 @@ function _M.startHangRpc(agent, data)
191 local format = msg.format --编队 192 local format = msg.format --编队
192 local index = msg.index or 1--时间索引id 193 local index = msg.index or 1--时间索引id
193 194
194 - local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] 195 + local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId]
195 if not chapterData then return 1 end 196 if not chapterData then return 1 end
196 local campSiteData = chapterData[campId] 197 local campSiteData = chapterData[campId]
197 if not campSiteData then return 1 end 198 if not campSiteData then return 1 end
@@ -213,7 +214,7 @@ function _M.startHangRpc(agent, data) @@ -213,7 +214,7 @@ function _M.startHangRpc(agent, data)
213 if AdvCommon.isEndless(chapterId) then return 5 end -- 无尽没有代理 214 if AdvCommon.isEndless(chapterId) then return 5 end -- 无尽没有代理
214 215
215 local advRelay = role:getProperty("advRelay") 216 local advRelay = role:getProperty("advRelay")
216 - if not next(advRelay[chapterId] or {}) then return 6 end -- 没有开放 217 + if not (advRelay[chapterId] or {})[campSiteData.floor] then return 6 end -- 没有开放
217 218
218 219
219 if not role:checkAdvCount(adv_idle_energy) then return 7 end -- 是否有体力 220 if not role:checkAdvCount(adv_idle_energy) then return 7 end -- 是否有体力
@@ -962,6 +963,9 @@ function _M.roleFormatRpc(agent , data) @@ -962,6 +963,9 @@ function _M.roleFormatRpc(agent , data)
962 local index = msg.index -- 阵容索引 963 local index = msg.index -- 阵容索引
963 local title = msg.title -- 阵容名称 964 local title = msg.title -- 阵容名称
964 local team = {} 965 local team = {}
  966 +
  967 + if role:getAdvData():isRunning() then return 3 end
  968 +
965 for slot, heroId in pairs(msg.heros) do 969 for slot, heroId in pairs(msg.heros) do
966 if not role.heros[heroId] then 970 if not role.heros[heroId] then
967 return 1 971 return 1
@@ -1004,6 +1008,9 @@ function _M.selectTeamRpc(agent, data) @@ -1004,6 +1008,9 @@ function _M.selectTeamRpc(agent, data)
1004 local role = agent.role 1008 local role = agent.role
1005 local msg = MsgPack.unpack(data) 1009 local msg = MsgPack.unpack(data)
1006 local index = msg.index -- 阵容索引 1010 local index = msg.index -- 阵容索引
  1011 +
  1012 + if role:getAdvData():isRunning() then return 1 end
  1013 +
1007 local team = role:getAdvTeamFormat(index) 1014 local team = role:getAdvTeamFormat(index)
1008 if not next(team) then return end 1015 if not next(team) then return end
1009 team["index"] = index 1016 team["index"] = index
src/actions/GmAction.lua
@@ -40,26 +40,15 @@ function _M.ban(role, pms) @@ -40,26 +40,15 @@ function _M.ban(role, pms)
40 local time = tonum(pms.pm1, 1) 40 local time = tonum(pms.pm1, 1)
41 local ctype = tonum(pms.pm2, 0) 41 local ctype = tonum(pms.pm2, 0)
42 42
43 - local isBan = role:getProperty("banTime") <= now  
44 role:setBan(time, ctype) 43 role:setBan(time, ctype)
45 - if time > 0 then  
46 - role:sendGmMsg("server_accountBanned_1")  
47 - local agent = datacenter.get("agent", role:getProperty("id"))  
48 - if agent then  
49 - skynet.timeout(50, function ()  
50 - skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd)  
51 - end)  
52 - end  
53 - end  
54 -  
55 role:mylog("gm_action", {desc = "ban", int1 = time, int2 = ctype, key1 = pms.sender}) 44 role:mylog("gm_action", {desc = "ban", int1 = time, int2 = ctype, key1 = pms.sender})
56 -  
57 - return isBan and "解封杀成功" or "封杀成功" 45 + return "封杀成功"
58 end 46 end
59 47
  48 +
60 function _M.unban(role, pms) 49 function _M.unban(role, pms)
61 role:setBan(0, 0) 50 role:setBan(0, 0)
62 - 51 + role:setProperty("cheatCount", 0) -- 清除作弊次数
63 role:mylog("gm_action", {desc = "unban", key1 = pms.sender}) 52 role:mylog("gm_action", {desc = "unban", key1 = pms.sender})
64 53
65 return "解封杀成功" 54 return "解封杀成功"
@@ -67,18 +56,17 @@ end @@ -67,18 +56,17 @@ end
67 56
68 function _M.gmmsg(role, pms) 57 function _M.gmmsg(role, pms)
69 role:sendGmMsg(pms.pm1, true) 58 role:sendGmMsg(pms.pm1, true)
70 -  
71 - local agent = datacenter.get("agent", role:getProperty("id"))  
72 - if agent then  
73 - skynet.timeout(50, function ()  
74 - skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd)  
75 - end)  
76 - end  
77 role:mylog("gm_action", {desc = "gmmsg", text1 = pms.pm1, key1 = pms.sender}) 59 role:mylog("gm_action", {desc = "gmmsg", text1 = pms.pm1, key1 = pms.sender})
78 -  
79 return "指令成功" 60 return "指令成功"
80 end 61 end
81 62
  63 +
  64 +function _M.reset_rank(role, pms)
  65 + role:resetRank()
  66 + role:mylog("gm_action", {desc = "reset_rank", key1 = pms.sender})
  67 + return "封杀成功"
  68 +end
  69 +
82 function _M.silent(role, pms) 70 function _M.silent(role, pms)
83 local pm1 = tonum(pms.pm1) 71 local pm1 = tonum(pms.pm1)
84 if pm1 < 1 then 72 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)
@@ -607,6 +617,18 @@ function _M.endBonusBattleRpc(agent, data) @@ -607,6 +617,18 @@ function _M.endBonusBattleRpc(agent, data)
607 SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({errorCode = 1})) 617 SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({errorCode = 1}))
608 return true 618 return true
609 end 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 local bonusData = csvdb["bonus_battleCsv"][id] 632 local bonusData = csvdb["bonus_battleCsv"][id]
611 633
612 local reward, change = {} 634 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
@@ -140,12 +140,8 @@ function Adv:initByChapter(params) @@ -140,12 +140,8 @@ 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 -  
149 self.maps = {} 145 self.maps = {}
150 self.maps[1] = AdvMap.new(self, 1, mapId, isEnter, isNewRelay) 146 self.maps[1] = AdvMap.new(self, 1, mapId, isEnter, isNewRelay)
151 147
@@ -153,8 +149,6 @@ function Adv:initByChapter(params) @@ -153,8 +149,6 @@ function Adv:initByChapter(params)
153 149
154 self:initLayerTask() 150 self:initLayerTask()
155 151
156 -  
157 -  
158 self:checkTask(Adv.TaskType.Arrive) 152 self:checkTask(Adv.TaskType.Arrive)
159 self:checkAdvUnlock(1, self.level) 153 self:checkAdvUnlock(1, self.level)
160 154
@@ -168,6 +162,20 @@ function Adv:initByChapter(params) @@ -168,6 +162,20 @@ function Adv:initByChapter(params)
168 end 162 end
169 end 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 function Adv:clear() 179 function Adv:clear()
172 self.chapterId = nil 180 self.chapterId = nil
173 self.level = nil 181 self.level = nil
@@ -400,7 +408,7 @@ function Adv:forceOver(notNotify) @@ -400,7 +408,7 @@ function Adv:forceOver(notNotify)
400 for itemId, count in pairs(reward) do 408 for itemId, count in pairs(reward) do
401 reward[itemId] = math.ceil(count * globalCsv.adv_fail_reward_ratio / 100) -- 奖励相当于失败 409 reward[itemId] = math.ceil(count * globalCsv.adv_fail_reward_ratio / 100) -- 奖励相当于失败
402 end 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 self:clear() 413 self:clear()
406 self.owner:updateProperties({ 414 self.owner:updateProperties({
@@ -963,7 +971,7 @@ function Adv:award(gift, params, backRewardParams) @@ -963,7 +971,7 @@ function Adv:award(gift, params, backRewardParams)
963 971
964 local autoUse = {} 972 local autoUse = {}
965 for itemId, count in pairs(tgift) do 973 for itemId, count in pairs(tgift) do
966 - if count > 0 then 974 + if count > 0 and self.battle.player then
967 local buffAdd = self.battle.player:getRewardChange(itemId) 975 local buffAdd = self.battle.player:getRewardChange(itemId)
968 count = math.floor(math.max(0, (count + buffAdd[0]) * (1 + buffAdd[1]))) --附加 buff 的影响 976 count = math.floor(math.max(0, (count + buffAdd[0]) * (1 + buffAdd[1]))) --附加 buff 的影响
969 self:checkTask(Adv.TaskType.Item, count, itemId) 977 self:checkTask(Adv.TaskType.Item, count, itemId)
@@ -1124,6 +1132,7 @@ local function clickOut(self, room, block, params, isExit) @@ -1124,6 +1132,7 @@ local function clickOut(self, room, block, params, isExit)
1124 end 1132 end
1125 1133
1126 if not self:isEndless() and (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel) then --关卡结束 1134 if not self:isEndless() and (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel) then --关卡结束
  1135 + self:passAdvRelay()
1127 self:over(true) 1136 self:over(true)
1128 else 1137 else
1129 self.battle.player:triggerPassive(Passive.DOWN_LAYER) 1138 self.battle.player:triggerPassive(Passive.DOWN_LAYER)
@@ -1676,10 +1685,7 @@ function Adv:clickBlock(roomId, blockId, params) @@ -1676,10 +1685,7 @@ function Adv:clickBlock(roomId, blockId, params)
1676 if self.isRelay or checkAroundBlocks() then --开放 1685 if self.isRelay or checkAroundBlocks() then --开放
1677 self:getCurMap():openBlock(roomId, blockId, true, true) 1686 self:getCurMap():openBlock(roomId, blockId, true, true)
1678 if self.isRelay and self:getCurMap():isAllOpen() then -- 发放翻开的奖励 1687 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 1688 + self:passAdvRelay()
1683 end 1689 end
1684 status = true 1690 status = true
1685 end 1691 end
src/adv/AdvBlock.lua
@@ -60,9 +60,9 @@ function Block:updateEvent(event, isInit) @@ -60,9 +60,9 @@ function Block:updateEvent(event, isInit)
60 end 60 end
61 self:randomEvent() 61 self:randomEvent()
62 end 62 end
63 - self:quickDrop()  
64 63
65 if not isInit and self.isOpen then 64 if not isInit and self.isOpen then
  65 + self:quickDrop()
66 local newet = self:getEventType() 66 local newet = self:getEventType()
67 if oldet ~= newet then 67 if oldet ~= newet then
68 local em = {} 68 local em = {}
src/adv/AdvPassive.lua
@@ -532,7 +532,7 @@ function Passive:effect8(dropId) @@ -532,7 +532,7 @@ function Passive:effect8(dropId)
532 end 532 end
533 533
534 --9=直接获得item(可在结算触发时使用) 534 --9=直接获得item(可在结算触发时使用)
535 -function Passive:effect9(itemId, triggerPms, ratio, max) 535 +function Passive:effect9(itemId, triggerPms, ratio, ratio2, max)
536 local cond = nil 536 local cond = nil
537 if self.passiveData.value == 0 then 537 if self.passiveData.value == 0 then
538 cond = triggerPms.score 538 cond = triggerPms.score
@@ -542,7 +542,7 @@ function Passive:effect9(itemId, triggerPms, ratio, max) @@ -542,7 +542,7 @@ function Passive:effect9(itemId, triggerPms, ratio, max)
542 return 542 return
543 end 543 end
544 if not cond then return end 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 end 546 end
547 547
548 --10=战斗额外掉落次数 548 --10=战斗额外掉落次数
src/models/Activity.lua
@@ -482,6 +482,9 @@ activityFunc[Activity.ActivityType.Exchange] = { @@ -482,6 +482,9 @@ activityFunc[Activity.ActivityType.Exchange] = {
482 actData[actId] = {} 482 actData[actId] = {}
483 self:updateActData(actType, actData, not notify) 483 self:updateActData(actType, actData, not notify)
484 end, 484 end,
  485 + ["login"] = function(self, actType, actId)
  486 + activityFunc[Activity.ActivityType.Exchange]["crossDay"](self, actType, true, actId)
  487 + end,
485 ["crossDay"] = function(self, actType, notify, actId) 488 ["crossDay"] = function(self, actType, notify, actId)
486 local actData = self:getActData(actType) or {} 489 local actData = self:getActData(actType) or {}
487 local lastTs = actData["ts"] or 0 490 local lastTs = actData["ts"] or 0
@@ -490,14 +493,14 @@ activityFunc[Activity.ActivityType.Exchange] = { @@ -490,14 +493,14 @@ activityFunc[Activity.ActivityType.Exchange] = {
490 if not cfg then return end 493 if not cfg then return end
491 local refreshTimes = cfg.condition2:toArray(false, "=") 494 local refreshTimes = cfg.condition2:toArray(false, "=")
492 for i = 1, #refreshTimes do 495 for i = 1, #refreshTimes do
493 - local rt = toUnixtime(refreshTimes[1]..string_format("%02x", RESET_TIME)) 496 + local rt = toUnixtime(refreshTimes[i]..string_format("%02x", RESET_TIME))
494 if timeNow >= rt and rt > lastTs then 497 if timeNow >= rt and rt > lastTs then
495 lastTs = rt 498 lastTs = rt
496 actData = {} 499 actData = {}
497 end 500 end
498 end 501 end
499 - if next(actData) then  
500 - actData["ts"] = lastTs 502 + if not next(actData) then
  503 + actData["ts"] = timeNow
501 self:updateActData(actType, actData, not notify) 504 self:updateActData(actType, actData, not notify)
502 end 505 end
503 end, 506 end,
src/models/Role.lua
@@ -53,10 +53,11 @@ Role.schema = { @@ -53,10 +53,11 @@ 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}, -- 忽略维护拦截
59 - sversion = {"number", globalCsv.StructVersion or 0}, -- 重整数据版本 60 + sversion = {"number", STRUCT_VERSION or 0}, -- 重整数据版本
60 timeReset = {"table", {}}, --重置轮回记录 61 timeReset = {"table", {}}, --重置轮回记录
61 diamond = {"number", 0}, 62 diamond = {"number", 0},
62 reDiamond = {"number", 0}, 63 reDiamond = {"number", 0},
@@ -355,6 +356,7 @@ function Role:data() @@ -355,6 +356,7 @@ function Role:data()
355 advSup = self:getProperty("advSup"), 356 advSup = self:getProperty("advSup"),
356 advC = self:getProperty("advC"), 357 advC = self:getProperty("advC"),
357 advCT = self:getProperty("advCT"), 358 advCT = self:getProperty("advCT"),
  359 + advRelay = self:getProperty("advRelay"),
358 360
359 hangPass = self:getProperty("hangPass"), 361 hangPass = self:getProperty("hangPass"),
360 hangGift = self:getProperty("hangGift"), 362 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/RoleChangeStruct.lua
@@ -31,6 +31,7 @@ local awardGift = createVersionFunc(VersionType.Override ,function(role, params) @@ -31,6 +31,7 @@ local awardGift = createVersionFunc(VersionType.Override ,function(role, params)
31 print("awardGift" .. " >>> " .. params) 31 print("awardGift" .. " >>> " .. params)
32 end) 32 end)
33 33
  34 +
34 local bugFixSuduku = createVersionFunc(VersionType.DoOnly, function(role, params) 35 local bugFixSuduku = createVersionFunc(VersionType.DoOnly, function(role, params)
35 local sudoku = role:getProperty("sudoku") 36 local sudoku = role:getProperty("sudoku")
36 local phase = sudoku[-1] or 1 37 local phase = sudoku[-1] or 1
@@ -65,12 +66,21 @@ local bugFixRune = createVersionFunc(VersionType.DoOnly, function(role, params) @@ -65,12 +66,21 @@ local bugFixRune = createVersionFunc(VersionType.DoOnly, function(role, params)
65 -- 补偿 66 -- 补偿
66 end 67 end
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 +
68 ---------------------版本方法 end ---------------------- 77 ---------------------版本方法 end ----------------------
69 78
70 -- version 罗列start 79 -- version 罗列start
71 local versionList = {} -- version 列表 80 local versionList = {} -- version 列表
72 versionList[1] = {bugFixSuduku, {}} 81 versionList[1] = {bugFixSuduku, {}}
73 versionList[2] = {bugFixRune, {}} 82 versionList[2] = {bugFixRune, {}}
  83 +versionList[3] = {bugFixAdvPlayer, {}}
74 -- versionList[2] = {clearActivity, {5, 7}} 84 -- versionList[2] = {clearActivity, {5, 7}}
75 -- versionList[3] = {changeStructF, "test1"} 85 -- versionList[3] = {changeStructF, "test1"}
76 -- versionList[4] = {changeStructF, "test2"} 86 -- versionList[4] = {changeStructF, "test2"}
@@ -87,11 +97,11 @@ function RoleChangeStruct.bind(Role) @@ -87,11 +97,11 @@ function RoleChangeStruct.bind(Role)
87 97
88 function Role:changeStructVersion() 98 function Role:changeStructVersion()
89 local curVersion = self:getProperty("sversion") 99 local curVersion = self:getProperty("sversion")
90 - if not globalCsv.StructVersion or curVersion >= globalCsv.StructVersion then return end 100 + if not STRUCT_VERSION or curVersion >= STRUCT_VERSION then return end
91 101
92 local jumpVersion = {} 102 local jumpVersion = {}
93 local versionTemp = {} 103 local versionTemp = {}
94 - for version = curVersion + 1, globalCsv.StructVersion do 104 + for version = curVersion + 1, STRUCT_VERSION do
95 local versionData = versionList[version] 105 local versionData = versionList[version]
96 if versionData then 106 if versionData then
97 if versionData[1].vType == VersionType.DoOnly then 107 if versionData[1].vType == VersionType.DoOnly then
@@ -124,7 +134,7 @@ function RoleChangeStruct.bind(Role) @@ -124,7 +134,7 @@ function RoleChangeStruct.bind(Role)
124 end 134 end
125 end 135 end
126 136
127 - for version = curVersion + 1, globalCsv.StructVersion do 137 + for version = curVersion + 1, STRUCT_VERSION do
128 if not jumpVersion[version] then 138 if not jumpVersion[version] then
129 local versionData = versionList[version] 139 local versionData = versionList[version]
130 if versionData[1].vType == VersionType.DoOnly or versionData[1].vType == VersionType.Override then 140 if versionData[1].vType == VersionType.DoOnly or versionData[1].vType == VersionType.Override then
@@ -134,7 +144,7 @@ function RoleChangeStruct.bind(Role) @@ -134,7 +144,7 @@ function RoleChangeStruct.bind(Role)
134 end 144 end
135 end 145 end
136 end 146 end
137 - self:setProperty("sversion", globalCsv.StructVersion) 147 + self:setProperty("sversion", STRUCT_VERSION)
138 end 148 end
139 149
140 end 150 end
src/models/RoleLog.lua
@@ -592,6 +592,7 @@ local LogType = { @@ -592,6 +592,7 @@ local LogType = {
592 guide = "common", 592 guide = "common",
593 newdevice = "common", 593 newdevice = "common",
594 cbback = "common", 594 cbback = "common",
  595 + cheat = "common",
595 596
596 in_item = "common", 597 in_item = "common",
597 out_item = "common", 598 out_item = "common",
src/models/RolePlugin.lua
@@ -286,7 +286,7 @@ function RolePlugin.bind(Role) @@ -286,7 +286,7 @@ function RolePlugin.bind(Role)
286 print("addPlayExp no log ", debug.traceback()) 286 print("addPlayExp no log ", debug.traceback())
287 end 287 end
288 288
289 - self:updateProperties({level = level, exp = newExp}) 289 + self:updateProperties({level = level, exp = newExp}, params.notNotify)
290 self:changeCrossServerPvpSelfInfo("level") 290 self:changeCrossServerPvpSelfInfo("level")
291 end 291 end
292 292
@@ -387,7 +387,7 @@ function RolePlugin.bind(Role) @@ -387,7 +387,7 @@ function RolePlugin.bind(Role)
387 end 387 end
388 388
389 if update then 389 if update then
390 - self:updateProperty({field = "boxL", value = boxL}) 390 + self:updateProperty({field = "boxL", value = boxL, notNotify = pms.notNotify})
391 end 391 end
392 end 392 end
393 393
@@ -830,7 +830,6 @@ function RolePlugin.bind(Role) @@ -830,7 +830,6 @@ function RolePlugin.bind(Role)
830 self:setProperty("heartWarning", heartWarning) 830 self:setProperty("heartWarning", heartWarning)
831 if heartWarning == 50 then 831 if heartWarning == 50 then
832 self:setBan(30, 1) --封禁 30天 832 self:setBan(30, 1) --封禁 30天
833 - self:sendGmMsg("server_accountBanned_inGame_1")  
834 return 833 return
835 end 834 end
836 if heartWarning < 50 and heartWarning % 5 == 0 then 835 if heartWarning < 50 and heartWarning % 5 == 0 then
@@ -843,21 +842,52 @@ function RolePlugin.bind(Role) @@ -843,21 +842,52 @@ function RolePlugin.bind(Role)
843 time = time or 0 842 time = time or 0
844 banType = banType or 0 843 banType = banType or 0
845 local now = skynet.timex() 844 local now = skynet.timex()
846 - if time == 0 then 845 + if time <= 0 then
847 self:setProperty("banTime", 0) 846 self:setProperty("banTime", 0)
848 self:setProperty("banType", 0) 847 self:setProperty("banType", 0)
849 self:setProperty("heartWarning", 0) 848 self:setProperty("heartWarning", 0)
850 -  
851 self:mylog("role_action", {desc = "ban_rm"}) 849 self:mylog("role_action", {desc = "ban_rm"})
852 else 850 else
853 - 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))
854 self:setProperty("banType", banType) 853 self:setProperty("banType", banType)
855 - 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})
856 end 856 end
857 end 857 end
858 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 +
859 function Role:sendGmMsg(text, isNotKey) 882 function Role:sendGmMsg(text, isNotKey)
860 SendPacket(actionCodes.Sys_maintainNotice, MsgPack.pack({ body = text, iskey = not isNotKey})) 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
861 end 891 end
862 892
863 -- function Role:getHeroActiveRelationData(heros) 893 -- function Role:getHeroActiveRelationData(heros)
@@ -1674,6 +1704,9 @@ function RolePlugin.bind(Role) @@ -1674,6 +1704,9 @@ function RolePlugin.bind(Role)
1674 local dataSet = csvdb["shop_rechargeCsv"][rechargeId] 1704 local dataSet = csvdb["shop_rechargeCsv"][rechargeId]
1675 1705
1676 if orderObject:getProperty("finishTime") > 0 then 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 + ))
1677 return false, "finsh" 1710 return false, "finsh"
1678 end 1711 end
1679 1712
@@ -1722,7 +1755,6 @@ function RolePlugin.bind(Role) @@ -1722,7 +1755,6 @@ function RolePlugin.bind(Role)
1722 local roleId = self:getProperty("id") 1755 local roleId = self:getProperty("id")
1723 local partnerOrderStr = params.order 1756 local partnerOrderStr = params.order
1724 1757
1725 -  
1726 local status, back = self:updatePurchaseOrder(partnerOrderStr, params.transactionId, "finsh") 1758 local status, back = self:updatePurchaseOrder(partnerOrderStr, params.transactionId, "finsh")
1727 if not status then 1759 if not status then
1728 if back == "finsh" then 1760 if back == "finsh" then