Commit be697585cc6fc1c138a4865ea1671e6593e2443c
1 parent
54379452
活动剧情解锁
Showing
6 changed files
with
50 additions
and
7 deletions
Show diff stats
src/ProtocolCode.lua
| @@ -227,6 +227,7 @@ actionCodes = { | @@ -227,6 +227,7 @@ actionCodes = { | ||
| 227 | Activity_endBattleRpc = 661, | 227 | Activity_endBattleRpc = 661, |
| 228 | Activity_battleRankRpc = 662, | 228 | Activity_battleRankRpc = 662, |
| 229 | Activity_battleMilestoneRpc = 663, | 229 | Activity_battleMilestoneRpc = 663, |
| 230 | + Activity_bossRewardRpc = 664, | ||
| 230 | 231 | ||
| 231 | Radio_startQuestRpc = 700, | 232 | Radio_startQuestRpc = 700, |
| 232 | Radio_finishQuestRpc = 701, | 233 | Radio_finishQuestRpc = 701, |
src/actions/ActivityAction.lua
| @@ -493,6 +493,8 @@ function _M.startBattleRpc(agent, data) | @@ -493,6 +493,8 @@ function _M.startBattleRpc(agent, data) | ||
| 493 | end | 493 | end |
| 494 | changeFlag = true | 494 | changeFlag = true |
| 495 | end | 495 | end |
| 496 | + -- 解锁活动剧情 | ||
| 497 | + role:checkStoryStatus(false, 5, id) | ||
| 496 | 498 | ||
| 497 | if not count then | 499 | if not count then |
| 498 | role.__actBattleCache = { | 500 | role.__actBattleCache = { |
| @@ -696,6 +698,11 @@ function _M.endBattleRpc(agent, data) | @@ -696,6 +698,11 @@ function _M.endBattleRpc(agent, data) | ||
| 696 | supports = support, | 698 | supports = support, |
| 697 | }) | 699 | }) |
| 698 | 700 | ||
| 701 | + -- 解锁活动剧情 | ||
| 702 | + if newStarNum >= 3 then | ||
| 703 | + role:checkStoryStatus(false, 5, id) | ||
| 704 | + end | ||
| 705 | + | ||
| 699 | reward, change = role:award(reward, {log = {desc = "actBattle", int1 = actid, int2 = newStarNum}}) | 706 | reward, change = role:award(reward, {log = {desc = "actBattle", int1 = actid, int2 = newStarNum}}) |
| 700 | 707 | ||
| 701 | SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({ | 708 | SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({ |
| @@ -758,4 +765,27 @@ function _M.battleMilestoneRpc(agent, data) | @@ -758,4 +765,27 @@ function _M.battleMilestoneRpc(agent, data) | ||
| 758 | return true | 765 | return true |
| 759 | end | 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 | return _M | 791 | return _M |
| 762 | \ No newline at end of file | 792 | \ No newline at end of file |
src/actions/RoleAction.lua
| @@ -724,11 +724,12 @@ function _M.unLockStoryBookRpc(agent, data) | @@ -724,11 +724,12 @@ function _M.unLockStoryBookRpc(agent, data) | ||
| 724 | local storyStatus = role:getProperty("storyB") | 724 | local storyStatus = role:getProperty("storyB") |
| 725 | if storyStatus[storyId] and storyStatus[storyId].s then return end --不需要解锁 | 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 | storyStatus[storyId] = storyStatus[storyId] or {} | 735 | storyStatus[storyId] = storyStatus[storyId] or {} |
src/models/Activity.lua
| @@ -168,7 +168,7 @@ function Activity:isOpenById(id, activityType) | @@ -168,7 +168,7 @@ function Activity:isOpenById(id, activityType) | ||
| 168 | activityType = checkActivityType(activityType) | 168 | activityType = checkActivityType(activityType) |
| 169 | local cfg = csvdb["activity_ctrlCsv"][id] | 169 | local cfg = csvdb["activity_ctrlCsv"][id] |
| 170 | if not cfg then return false end | 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 | return self._isOpen[id] | 173 | return self._isOpen[id] |
| 174 | end | 174 | end |
src/models/RoleTask.lua
| @@ -358,11 +358,22 @@ function RoleTask.bind(Role) | @@ -358,11 +358,22 @@ function RoleTask.bind(Role) | ||
| 358 | return true | 358 | return true |
| 359 | end | 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 | local checkstoryStatusFunc = { | 371 | local checkstoryStatusFunc = { |
| 362 | [1] = checkStoryStatusByHang, | 372 | [1] = checkStoryStatusByHang, |
| 363 | [2] = checkStoryStatusByLove, | 373 | [2] = checkStoryStatusByLove, |
| 364 | [3] = checkStoryStatusByMultStar, | 374 | [3] = checkStoryStatusByMultStar, |
| 365 | [4] = checkStoryStatusByAdv, | 375 | [4] = checkStoryStatusByAdv, |
| 376 | + [5] = checkStoryStatusByActBattle, | ||
| 366 | } | 377 | } |
| 367 | 378 | ||
| 368 | function Role:checkStoryStatus(notNotify, stype, cond1, cond2, cond3) | 379 | function Role:checkStoryStatus(notNotify, stype, cond1, cond2, cond3) |