Commit be697585cc6fc1c138a4865ea1671e6593e2443c

Authored by liuzujun
1 parent 54379452

活动剧情解锁

src/ProtocolCode.lua
... ... @@ -227,6 +227,7 @@ actionCodes = {
227 227 Activity_endBattleRpc = 661,
228 228 Activity_battleRankRpc = 662,
229 229 Activity_battleMilestoneRpc = 663,
  230 + Activity_bossRewardRpc = 664,
230 231  
231 232 Radio_startQuestRpc = 700,
232 233 Radio_finishQuestRpc = 701,
... ...
src/actions/ActivityAction.lua
... ... @@ -493,6 +493,8 @@ function _M.startBattleRpc(agent, data)
493 493 end
494 494 changeFlag = true
495 495 end
  496 + -- 解锁活动剧情
  497 + role:checkStoryStatus(false, 5, id)
496 498  
497 499 if not count then
498 500 role.__actBattleCache = {
... ... @@ -696,6 +698,11 @@ function _M.endBattleRpc(agent, data)
696 698 supports = support,
697 699 })
698 700  
  701 + -- 解锁活动剧情
  702 + if newStarNum >= 3 then
  703 + role:checkStoryStatus(false, 5, id)
  704 + end
  705 +
699 706 reward, change = role:award(reward, {log = {desc = "actBattle", int1 = actid, int2 = newStarNum}})
700 707  
701 708 SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({
... ... @@ -758,4 +765,27 @@ function _M.battleMilestoneRpc(agent, data)
758 765 return true
759 766 end
760 767  
  768 +function _M.bossRewardRpc(agent, data)
  769 + local role = agent.role
  770 + local msg = MsgPack.unpack(data)
  771 + local actid = msg.actid
  772 + local id = msg.id
  773 + local index = msg.index
  774 +
  775 + if not role.activity:isOpenById(actid, "ChallengeLevel") then return 1 end
  776 +
  777 + local actCfg = csvdb["activity_battleCsv"][actid]
  778 + if not actCfg then return 2 end
  779 +
  780 + local battleCfg = actCfg[id]
  781 + if not battleCfg then return 3 end
  782 +
  783 + if battleCfg.boss_reward_id == 0 then return 4 end
  784 +
  785 + --local award = mileCfg.reward:toNumMap()
  786 + --local reward, change = role:award(award, {log = {desc = "actMilestone", int1 = actid, int2 = index}})
  787 + --SendPacket(actionCodes.Activity_battleMilestoneRpc, MsgPack.pack(role:packReward(reward, change)))
  788 + return true
  789 +end
  790 +
761 791 return _M
762 792 \ No newline at end of file
... ...
src/actions/RoleAction.lua
... ... @@ -724,11 +724,12 @@ function _M.unLockStoryBookRpc(agent, data)
724 724 local storyStatus = role:getProperty("storyB")
725 725 if storyStatus[storyId] and storyStatus[storyId].s then return end --不需要解锁
726 726  
727   - local cost = storyBookData.lockItem:toNumMap()
728   - if not cost or not next(cost) then return end
729   - if not role:checkItemEnough(cost) then return end -- 消耗品不足
730   -
731   - role:costItems(cost, {log = {desc = "unlockStory", int1 = storyId}})
  727 + if storyBookData.lockItem ~= "free" then
  728 + local cost = storyBookData.lockItem:toNumMap()
  729 + if not cost or not next(cost) then return end
  730 + if not role:checkItemEnough(cost) then return end -- 消耗品不足
  731 + role:costItems(cost, {log = {desc = "unlockStory", int1 = storyId}})
  732 + end
732 733  
733 734 -- 解锁
734 735 storyStatus[storyId] = storyStatus[storyId] or {}
... ...
1   -Subproject commit 0cec95763804e1c8aca85f752732913423b8a18d
  1 +Subproject commit 591f2b4097214f9f5bf3b746f86ac704cbc9ea44
... ...
src/models/Activity.lua
... ... @@ -168,7 +168,7 @@ function Activity:isOpenById(id, activityType)
168 168 activityType = checkActivityType(activityType)
169 169 local cfg = csvdb["activity_ctrlCsv"][id]
170 170 if not cfg then return false end
171   - if cfg.showType ~= activityType then return false end
  171 + if activityType ~= 0 and cfg.showType ~= activityType then return false end
172 172  
173 173 return self._isOpen[id]
174 174 end
... ...
src/models/RoleTask.lua
... ... @@ -358,11 +358,22 @@ function RoleTask.bind(Role)
358 358 return true
359 359 end
360 360  
  361 + local function checkStoryStatusByActBattle(role, data, status, cond1) -- cond1 carbonId
  362 + local actid = data.sort
  363 + if not role.activity:isOpenById(actid) then return end
  364 + if cond1 and tonumber(data.unlockData) == cond1 then
  365 + status.s = 1
  366 + return true
  367 + end
  368 + return
  369 + end
  370 +
361 371 local checkstoryStatusFunc = {
362 372 [1] = checkStoryStatusByHang,
363 373 [2] = checkStoryStatusByLove,
364 374 [3] = checkStoryStatusByMultStar,
365 375 [4] = checkStoryStatusByAdv,
  376 + [5] = checkStoryStatusByActBattle,
366 377 }
367 378  
368 379 function Role:checkStoryStatus(notNotify, stype, cond1, cond2, cond3)
... ...