Commit 1afacce8764d2957ff5782319ba1c82e7019888c
Merge branch 'develop' into qa
Showing
12 changed files
with
311 additions
and
100 deletions
Show diff stats
src/ProtocolCode.lua
| @@ -90,6 +90,7 @@ actionCodes = { | @@ -90,6 +90,7 @@ actionCodes = { | ||
| 90 | Hero_drawHeroRpc = 220, | 90 | Hero_drawHeroRpc = 220, |
| 91 | Hero_repayHeroRpc = 221, | 91 | Hero_repayHeroRpc = 221, |
| 92 | Hero_unlockPoolRpc = 222, | 92 | Hero_unlockPoolRpc = 222, |
| 93 | + Hero_changeCrown = 223, | ||
| 93 | 94 | ||
| 94 | Hang_startRpc = 251, | 95 | Hang_startRpc = 251, |
| 95 | Hang_checkRpc = 252, | 96 | Hang_checkRpc = 252, |
src/actions/AdvAction.lua
| @@ -550,8 +550,6 @@ function _M.chooseArtifactRpc(agent, data) | @@ -550,8 +550,6 @@ function _M.chooseArtifactRpc(agent, data) | ||
| 550 | local status = adv:chooseArtifact(msg.idx) | 550 | local status = adv:chooseArtifact(msg.idx) |
| 551 | if not status then return 4 end | 551 | if not status then return 4 end |
| 552 | adv:saveDB() | 552 | adv:saveDB() |
| 553 | - | ||
| 554 | - role:finishGuide(54) | ||
| 555 | 553 | ||
| 556 | SendPacket(actionCodes.Adv_chooseArtifactRpc, '') | 554 | SendPacket(actionCodes.Adv_chooseArtifactRpc, '') |
| 557 | return true | 555 | return true |
src/actions/HangAction.lua
| @@ -209,6 +209,7 @@ function _M.endBattleRpc(agent, data) | @@ -209,6 +209,7 @@ function _M.endBattleRpc(agent, data) | ||
| 209 | return true | 209 | return true |
| 210 | end | 210 | end |
| 211 | local carbonId = msg.carbonId | 211 | local carbonId = msg.carbonId |
| 212 | + local isWin = msg.starNum and msg.starNum > 0 | ||
| 212 | local carbonData = csvdb["idle_battleCsv"][carbonId] | 213 | local carbonData = csvdb["idle_battleCsv"][carbonId] |
| 213 | if not carbonData then | 214 | if not carbonData then |
| 214 | return 2 | 215 | return 2 |
| @@ -222,8 +223,9 @@ function _M.endBattleRpc(agent, data) | @@ -222,8 +223,9 @@ function _M.endBattleRpc(agent, data) | ||
| 222 | if role:checkHangPass(carbonId) then | 223 | if role:checkHangPass(carbonId) then |
| 223 | return 4 | 224 | return 4 |
| 224 | end | 225 | end |
| 226 | + | ||
| 225 | local reward, change | 227 | local reward, change |
| 226 | - if msg.starNum and msg.starNum > 0 then --win | 228 | + if isWin then --win |
| 227 | role:hangFinish(carbonId) | 229 | role:hangFinish(carbonId) |
| 228 | if carbonData.main ~= 1 then | 230 | if carbonData.main ~= 1 then |
| 229 | hangInfo.bossTime = nil | 231 | hangInfo.bossTime = nil |
| @@ -239,30 +241,35 @@ function _M.endBattleRpc(agent, data) | @@ -239,30 +241,35 @@ function _M.endBattleRpc(agent, data) | ||
| 239 | reward, change = role:award(reward, {log = {desc = "hangBattle", int1 = carbonId}}) | 241 | reward, change = role:award(reward, {log = {desc = "hangBattle", int1 = carbonId}}) |
| 240 | 242 | ||
| 241 | role:checkTaskEnter("HangPass", {id = carbonId}) | 243 | role:checkTaskEnter("HangPass", {id = carbonId}) |
| 244 | + | ||
| 245 | + -- 引导 | ||
| 246 | + if carbonId == 10101 then | ||
| 247 | + role:finishGuide(5) | ||
| 248 | + elseif carbonId == 10102 then | ||
| 249 | + role:finishGuide(8) | ||
| 250 | + elseif carbonId == 10103 then | ||
| 251 | + role:finishGuide(9) | ||
| 252 | + elseif carbonId == 10220 then | ||
| 253 | + role:finishGuide(22) | ||
| 254 | + end | ||
| 255 | + for _, guideData in pairs(csvdb["guide_unlockCsv"]) do | ||
| 256 | + if guideData.type == 3 and guideData.carbonId == carbonId then | ||
| 257 | + role:saveGuide(guideData.guideId,1,true) | ||
| 258 | + break | ||
| 259 | + end | ||
| 260 | + end | ||
| 242 | end | 261 | end |
| 243 | if hangInfo.carbonId < carbonId then | 262 | if hangInfo.carbonId < carbonId then |
| 244 | hangInfo.carbonId = carbonId | 263 | hangInfo.carbonId = carbonId |
| 245 | end | 264 | end |
| 246 | role:updateProperty({field = "hangInfo", value = hangInfo}) | 265 | role:updateProperty({field = "hangInfo", value = hangInfo}) |
| 247 | 266 | ||
| 248 | - local team = role:getProperty("pvpTC") | ||
| 249 | - | ||
| 250 | - -- 引导 | ||
| 251 | - if carbonId == 10101 then | ||
| 252 | - role:finishGuide(5) | ||
| 253 | - elseif carbonId == 10102 then | ||
| 254 | - role:finishGuide(8) | ||
| 255 | - elseif carbonId == 10103 then | ||
| 256 | - role:finishGuide(9) | ||
| 257 | - elseif carbonId == 10220 then | ||
| 258 | - role:finishGuide(22) | ||
| 259 | - end | ||
| 260 | - for _, guideData in pairs(csvdb["guide_unlockCsv"]) do | ||
| 261 | - if guideData.type == 3 and guideData.carbonId == carbonId then | ||
| 262 | - role:saveGuide(guideData.guideId,1,true) | ||
| 263 | - break | ||
| 264 | - end | ||
| 265 | - end | 267 | + role:checkBattle("hang", { |
| 268 | + id = carbonId, | ||
| 269 | + isWin = isWin, | ||
| 270 | + info = msg.info, | ||
| 271 | + reward = reward, | ||
| 272 | + }) | ||
| 266 | 273 | ||
| 267 | SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({ | 274 | SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({ |
| 268 | starNum = msg.starNum, | 275 | starNum = msg.starNum, |
| @@ -329,6 +336,17 @@ function _M.getRewardRpc(agent , data) | @@ -329,6 +336,17 @@ function _M.getRewardRpc(agent , data) | ||
| 329 | if reward[ItemId.Gold] then | 336 | if reward[ItemId.Gold] then |
| 330 | role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]}) | 337 | role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]}) |
| 331 | end | 338 | end |
| 339 | + | ||
| 340 | + role:log("residence_reward", { | ||
| 341 | + mission_threadid = math.floor(hangInfo.carbonId / 10000), --大关卡ID | ||
| 342 | + mission_id = hangInfo.carbonId, --关卡ID | ||
| 343 | + mission_type = 100, --关卡类型,见关卡类型枚举表 | ||
| 344 | + residence_reward_type = 0, --领取奖励方式,快速(超前领取)记录为1,正常领取记录为0 | ||
| 345 | + residence_time = 0, --挂机或排名时长 | ||
| 346 | + residence_reward = reward, --获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} | ||
| 347 | + }) | ||
| 348 | + | ||
| 349 | + | ||
| 332 | SendPacket(actionCodes.Hang_getRewardRpc, MsgPack.pack({ | 350 | SendPacket(actionCodes.Hang_getRewardRpc, MsgPack.pack({ |
| 333 | reward = reward, | 351 | reward = reward, |
| 334 | change = change | 352 | change = change |
| @@ -336,65 +354,6 @@ function _M.getRewardRpc(agent , data) | @@ -336,65 +354,6 @@ function _M.getRewardRpc(agent , data) | ||
| 336 | return true | 354 | return true |
| 337 | end | 355 | end |
| 338 | 356 | ||
| 339 | --- function _M.getRewardItemRpc(agent , data) | ||
| 340 | --- local role = agent.role | ||
| 341 | --- checkReward(role) | ||
| 342 | --- local items = role:getProperty("hangBag") | ||
| 343 | --- if not next(items) then return end | ||
| 344 | - | ||
| 345 | --- local notNeed = {[ItemId.Gold] = 1, [ItemId.Exp] = 1, [ItemId.PlayerExp] = 1} | ||
| 346 | --- local reward = {} | ||
| 347 | --- for itemId , count in pairs(items) do | ||
| 348 | --- if not notNeed[itemId] then | ||
| 349 | --- reward[itemId] = count | ||
| 350 | --- items[itemId] = nil | ||
| 351 | --- end | ||
| 352 | --- end | ||
| 353 | --- if not next(reward) then return end | ||
| 354 | --- local reward = role:award(reward) | ||
| 355 | - | ||
| 356 | --- local hangInfo = role:getProperty("hangInfo") | ||
| 357 | --- local nowTime = skynet.timex() | ||
| 358 | --- hangInfo.endItemTime = nowTime + globalCsv.idle_producetime_max | ||
| 359 | --- hangInfo.itemTime = nowTime | ||
| 360 | --- role:updateProperty({field = "hangBag", value = items}) | ||
| 361 | --- role:updateProperty({field = "hangInfo", value = hangInfo}) | ||
| 362 | - | ||
| 363 | --- SendPacket(actionCodes.Hang_getRewardItemRpc, MsgPack.pack({ | ||
| 364 | --- reward = reward | ||
| 365 | --- })) | ||
| 366 | --- return true | ||
| 367 | --- end | ||
| 368 | - | ||
| 369 | --- function _M.getRewardCoinRpc(agent , data) | ||
| 370 | --- local role = agent.role | ||
| 371 | --- checkReward(role) | ||
| 372 | --- local items = role:getProperty("hangBag") | ||
| 373 | --- if not next(items) then return end | ||
| 374 | - | ||
| 375 | --- local need = {[ItemId.Gold] = 1, [ItemId.Exp] = 1, [ItemId.PlayerExp] = 1} | ||
| 376 | --- local reward = {} | ||
| 377 | --- for itemId , count in pairs(items) do | ||
| 378 | --- if need[itemId] then | ||
| 379 | --- reward[itemId] = count | ||
| 380 | --- items[itemId] = nil | ||
| 381 | --- end | ||
| 382 | --- end | ||
| 383 | --- local reward = role:award(reward) | ||
| 384 | - | ||
| 385 | --- local hangInfo = role:getProperty("hangInfo") | ||
| 386 | --- local nowTime = skynet.timex() | ||
| 387 | --- hangInfo.endCoinTime = nowTime + globalCsv.idle_producetime_max | ||
| 388 | --- hangInfo.coinTime = nowTime | ||
| 389 | --- role:updateProperty({field = "hangBag", value = items}) | ||
| 390 | --- role:updateProperty({field = "hangInfo", value = hangInfo}) | ||
| 391 | - | ||
| 392 | --- SendPacket(actionCodes.Hang_getRewardCoinRpc, MsgPack.pack({ | ||
| 393 | --- reward = reward | ||
| 394 | --- })) | ||
| 395 | --- return true | ||
| 396 | --- end | ||
| 397 | - | ||
| 398 | function _M.quickRpc(agent , data) | 357 | function _M.quickRpc(agent , data) |
| 399 | local role = agent.role | 358 | local role = agent.role |
| 400 | 359 | ||
| @@ -446,6 +405,15 @@ function _M.quickRpc(agent , data) | @@ -446,6 +405,15 @@ function _M.quickRpc(agent , data) | ||
| 446 | role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]}) | 405 | role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]}) |
| 447 | end | 406 | end |
| 448 | role:checkTaskEnter("HangQuick") | 407 | role:checkTaskEnter("HangQuick") |
| 408 | + | ||
| 409 | + role:log("residence_reward", { | ||
| 410 | + mission_threadid = math.floor(hangInfo.carbonId / 10000), --大关卡ID | ||
| 411 | + mission_id = hangInfo.carbonId, --关卡ID | ||
| 412 | + mission_type = 100, --关卡类型,见关卡类型枚举表 | ||
| 413 | + residence_reward_type = 1, --领取奖励方式,快速(超前领取)记录为1,正常领取记录为0 | ||
| 414 | + residence_time = time, --挂机或排名时长 | ||
| 415 | + residence_reward = reward, --获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} | ||
| 416 | + }) | ||
| 449 | SendPacket(actionCodes.Hang_quickRpc, MsgPack.pack({ | 417 | SendPacket(actionCodes.Hang_quickRpc, MsgPack.pack({ |
| 450 | reward = reward, | 418 | reward = reward, |
| 451 | change = change | 419 | change = change |
| @@ -571,6 +539,12 @@ function _M.endBonusBattleRpc(agent, data) | @@ -571,6 +539,12 @@ function _M.endBonusBattleRpc(agent, data) | ||
| 571 | role:checkTaskEnter("BonusPass", {id = id}) | 539 | role:checkTaskEnter("BonusPass", {id = id}) |
| 572 | end | 540 | end |
| 573 | 541 | ||
| 542 | + role:checkBattle("bonus", { | ||
| 543 | + id = id, | ||
| 544 | + isWin = starNum and starNum > 0, | ||
| 545 | + info = msg.info, | ||
| 546 | + reward = reward, | ||
| 547 | + }) | ||
| 574 | SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({ | 548 | SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({ |
| 575 | starNum = starNum, | 549 | starNum = starNum, |
| 576 | reward = reward, | 550 | reward = reward, |
src/actions/HeroAction.lua
| @@ -453,7 +453,7 @@ function _M.referEquipsRpc(agent, data) | @@ -453,7 +453,7 @@ function _M.referEquipsRpc(agent, data) | ||
| 453 | local hero = role.heros[msg.id] | 453 | local hero = role.heros[msg.id] |
| 454 | if not hero then return 10 end | 454 | if not hero then return 10 end |
| 455 | local equips = msg.equips | 455 | local equips = msg.equips |
| 456 | - local isAuto = msg.isAuth | 456 | + local isAuto = msg.isAuto |
| 457 | if not equips or not next(equips) then return 11 end | 457 | if not equips or not next(equips) then return 11 end |
| 458 | 458 | ||
| 459 | for typ = 1, 4 do -- 4件装备 | 459 | for typ = 1, 4 do -- 4件装备 |
| @@ -788,8 +788,11 @@ function _M.drawHeroRpc(agent, data) | @@ -788,8 +788,11 @@ function _M.drawHeroRpc(agent, data) | ||
| 788 | local heroData = csvdb["unitCsv"][itemData.id - ItemStartId.Hero] | 788 | local heroData = csvdb["unitCsv"][itemData.id - ItemStartId.Hero] |
| 789 | if not heroData then break end | 789 | if not heroData then break end |
| 790 | local ok = true | 790 | local ok = true |
| 791 | - for idx, field in ipairs(condition) do | ||
| 792 | - if heroData[field] ~= values[idx] then ok = false break end | 791 | + -- 保底是全随机,不用比较类型 |
| 792 | + if not isFloorBack then | ||
| 793 | + for idx, field in ipairs(condition) do | ||
| 794 | + if heroData[field] ~= values[idx] then ok = false break end | ||
| 795 | + end | ||
| 793 | end | 796 | end |
| 794 | if not ok then break end | 797 | if not ok then break end |
| 795 | if oneData[pool_str] > 0 then | 798 | if oneData[pool_str] > 0 then |
| @@ -804,7 +807,7 @@ function _M.drawHeroRpc(agent, data) | @@ -804,7 +807,7 @@ function _M.drawHeroRpc(agent, data) | ||
| 804 | role:costItems(cost, {log = {desc = "drawHero", int1 = btype, int2 = poolId}}) | 807 | role:costItems(cost, {log = {desc = "drawHero", int1 = btype, int2 = poolId}}) |
| 805 | 808 | ||
| 806 | local guideHero | 809 | local guideHero |
| 807 | - if role:checkOverGuide(11) and not role:checkOverGuide(12) then | 810 | + if role:getProperty("newerGuide") == "11=1" then |
| 808 | guideHero = 613 | 811 | guideHero = 613 |
| 809 | end | 812 | end |
| 810 | 813 | ||
| @@ -938,19 +941,18 @@ function _M.unlockPoolRpc(agent, data) | @@ -938,19 +941,18 @@ function _M.unlockPoolRpc(agent, data) | ||
| 938 | return true | 941 | return true |
| 939 | end | 942 | end |
| 940 | 943 | ||
| 941 | -function _M.changeCrownRpc(agnet, data) | 944 | +function _M.changeCrown(agnet, data) |
| 942 | local role = agent.role | 945 | local role = agent.role |
| 943 | local msg = MsgPack.unpack(data) | 946 | local msg = MsgPack.unpack(data) |
| 944 | 947 | ||
| 945 | local heroType = msg.heroType | 948 | local heroType = msg.heroType |
| 946 | 949 | ||
| 947 | - if not role:isHaveHero(heroType) then return end | 950 | + if not role:isHaveHero(heroType) then return true end |
| 948 | role:setProperty("crown", heroType) | 951 | role:setProperty("crown", heroType) |
| 949 | 952 | ||
| 950 | role:log("hero_show", { | 953 | role:log("hero_show", { |
| 951 | hero_id = heroType, | 954 | hero_id = heroType, |
| 952 | }) | 955 | }) |
| 953 | - SendPacket(actionCodes.Hero_changeCrownRpc, "") | ||
| 954 | return true | 956 | return true |
| 955 | end | 957 | end |
| 956 | 958 |
src/actions/PvpAction.lua
| @@ -335,11 +335,6 @@ function _M.endBattleRpc(agent, data) | @@ -335,11 +335,6 @@ function _M.endBattleRpc(agent, data) | ||
| 335 | local reward, change = role:award({[temp[1]] = temp[2]}, {log = {desc = "pvpBattleC"}}) | 335 | local reward, change = role:award({[temp[1]] = temp[2]}, {log = {desc = "pvpBattleC"}}) |
| 336 | local myScore, matchScore, oldmyScore, oldMatchScore, myRank, oldMyRank = role:changePvpScoreCommon(match.t == 1 and match.id or -1, isWin) | 336 | local myScore, matchScore, oldmyScore, oldMatchScore, myRank, oldMyRank = role:changePvpScoreCommon(match.t == 1 and match.id or -1, isWin) |
| 337 | 337 | ||
| 338 | - _pvpBattleInfoCacheC = {} --重新发阵容了 没毛病 | ||
| 339 | - _pvpRecordInfoCacheC = {} -- 记录刷新了 | ||
| 340 | - _pvpRecordBattleInfoCacheC = {} -- 取新纪录的时候搞 | ||
| 341 | - _pvpStartBattleCacheC = nil | ||
| 342 | - | ||
| 343 | -- 请求上传录像 | 338 | -- 请求上传录像 |
| 344 | local params = { | 339 | local params = { |
| 345 | ["roleid"] = roleId, | 340 | ["roleid"] = roleId, |
| @@ -388,7 +383,22 @@ function _M.endBattleRpc(agent, data) | @@ -388,7 +383,22 @@ function _M.endBattleRpc(agent, data) | ||
| 388 | if isWin then | 383 | if isWin then |
| 389 | role:checkTaskEnter("PvpWin", {score = myScore}) | 384 | role:checkTaskEnter("PvpWin", {score = myScore}) |
| 390 | end | 385 | end |
| 386 | + | ||
| 387 | + role:checkBattle("pvpc", { | ||
| 388 | + isWin = isWin, | ||
| 389 | + info = msg.info, | ||
| 390 | + robotId = match.t == 2 and match.id or nil, | ||
| 391 | + enemy = match.t == 1 and _pvpBattleInfoCacheC[match.id] or nil, | ||
| 392 | + score = myScore, | ||
| 393 | + reward = reward, | ||
| 394 | + rank = myRank, | ||
| 395 | + }) | ||
| 391 | 396 | ||
| 397 | + _pvpBattleInfoCacheC = {} --重新发阵容了 没毛病 | ||
| 398 | + _pvpRecordInfoCacheC = {} -- 记录刷新了 | ||
| 399 | + _pvpRecordBattleInfoCacheC = {} -- 取新纪录的时候搞 | ||
| 400 | + _pvpStartBattleCacheC = nil | ||
| 401 | + | ||
| 392 | SendPacket(actionCodes.Pvp_endBattleRpc, MsgPack.pack({ | 402 | SendPacket(actionCodes.Pvp_endBattleRpc, MsgPack.pack({ |
| 393 | reward = reward, | 403 | reward = reward, |
| 394 | change = change, | 404 | change = change, |
| @@ -676,6 +686,17 @@ function _M.endBattleHRpc(agent, data) | @@ -676,6 +686,17 @@ function _M.endBattleHRpc(agent, data) | ||
| 676 | end | 686 | end |
| 677 | end) | 687 | end) |
| 678 | 688 | ||
| 689 | + role:checkBattle("pvph", { | ||
| 690 | + isWin = isWin, | ||
| 691 | + info = msg.info, | ||
| 692 | + robotId = match.t == 2 and match.id or nil, | ||
| 693 | + enemy = match.t == 1 and (revenge and _pvpRecordBattleInfoCacheH[match.id] or _pvpBattleInfoCacheH[match.id]) or nil, | ||
| 694 | + score = myScore, | ||
| 695 | + reward = reward, | ||
| 696 | + rank = myRank, | ||
| 697 | + }) | ||
| 698 | + | ||
| 699 | + | ||
| 679 | _pvpBattleInfoCacheH = {} --重新发阵容了 没毛病 | 700 | _pvpBattleInfoCacheH = {} --重新发阵容了 没毛病 |
| 680 | _pvpRecordInfoCacheH = {} -- 记录刷新了 | 701 | _pvpRecordInfoCacheH = {} -- 记录刷新了 |
| 681 | _pvpRecordBattleInfoCacheH = {} -- 取新纪录的时候搞 | 702 | _pvpRecordBattleInfoCacheH = {} -- 取新纪录的时候搞 |
| @@ -686,7 +707,7 @@ function _M.endBattleHRpc(agent, data) | @@ -686,7 +707,7 @@ function _M.endBattleHRpc(agent, data) | ||
| 686 | if isWin then | 707 | if isWin then |
| 687 | role:checkTaskEnter("PvpWin", {score = myScore}) | 708 | role:checkTaskEnter("PvpWin", {score = myScore}) |
| 688 | end | 709 | end |
| 689 | - | 710 | + |
| 690 | SendPacket(actionCodes.Pvp_endBattleHRpc, MsgPack.pack({ | 711 | SendPacket(actionCodes.Pvp_endBattleHRpc, MsgPack.pack({ |
| 691 | reward = reward, | 712 | reward = reward, |
| 692 | change = change, | 713 | change = change, |
src/actions/TowerAction.lua
| @@ -114,6 +114,21 @@ function _M.endBattleRpc(agent, data) | @@ -114,6 +114,21 @@ function _M.endBattleRpc(agent, data) | ||
| 114 | towerInfo.k = nil | 114 | towerInfo.k = nil |
| 115 | role:updateProperty({field = "towerInfo", value = towerInfo}) | 115 | role:updateProperty({field = "towerInfo", value = towerInfo}) |
| 116 | 116 | ||
| 117 | + | ||
| 118 | + local rank = redisproxy:ZREVRANK(RANK_TOWER, role:getProperty("id")) | ||
| 119 | + if not rank then | ||
| 120 | + rank = -1 | ||
| 121 | + else | ||
| 122 | + rank = rank + 1 | ||
| 123 | + end | ||
| 124 | + role:checkBattle("tower", { | ||
| 125 | + id = id, | ||
| 126 | + isWin = msg.starNum and msg.starNum > 0, | ||
| 127 | + info = msg.info, | ||
| 128 | + reward = reward, | ||
| 129 | + rank = rank, | ||
| 130 | + }) | ||
| 131 | + | ||
| 117 | SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({reward = reward, change = change})) | 132 | SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({reward = reward, change = change})) |
| 118 | return true | 133 | return true |
| 119 | end | 134 | end |
src/adv/Adv.lua
| @@ -884,6 +884,9 @@ function Adv:award(gift, params) | @@ -884,6 +884,9 @@ function Adv:award(gift, params) | ||
| 884 | 884 | ||
| 885 | if csvdb["adv_artifactCsv"][itemId] then -- 获得神器 | 885 | if csvdb["adv_artifactCsv"][itemId] then -- 获得神器 |
| 886 | self:awardArtifact(itemId, params) | 886 | self:awardArtifact(itemId, params) |
| 887 | + if not self.owner:checkOverGuide(55) then | ||
| 888 | + self.owner:saveGuide(55,1,true) | ||
| 889 | + end | ||
| 887 | else | 890 | else |
| 888 | if nums <= 0 then | 891 | if nums <= 0 then |
| 889 | items = items:delk(itemId) | 892 | items = items:delk(itemId) |
src/adv/AdvPassive.lua
| @@ -521,5 +521,17 @@ function Passive:effect13(eventType, triggerPms, eventId, count) | @@ -521,5 +521,17 @@ function Passive:effect13(eventType, triggerPms, eventId, count) | ||
| 521 | end | 521 | end |
| 522 | end | 522 | end |
| 523 | 523 | ||
| 524 | +--14=给所有场上怪物增加buff 《 限定 怪 id》 除了自己 | ||
| 525 | +function Passive:effect14(value, triggerPms, enemyId) | ||
| 526 | + local aims = self.owner.battle.player:getTeam(2) | ||
| 527 | + for k , aim in pairs(aims) do | ||
| 528 | + if aim ~= self.owner then | ||
| 529 | + if not enemyId or enemyId == 0 or aim.monsterId == enemyId then | ||
| 530 | + aim:addBuff(value, self.owner) | ||
| 531 | + end | ||
| 532 | + end | ||
| 533 | + end | ||
| 534 | +end | ||
| 535 | + | ||
| 524 | 536 | ||
| 525 | return Passive | 537 | return Passive |
| 526 | \ No newline at end of file | 538 | \ No newline at end of file |
src/models/Role.lua
| @@ -7,6 +7,7 @@ local RoleTask = import(".RoleTask") --角色任务 | @@ -7,6 +7,7 @@ local RoleTask = import(".RoleTask") --角色任务 | ||
| 7 | local RoleChangeStruct = import(".RoleChangeStruct") --角色数据额结构更改 | 7 | local RoleChangeStruct = import(".RoleChangeStruct") --角色数据额结构更改 |
| 8 | local RolePvp = import(".RolePvp") -- pvp | 8 | local RolePvp = import(".RolePvp") -- pvp |
| 9 | local RoleCross = import(".RoleCross") -- 跨服务请求相关 | 9 | local RoleCross = import(".RoleCross") -- 跨服务请求相关 |
| 10 | +local RoleBattle = import(".RoleBattle") -- 跨服务请求相关 | ||
| 10 | 11 | ||
| 11 | RoleLog.bind(Role) | 12 | RoleLog.bind(Role) |
| 12 | RolePlugin.bind(Role) | 13 | RolePlugin.bind(Role) |
| @@ -15,6 +16,7 @@ RoleTask.bind(Role) | @@ -15,6 +16,7 @@ RoleTask.bind(Role) | ||
| 15 | RoleChangeStruct.bind(Role) | 16 | RoleChangeStruct.bind(Role) |
| 16 | RolePvp.bind(Role) | 17 | RolePvp.bind(Role) |
| 17 | RoleCross.bind(Role) | 18 | RoleCross.bind(Role) |
| 19 | +RoleBattle.bind(Role) | ||
| 18 | 20 | ||
| 19 | function Role:ctor( properties ) | 21 | function Role:ctor( properties ) |
| 20 | Role.super.ctor(self, properties) | 22 | Role.super.ctor(self, properties) |
| @@ -0,0 +1,182 @@ | @@ -0,0 +1,182 @@ | ||
| 1 | +local RoleBattle = {} | ||
| 2 | + | ||
| 3 | +--[[ | ||
| 4 | + 100 剧情关卡类 | ||
| 5 | + 200 非剧情类普通关卡 | ||
| 6 | + 300 每日任务类、日常本类 | ||
| 7 | + 400 资源获取类关卡 | ||
| 8 | + 500 PVP关卡 | ||
| 9 | + 1000 活动期间限定类关卡 | ||
| 10 | + 2000 其他 | ||
| 11 | +]] | ||
| 12 | + | ||
| 13 | +local BattleType = { | ||
| 14 | + hang = 100, | ||
| 15 | + tower = 200, | ||
| 16 | + bonus = 300, | ||
| 17 | + pvpc = 500, | ||
| 18 | + pvph = 501, | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +RoleBattle.bind = function (Role) | ||
| 22 | + | ||
| 23 | + | ||
| 24 | +-- TODO 检查战斗是否作弊 | ||
| 25 | +local function checkBattleCheat() | ||
| 26 | + | ||
| 27 | +end | ||
| 28 | + | ||
| 29 | + | ||
| 30 | + | ||
| 31 | +function Role:checkBattle(battleType, params) | ||
| 32 | + local clientInfo = params.info or {} | ||
| 33 | + | ||
| 34 | + if not BattleType[battleType] then | ||
| 35 | + print(string.format("NO find battleType: %s", battleType)) | ||
| 36 | + return | ||
| 37 | + end | ||
| 38 | + | ||
| 39 | + local selflist = {} | ||
| 40 | + local heroscore = 0 | ||
| 41 | + local teamskill = {} | ||
| 42 | + local enemylist = {} | ||
| 43 | + | ||
| 44 | + local fixData = { | ||
| 45 | + hang = function() | ||
| 46 | + for slot, hero in pairs(self:getProperty("hangTS")) do | ||
| 47 | + selflist[slot] = hero.type | ||
| 48 | + end | ||
| 49 | + heroscore = self:getProperty("hangTBV") | ||
| 50 | + for slot , one in pairs(self:getProperty("hangTB").supports) do | ||
| 51 | + teamskill[one[1]] = one[2] | ||
| 52 | + end | ||
| 53 | + local carbonData = csvdb["idle_battleCsv"][params.id] | ||
| 54 | + local monsterData = csvdb[carbonData.monster:match("/([^/]*)$") .. "Csv"] | ||
| 55 | + for slot, one in pairs(monsterData[1]) do | ||
| 56 | + enemylist[#enemylist + 1] = one["unitType"] | ||
| 57 | + end | ||
| 58 | + end, | ||
| 59 | + tower = function() | ||
| 60 | + local towerF = self:getProperty("towerF") | ||
| 61 | + for slot, hero in pairs(self:getTeamHerosInfo(towerF.heros)) do | ||
| 62 | + selflist[slot] = hero.type | ||
| 63 | + end | ||
| 64 | + heroscore = self:getTeamBattleValue(towerF.heros) | ||
| 65 | + for slot , one in pairs(self:getTeamBattleInfo(towerF).supports) do | ||
| 66 | + teamskill[one[1]] = one[2] | ||
| 67 | + end | ||
| 68 | + local carbonData = csvdb["tower_battleCsv"][params.id] | ||
| 69 | + local monsterData = csvdb[carbonData.monster:match("/([^/]*)$") .. "Csv"] | ||
| 70 | + for slot, one in pairs(monsterData[1]) do | ||
| 71 | + enemylist[#enemylist + 1] = one["unitType"] | ||
| 72 | + end | ||
| 73 | + end, | ||
| 74 | + bonus = function() | ||
| 75 | + local bTeam = self:getProperty("bTeam") | ||
| 76 | + for slot, hero in pairs(self:getTeamHerosInfo(bTeam.heros)) do | ||
| 77 | + selflist[slot] = hero.type | ||
| 78 | + end | ||
| 79 | + heroscore = self:getTeamBattleValue(bTeam.heros) | ||
| 80 | + for slot , one in pairs(self:getTeamBattleInfo(bTeam).supports) do | ||
| 81 | + teamskill[one[1]] = one[2] | ||
| 82 | + end | ||
| 83 | + local carbonData = csvdb["tower_battleCsv"][params.id] | ||
| 84 | + local monsterData = csvdb[carbonData.monster:match("/([^/]*)$") .. "Csv"] | ||
| 85 | + for slot, one in pairs(monsterData[1]) do | ||
| 86 | + enemylist[#enemylist + 1] = one["unitType"] | ||
| 87 | + end | ||
| 88 | + end, | ||
| 89 | + pvpc = function() | ||
| 90 | + for slot, hero in pairs(self:getProperty("pvpTSC")) do | ||
| 91 | + selflist[slot] = hero.type | ||
| 92 | + end | ||
| 93 | + heroscore = self:getProperty("pvpTBVC") | ||
| 94 | + for slot , one in pairs(self:getProperty("pvpTBC").supports) do | ||
| 95 | + teamskill[one[1]] = one[2] | ||
| 96 | + end | ||
| 97 | + if params.robotId then | ||
| 98 | + local carbonData = csvdb["pvp_robotCsv"][params.robotId] | ||
| 99 | + local monsterData = csvdb[carbonData.monster:match("/([^/]*)$") .. "Csv"] | ||
| 100 | + for slot, one in pairs(monsterData[1]) do | ||
| 101 | + enemylist[#enemylist + 1] = one["unitType"] | ||
| 102 | + end | ||
| 103 | + else | ||
| 104 | + for slot, one in pairs((params.enemy or {})["heros"] or {}) do | ||
| 105 | + enemylist[slot] = one["type"] | ||
| 106 | + end | ||
| 107 | + end | ||
| 108 | + end, | ||
| 109 | + pvph = function() | ||
| 110 | + for idx, team in pairs(self:getProperty("pvpTSH")) do | ||
| 111 | + selflist[idx] = selflist[idx] or {} | ||
| 112 | + for slot, hero in pairs(team) do | ||
| 113 | + selflist[idx][slot] = hero.type | ||
| 114 | + end | ||
| 115 | + end | ||
| 116 | + for _, one in pairs(self:getProperty("pvpTBVH")) do | ||
| 117 | + heroscore = heroscore + one | ||
| 118 | + end | ||
| 119 | + for idx, team in pairs(self:getProperty("pvpTBH")) do | ||
| 120 | + for slot , one in pairs(team.supports) do | ||
| 121 | + teamskill[one[1]] = one[2] | ||
| 122 | + end | ||
| 123 | + end | ||
| 124 | + | ||
| 125 | + if params.robotId then | ||
| 126 | + local carbonData = csvdb["pvp_robot_groupCsv"][params.robotId] | ||
| 127 | + for idx = 1, 3 do | ||
| 128 | + enemylist[idx] = enemylist[idx] or {} | ||
| 129 | + local monsterData = csvdb[carbonData["monster" .. idx]:match("/([^/]*)$") .. "Csv"] | ||
| 130 | + for slot, one in pairs(monsterData[1]) do | ||
| 131 | + enemylist[idx][#enemylist + 1] = one["unitType"] | ||
| 132 | + end | ||
| 133 | + end | ||
| 134 | + else | ||
| 135 | + for idx, team in pairs(params.enemy or {}) do | ||
| 136 | + enemylist[idx] = enemylist[idx] or {} | ||
| 137 | + for slot, one in pairs(team["heros"] or {}) do | ||
| 138 | + enemylist[idx][slot] = one["type"] | ||
| 139 | + end | ||
| 140 | + end | ||
| 141 | + end | ||
| 142 | + end | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + if fixData[battleType] then | ||
| 146 | + fixData[battleType]() | ||
| 147 | + end | ||
| 148 | + | ||
| 149 | + -- robotId = match.t == 2 and match.id or nil, | ||
| 150 | + -- enemy = match.t == 1 and (revenge and _pvpRecordBattleInfoCacheH[match.id] or _pvpBattleInfoCacheH[match.id]) or nil, | ||
| 151 | + -- score = myScore, | ||
| 152 | + -- reward = reward, | ||
| 153 | + self:log("mission", { | ||
| 154 | + mission_threadid = battleType == "hang" and math.floor((params.id % 100) / 100) or 0, -- 大关卡ID | ||
| 155 | + mission_id = params.id or 0, -- 关卡ID | ||
| 156 | + mission_type = BattleType[battleType], -- 关卡类型,见关卡类型枚举表 | ||
| 157 | + mission_herolist = selflist, -- 英雄ID,排序以玩家出战设置为准,PVP多个队伍则记录多个列表。示例:[[1,2,3],[456]] | ||
| 158 | + mission_heroscore = heroscore, -- 编队总评分 | ||
| 159 | + mission_enemylist = enemylist, -- 地方英雄ID,排序以玩家出战设置为准,PVP多个队伍则记录多个列表。示例:[[1,2,3],[456]] | ||
| 160 | + mission_damage = clientInfo.damage or {}, -- 英雄输出值。示例:{'heroid1':1000,'heroid2':2000,………..} | ||
| 161 | + mission_ultskill = clientInfo.ultskill or {}, -- 大招使用情况。示例:{'heroid1':1000,'heroid2':2000,………..} | ||
| 162 | + mission_reward = params.reward or {}, -- 获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} | ||
| 163 | + mission_starttime = clientInfo.start or 0, -- 战斗开始时间,格式 unixtime 秒级 | ||
| 164 | + mission_roundtime = clientInfo.atime or 0, -- 对局时长(秒) | ||
| 165 | + mission_result = params.isWin and 1 or 2, -- 战斗结果(0-无效,1-胜利,2-失败) | ||
| 166 | + mission_star = 0, -- 战斗完成星数,无星级的话填写0 | ||
| 167 | + mission_restriction = 0, -- 周期内参与限制(0表示没有上限) | ||
| 168 | + mission_difficulty = 0, -- 关卡困难度,无难度区分的话填写0 | ||
| 169 | + mission_strength = 1, -- 消耗的体力或次数 | ||
| 170 | + mission_score = params.score or 0, -- 本局分数,PVP玩法记录为对战后积分,无得分的填0 | ||
| 171 | + mission_cleartype = 1, -- 1正常通关;2代理拾荒 | ||
| 172 | + mission_rank = params.rank, -- 对战后排名,适用于PVP玩法和电波塔,其他玩法留空 | ||
| 173 | + misson_monsterkill = clientInfo.kill or {}, -- 击杀怪物ID和数量,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} | ||
| 174 | + misson_teamskill = teamskill, -- 编队支援技能和技能等级情况,json格式记录,{"teamskill1":1,"teamskill2":2,………..} | ||
| 175 | + }) | ||
| 176 | +end | ||
| 177 | + | ||
| 178 | + | ||
| 179 | + | ||
| 180 | + | ||
| 181 | + | ||
| 182 | +end | ||
| 0 | \ No newline at end of file | 183 | \ No newline at end of file |
src/models/RoleLog.lua
| @@ -172,16 +172,16 @@ local MethodType = { | @@ -172,16 +172,16 @@ local MethodType = { | ||
| 172 | item_subreason = true, -- 道具流动二级原因,抽卡:卡池ID,装备强化:装备ID,副本掉落:副本ID | 172 | item_subreason = true, -- 道具流动二级原因,抽卡:卡池ID,装备强化:装备ID,副本掉落:副本ID |
| 173 | item_other = true, -- 其他(可包含阶数,强化等级,随机属性) | 173 | item_other = true, -- 其他(可包含阶数,强化等级,随机属性) |
| 174 | }, | 174 | }, |
| 175 | - mission = { --玩家副本完成情况 --TODO | 175 | + mission = { --玩家副本完成情况 |
| 176 | mission_threadid = true, -- 大关卡ID | 176 | mission_threadid = true, -- 大关卡ID |
| 177 | mission_id = true, -- 关卡ID | 177 | mission_id = true, -- 关卡ID |
| 178 | mission_type = true, -- 关卡类型,见关卡类型枚举表 | 178 | mission_type = true, -- 关卡类型,见关卡类型枚举表 |
| 179 | mission_sequenceid = "ucode", -- 本次对战ID,用于关联一次动作产生多条不同类型的日志 | 179 | mission_sequenceid = "ucode", -- 本次对战ID,用于关联一次动作产生多条不同类型的日志 |
| 180 | - mission_herolist = true, -- 英雄ID,排序以玩家出战设置为准,PVP多个队伍则记录多个列表。示例:[[1,2,3],[456]] | 180 | + mission_herolist = "json", -- 英雄ID,排序以玩家出战设置为准,PVP多个队伍则记录多个列表。示例:[[1,2,3],[456]] |
| 181 | mission_heroscore = true, -- 编队总评分 | 181 | mission_heroscore = true, -- 编队总评分 |
| 182 | - mission_enemylist = true, -- 地方英雄ID,排序以玩家出战设置为准,PVP多个队伍则记录多个列表。示例:[[1,2,3],[456]] | ||
| 183 | - mission_damage = true, -- 英雄输出值。示例:{'heroid1':1000,'heroid2':2000,………..} | ||
| 184 | - mission_ultskill = true, -- 大招使用情况。示例:{'heroid1':1000,'heroid2':2000,………..} | 182 | + mission_enemylist = "json", -- 地方英雄ID,排序以玩家出战设置为准,PVP多个队伍则记录多个列表。示例:[[1,2,3],[456]] |
| 183 | + mission_damage = "json", -- 英雄输出值。示例:{'heroid1':1000,'heroid2':2000,………..} | ||
| 184 | + mission_ultskill = "json", -- 大招使用情况。示例:{'heroid1':1000,'heroid2':2000,………..} | ||
| 185 | mission_reward = "json", -- 获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} | 185 | mission_reward = "json", -- 获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} |
| 186 | mission_starttime = true, -- 战斗开始时间,格式 unixtime 秒级 | 186 | mission_starttime = true, -- 战斗开始时间,格式 unixtime 秒级 |
| 187 | mission_roundtime = true, -- 对局时长(秒) | 187 | mission_roundtime = true, -- 对局时长(秒) |
| @@ -197,7 +197,7 @@ local MethodType = { | @@ -197,7 +197,7 @@ local MethodType = { | ||
| 197 | misson_teamskill = "json", -- 编队支援技能和技能等级情况,json格式记录,{"teamskill1":1,"teamskill2":2,………..} | 197 | misson_teamskill = "json", -- 编队支援技能和技能等级情况,json格式记录,{"teamskill1":1,"teamskill2":2,………..} |
| 198 | misson_teambond = "json", -- 编队羁绊和羁绊等级,json格式记录,{"bondid1":1,"bondid2":2,………..} | 198 | misson_teambond = "json", -- 编队羁绊和羁绊等级,json格式记录,{"bondid1":1,"bondid2":2,………..} |
| 199 | }, | 199 | }, |
| 200 | - residence_reward = { --玩家挂机或排名奖励 --TODO | 200 | + residence_reward = { --玩家挂机或排名奖励 |
| 201 | mission_threadid = true, --大关卡ID | 201 | mission_threadid = true, --大关卡ID |
| 202 | mission_id = true, --关卡ID | 202 | mission_id = true, --关卡ID |
| 203 | mission_type = true, --关卡类型,见关卡类型枚举表 | 203 | mission_type = true, --关卡类型,见关卡类型枚举表 |
| @@ -523,6 +523,7 @@ function RoleLog.bind(Role) | @@ -523,6 +523,7 @@ function RoleLog.bind(Role) | ||
| 523 | }) | 523 | }) |
| 524 | end | 524 | end |
| 525 | 525 | ||
| 526 | + | ||
| 526 | function Role:startActionUcode() | 527 | function Role:startActionUcode() |
| 527 | if not self._uniqueCount then | 528 | if not self._uniqueCount then |
| 528 | self._uniqueCount = 0 | 529 | self._uniqueCount = 0 |