Commit 8cd3770f752dbb5189b45200d871e06749ccb813
1 parent
e621c84d
挂机关卡可以选择,经验金币根据最高关卡计算
Showing
5 changed files
with
69 additions
and
56 deletions
Show diff stats
src/actions/HangAction.lua
@@ -22,6 +22,7 @@ local function checkReward(role) | @@ -22,6 +22,7 @@ local function checkReward(role) | ||
22 | return false | 22 | return false |
23 | end | 23 | end |
24 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] | 24 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] |
25 | + local expCarbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | ||
25 | local nowCoinTime = math.min(skynet.timex(), hangInfo.endCoinTime or 0) | 26 | local nowCoinTime = math.min(skynet.timex(), hangInfo.endCoinTime or 0) |
26 | local nowItemTime = math.min(skynet.timex(), hangInfo.endItemTime or 0) | 27 | local nowItemTime = math.min(skynet.timex(), hangInfo.endItemTime or 0) |
27 | 28 | ||
@@ -39,9 +40,9 @@ local function checkReward(role) | @@ -39,9 +40,9 @@ local function checkReward(role) | ||
39 | 40 | ||
40 | local items = role:getProperty("hangBag") | 41 | local items = role:getProperty("hangBag") |
41 | coinCount = coinCount + coinDoubleCount | 42 | coinCount = coinCount + coinDoubleCount |
42 | - items[ItemId.Gold] = math.floor((items[ItemId.Gold] or 0) + coinCount * carbonData.money) | ||
43 | - items[ItemId.Exp] = math.floor((items[ItemId.Exp] or 0) + coinCount * carbonData.exp) | ||
44 | - items[ItemId.PlayerExp] = math.floor((items[ItemId.PlayerExp] or 0) + coinCount * carbonData.playerExp) | 43 | + items[ItemId.Gold] = math.floor((items[ItemId.Gold] or 0) + coinCount * expCarbonData.money) |
44 | + items[ItemId.Exp] = math.floor((items[ItemId.Exp] or 0) + coinCount * expCarbonData.exp) | ||
45 | + items[ItemId.PlayerExp] = math.floor((items[ItemId.PlayerExp] or 0) + coinCount * expCarbonData.playerExp) | ||
45 | 46 | ||
46 | local pool = {} | 47 | local pool = {} |
47 | for _, temp in pairs(carbonData.item:toArray()) do | 48 | for _, temp in pairs(carbonData.item:toArray()) do |
@@ -139,6 +140,7 @@ function _M.startRpc( agent, data ) | @@ -139,6 +140,7 @@ function _M.startRpc( agent, data ) | ||
139 | local hangInfo = role:getProperty("hangInfo") | 140 | local hangInfo = role:getProperty("hangInfo") |
140 | local isNew = not hangInfo.carbonId | 141 | local isNew = not hangInfo.carbonId |
141 | hangInfo.carbonId = carbonId | 142 | hangInfo.carbonId = carbonId |
143 | + hangInfo.expCarbonId = isNew and carbonId or hangInfo.expCarbonId | ||
142 | local nowTime = skynet.timex() | 144 | local nowTime = skynet.timex() |
143 | if isNew then | 145 | if isNew then |
144 | hangInfo.coinTime = nowTime | 146 | hangInfo.coinTime = nowTime |
@@ -193,7 +195,7 @@ function _M.startBattleRpc(agent, data) | @@ -193,7 +195,7 @@ function _M.startBattleRpc(agent, data) | ||
193 | return 1 | 195 | return 1 |
194 | end | 196 | end |
195 | 197 | ||
196 | - local hangInfo = role:getProperty("hangInfo") | 198 | + local hangInfo = role:getProperty("hangInfo") or {} |
197 | if curData.main ~= 1 then | 199 | if curData.main ~= 1 then |
198 | if carbonId ~= hangInfo.carbonId then | 200 | if carbonId ~= hangInfo.carbonId then |
199 | return 2 | 201 | return 2 |
@@ -214,7 +216,7 @@ end | @@ -214,7 +216,7 @@ end | ||
214 | function _M.endBattleRpc(agent, data) | 216 | function _M.endBattleRpc(agent, data) |
215 | local role = agent.role | 217 | local role = agent.role |
216 | local msg = MsgPack.unpack(data) | 218 | local msg = MsgPack.unpack(data) |
217 | - local hangInfo = role:getProperty("hangInfo") | 219 | + local hangInfo = role:getProperty("hangInfo") or {} |
218 | if not msg.key or msg.key ~= _BattleKey then | 220 | if not msg.key or msg.key ~= _BattleKey then |
219 | SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({errorCode = 1})) | 221 | SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({errorCode = 1})) |
220 | return true | 222 | return true |
@@ -225,6 +227,7 @@ function _M.endBattleRpc(agent, data) | @@ -225,6 +227,7 @@ function _M.endBattleRpc(agent, data) | ||
225 | if not carbonData then | 227 | if not carbonData then |
226 | return 2 | 228 | return 2 |
227 | end | 229 | end |
230 | + | ||
228 | if carbonData.main ~= 1 then | 231 | if carbonData.main ~= 1 then |
229 | if carbonId ~= hangInfo.carbonId then | 232 | if carbonId ~= hangInfo.carbonId then |
230 | return 3 | 233 | return 3 |
@@ -273,8 +276,8 @@ function _M.endBattleRpc(agent, data) | @@ -273,8 +276,8 @@ function _M.endBattleRpc(agent, data) | ||
273 | end | 276 | end |
274 | local nextCarbonId = role:getNextCarbonId(carbonId) | 277 | local nextCarbonId = role:getNextCarbonId(carbonId) |
275 | -- 设置挂机关卡 | 278 | -- 设置挂机关卡 |
276 | - if isWin and hangInfo.carbonId < nextCarbonId then | ||
277 | - hangInfo.carbonId = nextCarbonId | 279 | + if isWin and (hangInfo.carbonId or 0) < nextCarbonId then |
280 | + hangInfo.expCarbonId = nextCarbonId | ||
278 | local cfg = csvdb["idle_battleCsv"][nextCarbonId] | 281 | local cfg = csvdb["idle_battleCsv"][nextCarbonId] |
279 | if cfg then | 282 | if cfg then |
280 | hangInfo.bossTime = skynet.timex() + cfg.idle_time | 283 | hangInfo.bossTime = skynet.timex() + cfg.idle_time |
@@ -382,6 +385,7 @@ function _M.quickRpc(agent , data) | @@ -382,6 +385,7 @@ function _M.quickRpc(agent , data) | ||
382 | local hangInfo = role:getProperty("hangInfo") | 385 | local hangInfo = role:getProperty("hangInfo") |
383 | if not hangInfo.carbonId then return end | 386 | if not hangInfo.carbonId then return end |
384 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] | 387 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] |
388 | + local expCarbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | ||
385 | 389 | ||
386 | local curCount = role.dailyData:getProperty("hangQC") + 1 | 390 | local curCount = role.dailyData:getProperty("hangQC") + 1 |
387 | local costs = globalCsv.idle_quickproduce_cost:toArray(true, "=") | 391 | local costs = globalCsv.idle_quickproduce_cost:toArray(true, "=") |
@@ -398,9 +402,9 @@ function _M.quickRpc(agent , data) | @@ -398,9 +402,9 @@ function _M.quickRpc(agent , data) | ||
398 | 402 | ||
399 | local coinCount = math.floor(time / globalCsv.idle_money_produce_cd) | 403 | local coinCount = math.floor(time / globalCsv.idle_money_produce_cd) |
400 | local itemCount = math.floor(time / globalCsv.idle_item_produce_cd) | 404 | local itemCount = math.floor(time / globalCsv.idle_item_produce_cd) |
401 | - reward[ItemId.Gold] = math.floor((reward[ItemId.Gold] or 0) + coinCount * carbonData.money) | ||
402 | - reward[ItemId.Exp] = math.floor((reward[ItemId.Exp] or 0) + coinCount * carbonData.exp) | ||
403 | - reward[ItemId.PlayerExp] = math.floor((reward[ItemId.PlayerExp] or 0) + coinCount * carbonData.playerExp) | 405 | + reward[ItemId.Gold] = math.floor((reward[ItemId.Gold] or 0) + coinCount * expCarbonData.money) |
406 | + reward[ItemId.Exp] = math.floor((reward[ItemId.Exp] or 0) + coinCount * expCarbonData.exp) | ||
407 | + reward[ItemId.PlayerExp] = math.floor((reward[ItemId.PlayerExp] or 0) + coinCount * expCarbonData.playerExp) | ||
404 | 408 | ||
405 | local pool = {} | 409 | local pool = {} |
406 | for _, temp in pairs(carbonData.item:toArray()) do | 410 | for _, temp in pairs(carbonData.item:toArray()) do |
src/actions/HeroAction.lua
@@ -734,6 +734,13 @@ function _M.drawHeroRpc(agent, data) | @@ -734,6 +734,13 @@ function _M.drawHeroRpc(agent, data) | ||
734 | if btype ~= 1 then | 734 | if btype ~= 1 then |
735 | subType = 1 | 735 | subType = 1 |
736 | end | 736 | end |
737 | + | ||
738 | + if btype == 1 then | ||
739 | + -- 判断定向卡池活动开启 | ||
740 | + if not role.activity:isOpen("RaceDraw") then | ||
741 | + return | ||
742 | + end | ||
743 | + end | ||
737 | 744 | ||
738 | local buildTypeData = csvdb["build_typeCsv"][btype] | 745 | local buildTypeData = csvdb["build_typeCsv"][btype] |
739 | if not buildTypeData then return 2 end | 746 | if not buildTypeData then return 2 end |
src/actions/RoleAction.lua
@@ -615,52 +615,57 @@ end | @@ -615,52 +615,57 @@ end | ||
615 | function _M.openSpeedUpBoxRpc(agent, data) | 615 | function _M.openSpeedUpBoxRpc(agent, data) |
616 | local role = agent.role | 616 | local role = agent.role |
617 | local msg = MsgPack.unpack(data) | 617 | local msg = MsgPack.unpack(data) |
618 | - | ||
619 | - local id = msg.id | ||
620 | - local count = msg.count | ||
621 | - local itemData = csvdb["itemCsv"][id] | ||
622 | - if not itemData or itemData.type ~= ItemType.SpeedBox then return end | ||
623 | - | ||
624 | - if math.illegalNum(count, 1, role:getItemCount(id)) then return end | ||
625 | - local useType, hour = table.unpack(itemData.use_effect:toArray(true, "=")) | ||
626 | - local time = hour * 60 * 60 | 618 | + local itemInfo = msg.itemInfo |
627 | 619 | ||
628 | local reward = {} | 620 | local reward = {} |
629 | - if useType == 1 then -- 挂机齿轮 | ||
630 | - local hangInfo = role:getProperty("hangInfo") | ||
631 | - if not hangInfo.carbonId then | ||
632 | - return | ||
633 | - end | ||
634 | - local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] | ||
635 | - reward[ItemId.Gold] = math.floor(time / globalCsv.idle_money_produce_cd) * carbonData.money * count | ||
636 | - elseif useType == 2 then -- 挂机经验 | ||
637 | - local hangInfo = role:getProperty("hangInfo") | ||
638 | - if not hangInfo.carbonId then | ||
639 | - return | ||
640 | - end | ||
641 | - local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] | ||
642 | - reward[ItemId.Exp] = math.floor(time / globalCsv.idle_money_produce_cd) * carbonData.exp * count | ||
643 | - elseif useType == 3 then -- 食材商人收入 | ||
644 | - local buildType = 6 | ||
645 | - local level = role.dinerData:getProperty("buildL"):getv(buildType, 1) | ||
646 | - local buildingData = csvdb["diner_buildingCsv"][buildType][level] | ||
647 | - if not buildingData then | ||
648 | - return 1 | ||
649 | - end | ||
650 | - local gfood = role.dinerData:getProperty("gfood") | ||
651 | - if not next(gfood) then return end | ||
652 | - for k , v in pairs(gfood) do | ||
653 | - local itemId = v.id | ||
654 | - local speed = globalCsv.diner_get_food_speed[csvdb["itemCsv"][itemId].quality] * buildingData.speed / 100 | ||
655 | - reward[itemId] = math.floor(time / speed) * count | 621 | + for i = 1, #itemInfo do |
622 | + local pair = itemInfo[i] | ||
623 | + local id = pair[1] | ||
624 | + local count = pair[2] | ||
625 | + local itemData = csvdb["itemCsv"][id] | ||
626 | + if not itemData or itemData.type ~= ItemType.SpeedBox then return end | ||
627 | + | ||
628 | + if math.illegalNum(count, 1, role:getItemCount(id)) then return 1 end | ||
629 | + local useType, hour = table.unpack(itemData.use_effect:toArray(true, "=")) | ||
630 | + local time = hour * 60 * 60 | ||
631 | + | ||
632 | + if useType == 1 then -- 挂机齿轮 | ||
633 | + local hangInfo = role:getProperty("hangInfo") | ||
634 | + if not hangInfo.expCarbonId then | ||
635 | + return 2 | ||
636 | + end | ||
637 | + local carbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | ||
638 | + reward[ItemId.Gold] = (reward[ItemId.Gold] or 0) + math.floor(time / globalCsv.idle_money_produce_cd) * carbonData.money * count | ||
639 | + elseif useType == 2 then -- 挂机经验 | ||
640 | + local hangInfo = role:getProperty("hangInfo") | ||
641 | + if not hangInfo.expCarbonId then | ||
642 | + return 3 | ||
643 | + end | ||
644 | + local carbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | ||
645 | + reward[ItemId.Exp] = (reward[ItemId.Exp] or 0) + math.floor(time / globalCsv.idle_money_produce_cd) * carbonData.exp * count | ||
646 | + elseif useType == 3 then -- 食材商人收入 | ||
647 | + local buildType = 6 | ||
648 | + local level = role.dinerData:getProperty("buildL"):getv(buildType, 1) | ||
649 | + local buildingData = csvdb["diner_buildingCsv"][buildType][level] | ||
650 | + if not buildingData then | ||
651 | + return 4 | ||
652 | + end | ||
653 | + local gfood = role.dinerData:getProperty("gfood") | ||
654 | + if not next(gfood) then return 5 end | ||
655 | + for k , v in pairs(gfood) do | ||
656 | + local itemId = v.id | ||
657 | + local speed = globalCsv.diner_get_food_speed[csvdb["itemCsv"][itemId].quality] * buildingData.speed / 100 | ||
658 | + reward[itemId] = (reward[itemId] or 0) + math.floor(time / speed) * count | ||
659 | + end | ||
660 | + else | ||
661 | + return 6 | ||
656 | end | 662 | end |
657 | - else | ||
658 | - return | 663 | + |
664 | + role:costItems({[id] = count}, {log = {desc = "speedUpBox"}}) | ||
659 | end | 665 | end |
660 | 666 | ||
661 | - role:costItems({[id] = count}, {log = {desc = "speedUpBox"}}) | ||
662 | local change | 667 | local change |
663 | - reward, change = role:award(reward, {log = {desc = "speedUpBox"}, int1 = id, int2 = count}) | 668 | + reward, change = role:award(reward, {log = {desc = "speedUpBox"}}) |
664 | 669 | ||
665 | SendPacket(actionCodes.Role_openSpeedUpBoxRpc, MsgPack.pack(role:packReward(reward, change))) | 670 | SendPacket(actionCodes.Role_openSpeedUpBoxRpc, MsgPack.pack(role:packReward(reward, change))) |
666 | return true | 671 | return true |
src/models/Activity.lua
@@ -18,6 +18,7 @@ Activity.ActivityType = { | @@ -18,6 +18,7 @@ Activity.ActivityType = { | ||
18 | DrawHero = 12, --抽卡周 招募 | 18 | DrawHero = 12, --抽卡周 招募 |
19 | AdvDraw = 13, --拾荒抽周 资助 | 19 | AdvDraw = 13, --拾荒抽周 资助 |
20 | OpenBox = 14, --拆解周 时钟箱 | 20 | OpenBox = 14, --拆解周 时钟箱 |
21 | + RaceDraw = 15, -- 定向招募活动 | ||
21 | } | 22 | } |
22 | 23 | ||
23 | 24 |
src/models/RolePlugin.lua
@@ -1691,13 +1691,9 @@ function RolePlugin.bind(Role) | @@ -1691,13 +1691,9 @@ function RolePlugin.bind(Role) | ||
1691 | if not csvdb["idle_battleCsv"][nextId] then | 1691 | if not csvdb["idle_battleCsv"][nextId] then |
1692 | nextId = makeCarbonId(diff, chapterId + 1, 1) | 1692 | nextId = makeCarbonId(diff, chapterId + 1, 1) |
1693 | if not csvdb["idle_battleCsv"][nextId] then | 1693 | if not csvdb["idle_battleCsv"][nextId] then |
1694 | - if diff + 1 == 3 then | 1694 | + nextId = makeCarbonId(diff + 1, 1, 1) |
1695 | + if not csvdb["idle_battleCsv"][nextId] then | ||
1695 | nextId = 0 | 1696 | nextId = 0 |
1696 | - else | ||
1697 | - nextId = makeCarbonId(diff + 1, 1, 1) | ||
1698 | - if not csvdb["idle_battleCsv"][nextId] then | ||
1699 | - nextId = 0 | ||
1700 | - end | ||
1701 | end | 1697 | end |
1702 | end | 1698 | end |
1703 | end | 1699 | end |
-
mentioned in commit 52f8c5f05d0a531232a7dd7887becd2a77986aa1
-
mentioned in commit 52f8c5f05d0a531232a7dd7887becd2a77986aa1
-
mentioned in commit ba6d85edc65900830c7e168102d70671881b5808
-
mentioned in commit ba6d85edc65900830c7e168102d70671881b5808