Commit 1e9cb2175c957835edee85f963055b21acf27e77
1 parent
55f80701
服务器记录控制引导过程
Showing
7 changed files
with
88 additions
and
22 deletions
 
Show diff stats
src/actions/AdvAction.lua
| ... | ... | @@ -450,6 +450,10 @@ function _M.useItemRpc(agent, data) | 
| 450 | 450 | adv:backUse({[itemId] = count}) | 
| 451 | 451 | end | 
| 452 | 452 | |
| 453 | + if itemId == 5020 then | |
| 454 | + role:finishGuide(53) | |
| 455 | + end | |
| 456 | + | |
| 453 | 457 | adv:checkAchievement(adv.AchievType.UseItem, count, itemId) | 
| 454 | 458 | adv:log({desc = "useItem", int1 = itemId, int2 = count}) | 
| 455 | 459 | |
| ... | ... | @@ -499,6 +503,8 @@ function _M.usePotionRpc(agent, data) | 
| 499 | 503 | adv:saveDB() | 
| 500 | 504 | role:checkTaskEnter("AdvUsePotion") | 
| 501 | 505 | |
| 506 | + role:finishGuide(61) | |
| 507 | + | |
| 502 | 508 | SendPacket(actionCodes.Adv_usePotionRpc, MsgPack.pack({events = adv:popBackEvents()})) | 
| 503 | 509 | return true | 
| 504 | 510 | end | 
| ... | ... | @@ -516,6 +522,8 @@ function _M.chooseArtifactRpc(agent, data) | 
| 516 | 522 | local status = adv:chooseArtifact(msg.idx) | 
| 517 | 523 | if not status then return 4 end | 
| 518 | 524 | adv:saveDB() | 
| 525 | + | |
| 526 | + role:finishGuide(54) | |
| 519 | 527 | |
| 520 | 528 | SendPacket(actionCodes.Adv_chooseArtifactRpc, '') | 
| 521 | 529 | return true | 
| ... | ... | @@ -539,6 +547,8 @@ function _M.wearArtifactRpc(agent, data) | 
| 539 | 547 | if not status then return 3 end | 
| 540 | 548 | adv:saveDB() | 
| 541 | 549 | |
| 550 | + role:finishGuide(55) | |
| 551 | + | |
| 542 | 552 | SendPacket(actionCodes.Adv_wearArtifactRpc, '') | 
| 543 | 553 | return true | 
| 544 | 554 | end | 
| ... | ... | @@ -568,6 +578,7 @@ function _M.upArtifactRpc(agent, data) | 
| 568 | 578 | else | 
| 569 | 579 | adv:updateAchievement() | 
| 570 | 580 | end | 
| 581 | + | |
| 571 | 582 | SendPacket(actionCodes.Adv_upArtifactRpc, '') | 
| 572 | 583 | return true | 
| 573 | 584 | end | 
| ... | ... | @@ -577,7 +588,9 @@ function _M.exitAdvRpc(agent, data) | 
| 577 | 588 | local role = agent.role | 
| 578 | 589 | -- local msg = MsgPack.unpack(data) | 
| 579 | 590 | if not isCanContinue(role) then return end | 
| 580 | - | |
| 591 | + if not role:checkOverGuide(57) then | |
| 592 | + role:saveGuide(57,1,true) | |
| 593 | + end | |
| 581 | 594 | local adv = role:getAdvData() | 
| 582 | 595 | adv:log({desc = "exit"}) | 
| 583 | 596 | local status = adv:exit() -- target {roomId = 1, blockId = 1} 选择的目标 | 
| ... | ... | @@ -638,6 +651,19 @@ function _M.endBattleRpc(agent, data) | 
| 638 | 651 | if enemy.monsterId ~= monsterId or enemy.roomId ~= roomId or enemy.blockId ~= blockId then return end | 
| 639 | 652 | adv.__battleCache = nil | 
| 640 | 653 | |
| 654 | + -- 打完野猪怪 | |
| 655 | + role:finishGuide(52) | |
| 656 | + -- 调理剂使用引导(生命药剂) | |
| 657 | + if not role:checkOverGuide(61) then | |
| 658 | + local potionBag = role:getProperty("potionBag") | |
| 659 | + local own = potionBag[10] or 0 | |
| 660 | + if own > 0 then | |
| 661 | + -- 造假 | |
| 662 | + player.hp = player.hp * 0.8 | |
| 663 | + role:saveGuide(61,1,true) | |
| 664 | + end | |
| 665 | + end | |
| 666 | + | |
| 641 | 667 | adv:log({desc = "endBattle"}) | 
| 642 | 668 | local status = adv:clickBlock(roomId, blockId, {player = player, bySkill = bySkill}) | 
| 643 | 669 | |
| ... | ... | @@ -720,7 +746,7 @@ function _M.wheelSurfRpc(agent, data) | 
| 720 | 746 | table.insert(backReward, gift) | 
| 721 | 747 | end | 
| 722 | 748 | role:award(reward, {log = {desc = "advWheelSurf", int1 = ptype}}) | 
| 723 | - | |
| 749 | + role:finishGuide(58) | |
| 724 | 750 | role:checkTaskEnter("AdvDraw", {count = count, ptype = ptype}) | 
| 725 | 751 | role:log("adv_action", {desc = "advWheelSurf", int1 = ptype, int2 = count}) | 
| 726 | 752 | |
| ... | ... | @@ -775,7 +801,7 @@ function _M.finishAchievRpc(agent, data) | 
| 775 | 801 | if not status then return end | 
| 776 | 802 | adv:updateAchievement() | 
| 777 | 803 | role:log("adv_action", {desc = "finishAchiev", short1 = ctype, int1 = chapterId, int2 = taskId}) | 
| 778 | - | |
| 804 | + role:finishGuide(57) | |
| 779 | 805 | SendPacket(actionCodes.Adv_finishAchievRpc, MsgPack.pack(role:packReward(reward, change))) | 
| 780 | 806 | return true | 
| 781 | 807 | end | ... | ... | 
src/actions/DinerAction.lua
| ... | ... | @@ -104,7 +104,7 @@ function _M.addSellRpc( agent, data ) | 
| 104 | 104 | if change then | 
| 105 | 105 | role.dinerData:updateProperty({field = "customer", value = customer}) | 
| 106 | 106 | end | 
| 107 | - | |
| 107 | + role:finishGuide(28) | |
| 108 | 108 | role:log("diner_action", {desc = "addSell", int1 = dish, int2 = count}) | 
| 109 | 109 | |
| 110 | 110 | role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) | 
| ... | ... | @@ -407,7 +407,7 @@ function _M.talentUpRpc( agent, data ) | 
| 407 | 407 | -- end | 
| 408 | 408 | |
| 409 | 409 | role:checkTaskEnter("DinerTalentUp", {type = talentData.effect:toArray(true,"=")[1], level = dishLevel + 1}) | 
| 410 | - | |
| 410 | + role:finishGuide(27) | |
| 411 | 411 | role:log("diner_action", {desc = "talentUp", int1 = dish, int2 = dishLevel + 1}) | 
| 412 | 412 | |
| 413 | 413 | SendPacket(actionCodes.Diner_talentUpRpc, '') | 
| ... | ... | @@ -612,7 +612,7 @@ function _M.refreshTaskRpc( agent, data ) | 
| 612 | 612 | end | 
| 613 | 613 | |
| 614 | 614 | role:log("diner_action", {desc = "reTask"}) | 
| 615 | - | |
| 615 | + role:finishGuide(41) | |
| 616 | 616 | role.dinerData:updateProperty({field = "order", value = json.encode(orders)}) | 
| 617 | 617 | |
| 618 | 618 | SendPacket(actionCodes.Diner_refreshTaskRpc, '') | 
| ... | ... | @@ -653,7 +653,7 @@ function _M.addWantFoodRpc(agent , data) | 
| 653 | 653 | end | 
| 654 | 654 | |
| 655 | 655 | role:log("diner_action", {desc = "wantFood"}) | 
| 656 | - | |
| 656 | + role:finishGuide(36) | |
| 657 | 657 | role.dinerData:updateProperty({field = "gfood", value = gfood}) | 
| 658 | 658 | |
| 659 | 659 | SendPacket(actionCodes.Diner_addWantFoodRpc, '') | ... | ... | 
src/actions/HangAction.lua
| ... | ... | @@ -247,6 +247,23 @@ function _M.endBattleRpc(agent, data) | 
| 247 | 247 | local team = role:getProperty("pvpTC") | 
| 248 | 248 | role:log("hang_action", {desc = "hangBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = carbonId, int2 = role:getProperty("hangTBV"), cint1 = role:getHerosCamp(team.heros)}) | 
| 249 | 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 | |
| 266 | + | |
| 250 | 267 | SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({ | 
| 251 | 268 | starNum = msg.starNum, | 
| 252 | 269 | reward = reward, | ... | ... | 
src/actions/HeroAction.lua
| ... | ... | @@ -32,6 +32,10 @@ function _M.levelUpRpc( agent, data ) | 
| 32 | 32 | |
| 33 | 33 | hero:log({desc = "levelUp", int1 = hero:getProperty("level")}) | 
| 34 | 34 | |
| 35 | + if hero:getProperty("type") == 103 then | |
| 36 | + role:finishGuide(7) | |
| 37 | + end | |
| 38 | + | |
| 35 | 39 | role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")}) | 
| 36 | 40 | SendPacket(actionCodes.Hero_levelUpRpc, '') | 
| 37 | 41 | return true | 
| ... | ... | @@ -523,6 +527,8 @@ function _M.referEquipsRpc(agent, data) | 
| 523 | 527 | -- 更新角色 | 
| 524 | 528 | hero:updateProperty({field = "equip", value = curEquip}) | 
| 525 | 529 | |
| 530 | + role:finishGuide(23) | |
| 531 | + | |
| 526 | 532 | SendPacket(actionCodes.Hero_referEquipsRpc, "") | 
| 527 | 533 | return true | 
| 528 | 534 | end | 
| ... | ... | @@ -688,7 +694,6 @@ function _M.unuse_drawHeroRpc(agent, data) | 
| 688 | 694 | if not role:isFuncUnlock(FuncUnlock.GetHero) then return end | 
| 689 | 695 | local btype = msg.pool -- 1 2 3 4 | 
| 690 | 696 | local drawType = msg.type -- 1 单抽 2 十连 | 
| 691 | - local guide = msg.guide -- 是否是引导抽的 | |
| 692 | 697 | |
| 693 | 698 | local buildTypeData = csvdb["build_typeCsv"][btype] | 
| 694 | 699 | if not buildTypeData then return 1 end | 
| ... | ... | @@ -829,6 +834,12 @@ function _M.unuse_drawHeroRpc(agent, data) | 
| 829 | 834 | newerHadSSR = newerDraw[2] or 0 | 
| 830 | 835 | end | 
| 831 | 836 | |
| 837 | + local guideHero | |
| 838 | + local funcGuide = role:getProperty("funcGuide") | |
| 839 | + if funcGuide:getv(11001,0) == 1 and funcGuide:getv(12001,0) == 0 then | |
| 840 | + guideHero = 613 | |
| 841 | + end | |
| 842 | + | |
| 832 | 843 | local ssrCount = 0 | 
| 833 | 844 | local reward = {} | 
| 834 | 845 | for i = 1, drawCount[drawType] do | 
| ... | ... | @@ -858,7 +869,11 @@ function _M.unuse_drawHeroRpc(agent, data) | 
| 858 | 869 | end | 
| 859 | 870 | |
| 860 | 871 | -- 引导必送 613 丝路德 | 
| 861 | - local itemId = guide and 613 or math.randWeight(resultPool, 1) | |
| 872 | + local itemId = math.randWeight(resultPool, 1) | |
| 873 | + if guideHero then | |
| 874 | + itemId = guideHero | |
| 875 | + guideHero = nil | |
| 876 | + end | |
| 862 | 877 | local itemData = csvdb["itemCsv"][itemId] | 
| 863 | 878 | if itemData.quality == 4 then | 
| 864 | 879 | ssrCount = ssrCount + 1 | 
| ... | ... | @@ -910,6 +925,8 @@ function _M.unuse_drawHeroRpc(agent, data) | 
| 910 | 925 | -- role:updateProperty({field = "repayHero", value = repayHero}) | 
| 911 | 926 | -- end | 
| 912 | 927 | |
| 928 | + role:finishGuide(11) | |
| 929 | + | |
| 913 | 930 | role:checkTaskEnter("DrawHero", {pool = btype, count = drawCount[drawType]}) | 
| 914 | 931 | if ssrCount > 0 then | 
| 915 | 932 | role:checkTaskEnter("DrawSSR", {count = ssrCount}) | ... | ... | 
src/actions/RoleAction.lua
| ... | ... | @@ -1031,6 +1031,9 @@ function _M.guideRpc(agent, data) | 
| 1031 | 1031 | |
| 1032 | 1032 | role:saveGuide(master, slave) | 
| 1033 | 1033 | funcGuide = funcGuide:setv(master * 1000 + slave, 1) | 
| 1034 | + if funcGuide:getv(master * 1000,0) == 0 then | |
| 1035 | + funcGuide = funcGuide:setv(master * 1000, 1) | |
| 1036 | + end | |
| 1034 | 1037 | role:updateProperty({field = "funcGuide", value = funcGuide}) | 
| 1035 | 1038 | role:log("onGuidePoint", {guild_type = 0, guild_id = master, guild_point = slave, guild_pass = 0}) | 
| 1036 | 1039 | elseif cmdType == 2 then | ... | ... | 
src/adv/Adv.lua
| ... | ... | @@ -1357,6 +1357,10 @@ local function clickDrop(self, room, block, params) | 
| 1357 | 1357 | |
| 1358 | 1358 | local reward = self:award({[block.event.item[1]] = block.event.item[2]}, {log = {desc = "clickDrop"}}) | 
| 1359 | 1359 | -- local reward = self:award({[5801] = 1}) | 
| 1360 | + -- 获取绷带的引导 | |
| 1361 | + if block.event.item[1] == 5020 and not self.owner:checkOverGuide(53,2) then | |
| 1362 | + self.owner:saveGuide(53,2) | |
| 1363 | + end | |
| 1360 | 1364 | block:clear() | 
| 1361 | 1365 | self:backReward(reward, {roomId = room.roomId, blockId = block.blockId}) | 
| 1362 | 1366 | return true | ... | ... | 
src/models/RolePlugin.lua
| ... | ... | @@ -1418,15 +1418,6 @@ function RolePlugin.bind(Role) | 
| 1418 | 1418 | return RANK_ADV[idx] | 
| 1419 | 1419 | end | 
| 1420 | 1420 | |
| 1421 | - -- 是否需要进行引导 | |
| 1422 | - function Role:checkOverGuide(guideId) | |
| 1423 | - local funcGuide = self:getProperty("funcGuide") | |
| 1424 | - if funcGuide:getv(guideId, 0) > 0 then | |
| 1425 | - return true | |
| 1426 | - end | |
| 1427 | - return false | |
| 1428 | - end | |
| 1429 | - | |
| 1430 | 1421 | -- 消除指定tag 红点 | 
| 1431 | 1422 | function Role:clearRedPTag(tag) | 
| 1432 | 1423 | local redp = self:getProperty("redp") | 
| ... | ... | @@ -1567,16 +1558,24 @@ function RolePlugin.bind(Role) | 
| 1567 | 1558 | self.sendMailFlag = true | 
| 1568 | 1559 | end | 
| 1569 | 1560 | |
| 1561 | + -- 是否需要进行引导 | |
| 1562 | + function Role:checkOverGuide(guideId,slave) | |
| 1563 | + local funcGuide = self:getProperty("funcGuide") | |
| 1564 | + if funcGuide:getv(guideId * 1000 + (slave or 0), 0) > 0 then | |
| 1565 | + return true | |
| 1566 | + end | |
| 1567 | + return false | |
| 1568 | + end | |
| 1569 | + | |
| 1570 | 1570 | -- 保存引导步骤 | 
| 1571 | - function Role:saveGuide(master,slave) | |
| 1571 | + function Role:saveGuide(master,slave,force) | |
| 1572 | 1572 | local newerGuide = self:getProperty("newerGuide") | 
| 1573 | 1573 | local guide = newerGuide:toArray(true,"=") | 
| 1574 | 1574 | local sMaster, sSlave = guide[1], guide[2] | 
| 1575 | 1575 | |
| 1576 | - if master < sMaster and slave < sSlave then return end | |
| 1576 | + if not force and master < sMaster then return end | |
| 1577 | + if not force and master <= sMaster and slave < sSlave then return end | |
| 1577 | 1578 | |
| 1578 | - local guideCsv = csvdb["guide_mainCsv"] | |
| 1579 | - if not guideCsv[master] or not guideCsv[master][slave] then return end | |
| 1580 | 1579 | self:log("guide", {desc = "guide_new",int1 = master*1000+slave}) | 
| 1581 | 1580 | |
| 1582 | 1581 | newerGuide = string.format("%d=%d",master,slave) | ... | ... |