Commit 37bb46114838055a25ece524933a82e3bf077d6f
1 parent
74f2395e
付费签到,抽卡阶段奖励,探索指令
Showing
10 changed files
with
64 additions
and
28 deletions
Show diff stats
src/GlobalVar.lua
| @@ -275,10 +275,8 @@ CardType = { | @@ -275,10 +275,8 @@ CardType = { | ||
| 275 | PrivilegeCard = 3, --特权卡 | 275 | PrivilegeCard = 3, --特权卡 |
| 276 | GrowFund = 4, --成长助力 | 276 | GrowFund = 4, --成长助力 |
| 277 | BattleCard = 5, --赛季卡 | 277 | BattleCard = 5, --赛季卡 |
| 278 | - BattlePassCard_1 = 6, -- 探索指令1 | ||
| 279 | - BattlePassCard_2 = 7, -- 探索指令2 | ||
| 280 | - BattlePassCard_3 = 8, -- 探索指令3 | ||
| 281 | - BattlePassCard_4 = 9, -- 探索指令4 | 278 | + PaySignCard = 6, -- 付费签到卡 |
| 279 | + BattlePassCard = 7, -- 探索指令 | ||
| 282 | } | 280 | } |
| 283 | 281 | ||
| 284 | HeroQuality = { | 282 | HeroQuality = { |
src/ProtocolCode.lua
| @@ -93,6 +93,7 @@ actionCodes = { | @@ -93,6 +93,7 @@ actionCodes = { | ||
| 93 | Hero_repayHeroRpc = 221, | 93 | Hero_repayHeroRpc = 221, |
| 94 | Hero_unlockPoolRpc = 222, | 94 | Hero_unlockPoolRpc = 222, |
| 95 | Hero_changeCrown = 223, | 95 | Hero_changeCrown = 223, |
| 96 | + Hero_drawHeroExtraRewardNtf = 221, | ||
| 96 | 97 | ||
| 97 | Hang_startRpc = 251, | 98 | Hang_startRpc = 251, |
| 98 | Hang_checkRpc = 252, | 99 | Hang_checkRpc = 252, |
src/actions/GmAction.lua
| @@ -472,7 +472,7 @@ function _M.test(role, pms) | @@ -472,7 +472,7 @@ function _M.test(role, pms) | ||
| 472 | local id = tonum(pms.pm1, 0) | 472 | local id = tonum(pms.pm1, 0) |
| 473 | --local hero = require ("actions.HeroAction") | 473 | --local hero = require ("actions.HeroAction") |
| 474 | --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id})) | 474 | --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id})) |
| 475 | - role.storeData:onBattleCardReset() | 475 | + role.storeData:onBuyPaySignCard(100) |
| 476 | return "成功" | 476 | return "成功" |
| 477 | end | 477 | end |
| 478 | 478 |
src/actions/HeroAction.lua
| @@ -830,6 +830,7 @@ function _M.drawHeroRpc(agent, data) | @@ -830,6 +830,7 @@ function _M.drawHeroRpc(agent, data) | ||
| 830 | 830 | ||
| 831 | local ssrCount = 0 | 831 | local ssrCount = 0 |
| 832 | local reward = {} | 832 | local reward = {} |
| 833 | + local logReward = {} | ||
| 833 | for i = 1, drawCount[drawType] do | 834 | for i = 1, drawCount[drawType] do |
| 834 | floorHeroCount = floorHeroCount + 1 | 835 | floorHeroCount = floorHeroCount + 1 |
| 835 | local isFloorBack = draw_floor_back_counts and floorHeroCount >= draw_floor_back_counts | 836 | local isFloorBack = draw_floor_back_counts and floorHeroCount >= draw_floor_back_counts |
| @@ -855,7 +856,6 @@ function _M.drawHeroRpc(agent, data) | @@ -855,7 +856,6 @@ function _M.drawHeroRpc(agent, data) | ||
| 855 | floorHeroCount = 0 | 856 | floorHeroCount = 0 |
| 856 | end | 857 | end |
| 857 | 858 | ||
| 858 | - local logReward = {} | ||
| 859 | if role:isHaveHero(itemData.id - ItemStartId.Hero) then | 859 | if role:isHaveHero(itemData.id - ItemStartId.Hero) then |
| 860 | local fragId = itemData.id - ItemStartId.Hero | 860 | local fragId = itemData.id - ItemStartId.Hero |
| 861 | local heroData = csvdb["unitCsv"][fragId] | 861 | local heroData = csvdb["unitCsv"][fragId] |
| @@ -876,12 +876,6 @@ function _M.drawHeroRpc(agent, data) | @@ -876,12 +876,6 @@ function _M.drawHeroRpc(agent, data) | ||
| 876 | role:setProperty("floorHero", floorHero) | 876 | role:setProperty("floorHero", floorHero) |
| 877 | end | 877 | end |
| 878 | 878 | ||
| 879 | - if btype == 1 or btype == 2 then | ||
| 880 | - local repayHero = role:getProperty("repayHero") or 0 | ||
| 881 | - repayHero = repayHero + drawCount[drawType] | ||
| 882 | - role:updateProperty({field = "repayHero", value = repayHero}) | ||
| 883 | - end | ||
| 884 | - | ||
| 885 | role:checkTaskEnter("DrawHero", {pool = btype, count = drawCount[drawType]}) | 879 | role:checkTaskEnter("DrawHero", {pool = btype, count = drawCount[drawType]}) |
| 886 | if ssrCount > 0 then | 880 | if ssrCount > 0 then |
| 887 | role:checkTaskEnter("DrawSSR", {count = ssrCount}) | 881 | role:checkTaskEnter("DrawSSR", {count = ssrCount}) |
| @@ -898,6 +892,36 @@ function _M.drawHeroRpc(agent, data) | @@ -898,6 +892,36 @@ function _M.drawHeroRpc(agent, data) | ||
| 898 | gacha_cnt = floorHeroCount, | 892 | gacha_cnt = floorHeroCount, |
| 899 | }) | 893 | }) |
| 900 | SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 | 894 | SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 |
| 895 | + | ||
| 896 | + if btype == 1 or btype == 2 then | ||
| 897 | + -- 达到一定次数,给响应奖励 | ||
| 898 | + local oldVal = role:getProperty("repayHero") or 0 | ||
| 899 | + local newVal = oldVal + drawCount[drawType] | ||
| 900 | + local drawCardReward, val = role:getDrawCardExtraReward(oldVal, newVal) | ||
| 901 | + print(drawCardReward) | ||
| 902 | + -- 空字符穿代表直接给英雄 走以前repayHeroRpc | ||
| 903 | + if drawCardReward == "" then | ||
| 904 | + local id = math.randWeight(csvdb["build_giftCsv"], "pool_1") | ||
| 905 | + | ||
| 906 | + local r = {} | ||
| 907 | + local itemData = csvdb["itemCsv"][id] | ||
| 908 | + if itemData.type == ItemType.Hero and role:isHaveHero(itemData.id - ItemStartId.Hero) then | ||
| 909 | + local fragId = itemData.id - ItemStartId.Hero | ||
| 910 | + local heroData = csvdb["unitCsv"][fragId] | ||
| 911 | + local count = globalCsv.draw_unit_tofragment[heroData.rare] | ||
| 912 | + role:award({[fragId] = count}, {log = {desc = "drawHeroExtraReward"}}) | ||
| 913 | + r = {id = fragId, count = count, from = id, fcount = 1} | ||
| 914 | + else | ||
| 915 | + role:award({[id] = 1}, {log = {desc = "drawHeroExtraReward"}}) | ||
| 916 | + r = {id = id, count = 1} | ||
| 917 | + end | ||
| 918 | + SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack({reward = r})) | ||
| 919 | + elseif drawCardReward and drawCardReward ~= "" then | ||
| 920 | + role:award(drawCardReward, {log = {desc = "drawHeroExtraReward", int1 = oldVal, int2 = newVal}}) | ||
| 921 | + SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack({reward = drawCardReward:toNumMap()})) | ||
| 922 | + end | ||
| 923 | + role:updateProperty({field = "repayHero", value = val}) | ||
| 924 | + end | ||
| 901 | return true | 925 | return true |
| 902 | end | 926 | end |
| 903 | 927 |
src/actions/StoreAction.lua
| @@ -384,7 +384,7 @@ function _M.getExploreCommandRewardRpc(agent, data) | @@ -384,7 +384,7 @@ function _M.getExploreCommandRewardRpc(agent, data) | ||
| 384 | local id = msg.id -- 探索id | 384 | local id = msg.id -- 探索id |
| 385 | local subId = msg.subId -- 领取的阶段id | 385 | local subId = msg.subId -- 领取的阶段id |
| 386 | 386 | ||
| 387 | - local tab_name = "reward_battlepass_" .. id .. "Csv" | 387 | + local tab_name = "reward_levelpass" .. id .. "Csv" |
| 388 | local config = csvdb[tab_name][id] | 388 | local config = csvdb[tab_name][id] |
| 389 | if not config then return end | 389 | if not config then return end |
| 390 | 390 | ||
| @@ -408,7 +408,7 @@ function _M.getExploreCommandRewardRpc(agent, data) | @@ -408,7 +408,7 @@ function _M.getExploreCommandRewardRpc(agent, data) | ||
| 408 | return 3 | 408 | return 3 |
| 409 | end | 409 | end |
| 410 | 410 | ||
| 411 | - if not role:checkHangPass(config.carbonId) then | 411 | + if not role:checkHangPass(config.level) then |
| 412 | return 4 | 412 | return 4 |
| 413 | end | 413 | end |
| 414 | 414 |
src/models/Activity.lua
| @@ -404,9 +404,9 @@ function Activity:getPaySignReward() | @@ -404,9 +404,9 @@ function Activity:getPaySignReward() | ||
| 404 | 404 | ||
| 405 | local diffDay = diffFromOpen() + 1 | 405 | local diffDay = diffFromOpen() + 1 |
| 406 | 406 | ||
| 407 | - local curData = self.activity:getActData("PaySignIn") | 407 | + local curData = self:getActData("PaySignIn") |
| 408 | local reward, change = {} | 408 | local reward, change = {} |
| 409 | - for day, csvData in ipairs(csvdb["pay_signInCsv"]) do | 409 | + for day, csvData in pairs(csvdb["pay_signInCsv"]) do |
| 410 | if day <= diffDay then | 410 | if day <= diffDay then |
| 411 | if not curData[day] then | 411 | if not curData[day] then |
| 412 | curData[day] = 1 | 412 | curData[day] = 1 |
src/models/RoleLog.lua
| @@ -40,6 +40,7 @@ local ItemReason = { | @@ -40,6 +40,7 @@ local ItemReason = { | ||
| 40 | towerCount = 126, -- 电波塔次数 | 40 | towerCount = 126, -- 电波塔次数 |
| 41 | freeGift = 127, -- 免费礼包 | 41 | freeGift = 127, -- 免费礼包 |
| 42 | exploreCommand = 128, -- 探索指令 | 42 | exploreCommand = 128, -- 探索指令 |
| 43 | + drawHeroExtraReward = 129, -- 抽卡阶段奖励 | ||
| 43 | 44 | ||
| 44 | 45 | ||
| 45 | advHang = 301, -- 拾荒挂机 | 46 | advHang = 301, -- 拾荒挂机 |
src/models/RolePlugin.lua
| @@ -1451,12 +1451,9 @@ function RolePlugin.bind(Role) | @@ -1451,12 +1451,9 @@ function RolePlugin.bind(Role) | ||
| 1451 | self:gainDiamond({count = diamondCount, isRecharge = true, log = {desc = "recharge", int1 = id}}) | 1451 | self:gainDiamond({count = diamondCount, isRecharge = true, log = {desc = "recharge", int1 = id}}) |
| 1452 | elseif rechargeData.shop == 2 then --通行证商店 | 1452 | elseif rechargeData.shop == 2 then --通行证商店 |
| 1453 | reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) | 1453 | reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) |
| 1454 | - self.storeData:onBuyCard(rechargeData.type, rechargeData.time) | 1454 | + self.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id) |
| 1455 | elseif rechargeData.shop == 3 then -- 礼包商店 | 1455 | elseif rechargeData.shop == 3 then -- 礼包商店 |
| 1456 | reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) | 1456 | reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) |
| 1457 | - elseif rechargeData.shop == 4 then -- 付费签到 | ||
| 1458 | - reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) | ||
| 1459 | - self.storeData:onBuyPaySignCard(rechargeData.time) | ||
| 1460 | else | 1457 | else |
| 1461 | skynet.error("invalid recharge shop type " .. id) | 1458 | skynet.error("invalid recharge shop type " .. id) |
| 1462 | return 3 | 1459 | return 3 |
| @@ -1535,6 +1532,21 @@ function RolePlugin.bind(Role) | @@ -1535,6 +1532,21 @@ function RolePlugin.bind(Role) | ||
| 1535 | self:updateProperty({field = "newerGuide", value = "9999=1"}) | 1532 | self:updateProperty({field = "newerGuide", value = "9999=1"}) |
| 1536 | end | 1533 | end |
| 1537 | end | 1534 | end |
| 1535 | + | ||
| 1536 | + -- 抽卡阶段奖励 | ||
| 1537 | + function Role:getDrawCardExtraReward(oldVal, newVal) | ||
| 1538 | + local reward = nil | ||
| 1539 | + local maxCount = 0 | ||
| 1540 | + for k, v in pairs(csvdb["build_extraRewardCsv"]) do | ||
| 1541 | + if oldVal < k and newVal >= k then | ||
| 1542 | + reward = v["reward"] or "" | ||
| 1543 | + end | ||
| 1544 | + maxCount = k > maxCount and k or maxCount | ||
| 1545 | + end | ||
| 1546 | + | ||
| 1547 | + return reward, (newVal >= maxCount and newVal - maxCount or newVal) | ||
| 1548 | + end | ||
| 1549 | + | ||
| 1538 | end | 1550 | end |
| 1539 | 1551 | ||
| 1540 | return RolePlugin | 1552 | return RolePlugin |
| 1541 | \ No newline at end of file | 1553 | \ No newline at end of file |
src/models/Store.lua
| @@ -163,7 +163,7 @@ function Store:getGearExchangeCoef() | @@ -163,7 +163,7 @@ function Store:getGearExchangeCoef() | ||
| 163 | end | 163 | end |
| 164 | 164 | ||
| 165 | -- 购买通行证 | 165 | -- 购买通行证 |
| 166 | -function Store:onBuyCard(type, duration) | 166 | +function Store:onBuyCard(type, duration, id) |
| 167 | local timeNow = skynet.timex() | 167 | local timeNow = skynet.timex() |
| 168 | if type == CardType.NormalMonthCard then | 168 | if type == CardType.NormalMonthCard then |
| 169 | if self:isMonthCardExpire() then | 169 | if self:isMonthCardExpire() then |
| @@ -189,9 +189,10 @@ function Store:onBuyCard(type, duration) | @@ -189,9 +189,10 @@ function Store:onBuyCard(type, duration) | ||
| 189 | self:updateProperty({field = "growFund", value = 1}) | 189 | self:updateProperty({field = "growFund", value = 1}) |
| 190 | elseif type == CardType.BattleCard then | 190 | elseif type == CardType.BattleCard then |
| 191 | self:updateProperty({field = "battleCard", value = 1}) | 191 | self:updateProperty({field = "battleCard", value = 1}) |
| 192 | - elseif type == CardType.BattlePassCard_1 or type == CardType.BattlePassCard_2 or | ||
| 193 | - type == CardType.BattlePassCard_3 or type == CardType.BattlePassCard_4 then | ||
| 194 | - local index = type - CardType.BattlePassCard_1 + 1 | 192 | + elseif type == CardType.PaySignCard then |
| 193 | + self:onBuyPaySignCard(duration) | ||
| 194 | + elseif type == CardType.BattlePassCard then | ||
| 195 | + local index = id - 400 -- 401:初级 402:中级 403:高级 404:终极 | ||
| 195 | local bpInfo = self:getProperty("bpInfo") or {} | 196 | local bpInfo = self:getProperty("bpInfo") or {} |
| 196 | local info = bpInfo[index] or {} | 197 | local info = bpInfo[index] or {} |
| 197 | info["flag"] = 1 | 198 | info["flag"] = 1 |
| @@ -365,6 +366,7 @@ function Store:onBuyPaySignCard(dur) | @@ -365,6 +366,7 @@ function Store:onBuyPaySignCard(dur) | ||
| 365 | return | 366 | return |
| 366 | end | 367 | end |
| 367 | actGoodsFlag[goodsIndex] = 1 | 368 | actGoodsFlag[goodsIndex] = 1 |
| 369 | + self.owner:updateProperty({field = "actGoodsFlag", value = actGoodsFlag}) | ||
| 368 | -- 发钱 | 370 | -- 发钱 |
| 369 | local change | 371 | local change |
| 370 | local reward, curData = self.owner.activity:getPaySignReward() | 372 | local reward, curData = self.owner.activity:getPaySignReward() |
| @@ -375,13 +377,11 @@ function Store:onBuyPaySignCard(dur) | @@ -375,13 +377,11 @@ function Store:onBuyPaySignCard(dur) | ||
| 375 | 377 | ||
| 376 | self.owner:log("activity", { | 378 | self.owner:log("activity", { |
| 377 | activity_id = 0, -- 活动ID(或活动指定任务的ID) | 379 | activity_id = 0, -- 活动ID(或活动指定任务的ID) |
| 378 | - activity_type = self.onwer.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表 | 380 | + activity_type = self.owner.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表 |
| 379 | activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | 381 | activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} |
| 380 | }) | 382 | }) |
| 381 | 383 | ||
| 382 | SendPacket(actionCodes.Activity_actPaySignRewardNtf, MsgPack.pack(self.owner:packReward(reward, change))) | 384 | SendPacket(actionCodes.Activity_actPaySignRewardNtf, MsgPack.pack(self.owner:packReward(reward, change))) |
| 383 | - | ||
| 384 | - self.owner:updateProperty({field = "actGoodsFlag", value = actGoodsFlag}) | ||
| 385 | end | 385 | end |
| 386 | 386 | ||
| 387 | function Store:checkPaySignReward() | 387 | function Store:checkPaySignReward() |