Commit 00115a7a860fd7cc2e7e31516f7c8a1756388201
1 parent
4b7c7c96
奖励发放
Showing
4 changed files
with
14 additions
and
4 deletions
Show diff stats
src/actions/AdvAction.lua
@@ -45,7 +45,8 @@ function _M.roleFormatRpc(agent , data) | @@ -45,7 +45,8 @@ function _M.roleFormatRpc(agent , data) | ||
45 | for slot, heroId in pairs(msg.heros) do | 45 | for slot, heroId in pairs(msg.heros) do |
46 | advTeam.heros[slot] = heroId | 46 | advTeam.heros[slot] = heroId |
47 | end | 47 | end |
48 | - role:updateProperty({field = "advTeam", value = advTeam}) | 48 | + advTeam.leader = msg.leader |
49 | + role:updateProperty({field = "advTeam", value = advTeam}) | ||
49 | SendPacket(actionCodes.Adv_roleFormatRpc, '') | 50 | SendPacket(actionCodes.Adv_roleFormatRpc, '') |
50 | return true | 51 | return true |
51 | end | 52 | end |
src/actions/HangAction.lua
@@ -146,6 +146,7 @@ function _M.endBattleRpc(agent, data) | @@ -146,6 +146,7 @@ function _M.endBattleRpc(agent, data) | ||
146 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] | 146 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] |
147 | reward[ItemId.Gold] = carbonData.money_clear | 147 | reward[ItemId.Gold] = carbonData.money_clear |
148 | reward[ItemId.Exp] = carbonData.exp_clear | 148 | reward[ItemId.Exp] = carbonData.exp_clear |
149 | + reward[ItemId.PlayerExp] = carbonData.playerExp_clear | ||
149 | for itemId, count in pairs(carbonData.item_clear:toNumMap()) do | 150 | for itemId, count in pairs(carbonData.item_clear:toNumMap()) do |
150 | reward[itemId] = count | 151 | reward[itemId] = count |
151 | end | 152 | end |
src/adv/Adv.lua
@@ -431,15 +431,20 @@ end | @@ -431,15 +431,20 @@ end | ||
431 | --关卡通关,非层 score < 0 失败 | 431 | --关卡通关,非层 score < 0 失败 |
432 | function Adv:over(success) | 432 | function Adv:over(success) |
433 | local score = -1 | 433 | local score = -1 |
434 | + local reward | ||
434 | if success then | 435 | if success then |
435 | -- todo success 计算分数 | 436 | -- todo success 计算分数 |
436 | score = 1 | 437 | score = 1 |
437 | self.owner:updateProperty({field = "advPass", self.owner:getProperty("advPass"):setv(self.advInfo.chapter, score)}) | 438 | self.owner:updateProperty({field = "advPass", self.owner:getProperty("advPass"):setv(self.advInfo.chapter, score)}) |
439 | + reward = self.owner:award(self.owner:getProperty("advItems"):toNumMap(), {}) | ||
438 | end | 440 | end |
439 | table.clear(self.advInfo) --清空advInfo | 441 | table.clear(self.advInfo) --清空advInfo |
440 | self.advTeam.player = nil --重置玩家的数据 | 442 | self.advTeam.player = nil --重置玩家的数据 |
441 | self:clear() | 443 | self:clear() |
442 | - self:backEnd(score) | 444 | + |
445 | + self.owner:updateProperty({field = "advItems", ""}) | ||
446 | + | ||
447 | + self:backEnd(score, reward) | ||
443 | end | 448 | end |
444 | 449 | ||
445 | function Adv:exit() | 450 | function Adv:exit() |
@@ -976,8 +981,8 @@ function Adv:backNext() | @@ -976,8 +981,8 @@ function Adv:backNext() | ||
976 | self:pushBackEvent(AdvBackEventType.Next, {}) | 981 | self:pushBackEvent(AdvBackEventType.Next, {}) |
977 | end | 982 | end |
978 | 983 | ||
979 | -function Adv:backEnd(score) | ||
980 | - self:pushBackEvent(AdvBackEventType.End, {score = score}) | 984 | +function Adv:backEnd(score, reward) |
985 | + self:pushBackEvent(AdvBackEventType.End, {score = score, reward = reward}) | ||
981 | end | 986 | end |
982 | 987 | ||
983 | function Adv:backBlockChange(roomId, blockId) | 988 | function Adv:backBlockChange(roomId, blockId) |
src/models/RolePlugin.lua
@@ -77,6 +77,9 @@ function RolePlugin.bind(Role) | @@ -77,6 +77,9 @@ function RolePlugin.bind(Role) | ||
77 | self:addHero(params) | 77 | self:addHero(params) |
78 | end | 78 | end |
79 | end, | 79 | end, |
80 | + [ItemType.AdvItem] = function() --冒险道具不会进入 玩家仓库 | ||
81 | + count = 0 | ||
82 | + end, | ||
80 | } | 83 | } |
81 | -- 对数量筛查 | 84 | -- 对数量筛查 |
82 | local count = checkItemCount(self, itemId, count) | 85 | local count = checkItemCount(self, itemId, count) |