Commit 37bb46114838055a25ece524933a82e3bf077d6f

Authored by liuzujun
1 parent 74f2395e

付费签到,抽卡阶段奖励,探索指令

src/GlobalVar.lua
... ... @@ -275,10 +275,8 @@ CardType = {
275 275 PrivilegeCard = 3, --特权卡
276 276 GrowFund = 4, --成长助力
277 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 282 HeroQuality = {
... ...
src/ProtocolCode.lua
... ... @@ -93,6 +93,7 @@ actionCodes = {
93 93 Hero_repayHeroRpc = 221,
94 94 Hero_unlockPoolRpc = 222,
95 95 Hero_changeCrown = 223,
  96 + Hero_drawHeroExtraRewardNtf = 221,
96 97  
97 98 Hang_startRpc = 251,
98 99 Hang_checkRpc = 252,
... ...
src/actions/GmAction.lua
... ... @@ -472,7 +472,7 @@ function _M.test(role, pms)
472 472 local id = tonum(pms.pm1, 0)
473 473 --local hero = require ("actions.HeroAction")
474 474 --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id}))
475   - role.storeData:onBattleCardReset()
  475 + role.storeData:onBuyPaySignCard(100)
476 476 return "成功"
477 477 end
478 478  
... ...
src/actions/HeroAction.lua
... ... @@ -830,6 +830,7 @@ function _M.drawHeroRpc(agent, data)
830 830  
831 831 local ssrCount = 0
832 832 local reward = {}
  833 + local logReward = {}
833 834 for i = 1, drawCount[drawType] do
834 835 floorHeroCount = floorHeroCount + 1
835 836 local isFloorBack = draw_floor_back_counts and floorHeroCount >= draw_floor_back_counts
... ... @@ -855,7 +856,6 @@ function _M.drawHeroRpc(agent, data)
855 856 floorHeroCount = 0
856 857 end
857 858  
858   - local logReward = {}
859 859 if role:isHaveHero(itemData.id - ItemStartId.Hero) then
860 860 local fragId = itemData.id - ItemStartId.Hero
861 861 local heroData = csvdb["unitCsv"][fragId]
... ... @@ -876,12 +876,6 @@ function _M.drawHeroRpc(agent, data)
876 876 role:setProperty("floorHero", floorHero)
877 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 879 role:checkTaskEnter("DrawHero", {pool = btype, count = drawCount[drawType]})
886 880 if ssrCount > 0 then
887 881 role:checkTaskEnter("DrawSSR", {count = ssrCount})
... ... @@ -898,6 +892,36 @@ function _M.drawHeroRpc(agent, data)
898 892 gacha_cnt = floorHeroCount,
899 893 })
900 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 925 return true
902 926 end
903 927  
... ...
src/actions/StoreAction.lua
... ... @@ -384,7 +384,7 @@ function _M.getExploreCommandRewardRpc(agent, data)
384 384 local id = msg.id -- 探索id
385 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 388 local config = csvdb[tab_name][id]
389 389 if not config then return end
390 390  
... ... @@ -408,7 +408,7 @@ function _M.getExploreCommandRewardRpc(agent, data)
408 408 return 3
409 409 end
410 410  
411   - if not role:checkHangPass(config.carbonId) then
  411 + if not role:checkHangPass(config.level) then
412 412 return 4
413 413 end
414 414  
... ...
1   -Subproject commit d90070e4a761a53afb25de2f01c51401af9791c1
  1 +Subproject commit 3f22e14af514a3c558f7f04c0e3a99102a4268fc
... ...
src/models/Activity.lua
... ... @@ -404,9 +404,9 @@ function Activity:getPaySignReward()
404 404  
405 405 local diffDay = diffFromOpen() + 1
406 406  
407   - local curData = self.activity:getActData("PaySignIn")
  407 + local curData = self:getActData("PaySignIn")
408 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 410 if day <= diffDay then
411 411 if not curData[day] then
412 412 curData[day] = 1
... ...
src/models/RoleLog.lua
... ... @@ -40,6 +40,7 @@ local ItemReason = {
40 40 towerCount = 126, -- 电波塔次数
41 41 freeGift = 127, -- 免费礼包
42 42 exploreCommand = 128, -- 探索指令
  43 + drawHeroExtraReward = 129, -- 抽卡阶段奖励
43 44  
44 45  
45 46 advHang = 301, -- 拾荒挂机
... ...
src/models/RolePlugin.lua
... ... @@ -1451,12 +1451,9 @@ function RolePlugin.bind(Role)
1451 1451 self:gainDiamond({count = diamondCount, isRecharge = true, log = {desc = "recharge", int1 = id}})
1452 1452 elseif rechargeData.shop == 2 then --通行证商店
1453 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 1455 elseif rechargeData.shop == 3 then -- 礼包商店
1456 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 1457 else
1461 1458 skynet.error("invalid recharge shop type " .. id)
1462 1459 return 3
... ... @@ -1535,6 +1532,21 @@ function RolePlugin.bind(Role)
1535 1532 self:updateProperty({field = "newerGuide", value = "9999=1"})
1536 1533 end
1537 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 1550 end
1539 1551  
1540 1552 return RolePlugin
1541 1553 \ No newline at end of file
... ...
src/models/Store.lua
... ... @@ -163,7 +163,7 @@ function Store:getGearExchangeCoef()
163 163 end
164 164  
165 165 -- 购买通行证
166   -function Store:onBuyCard(type, duration)
  166 +function Store:onBuyCard(type, duration, id)
167 167 local timeNow = skynet.timex()
168 168 if type == CardType.NormalMonthCard then
169 169 if self:isMonthCardExpire() then
... ... @@ -189,9 +189,10 @@ function Store:onBuyCard(type, duration)
189 189 self:updateProperty({field = "growFund", value = 1})
190 190 elseif type == CardType.BattleCard then
191 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 196 local bpInfo = self:getProperty("bpInfo") or {}
196 197 local info = bpInfo[index] or {}
197 198 info["flag"] = 1
... ... @@ -365,6 +366,7 @@ function Store:onBuyPaySignCard(dur)
365 366 return
366 367 end
367 368 actGoodsFlag[goodsIndex] = 1
  369 + self.owner:updateProperty({field = "actGoodsFlag", value = actGoodsFlag})
368 370 -- 发钱
369 371 local change
370 372 local reward, curData = self.owner.activity:getPaySignReward()
... ... @@ -375,13 +377,11 @@ function Store:onBuyPaySignCard(dur)
375 377  
376 378 self.owner:log("activity", {
377 379 activity_id = 0, -- 活动ID(或活动指定任务的ID)
378   - activity_type = self.onwer.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表
  380 + activity_type = self.owner.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表
379 381 activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
380 382 })
381 383  
382 384 SendPacket(actionCodes.Activity_actPaySignRewardNtf, MsgPack.pack(self.owner:packReward(reward, change)))
383   -
384   - self.owner:updateProperty({field = "actGoodsFlag", value = actGoodsFlag})
385 385 end
386 386  
387 387 function Store:checkPaySignReward()
... ...