Commit eb5ffd1c55aaf335dc8103d6fbb914b5b116f3fd

Authored by liuzujun
1 parent 8ec16c21

世界boss翻牌奖励 活动卡池保底单独记录

src/actions/ActivityAction.lua
... ... @@ -780,11 +780,42 @@ function _M.bossRewardRpc(agent, data)
780 780 local battleCfg = actCfg[id]
781 781 if not battleCfg then return 3 end
782 782  
783   - if battleCfg.boss_reward_id == 0 then return 4 end
  783 + if battleCfg.worldBoss_award == 0 then return 4 end
784 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)))
  785 + actCfg = csvdb["activity_wordboss_awardCsv"][battleCfg.worldBoss_award]
  786 + if not actCfg then return 5 end
  787 + local awardCfg = actCfg[index]
  788 + if not awardCfg then return 6 end
  789 +
  790 + local preList = awardCfg.condition1:toArray(true, "=")
  791 +
  792 + local actData = role.activity:getActData("ChallengeLevel") or {}
  793 + local battleInfo = actData[id] or {}
  794 + local bossPoint = battleInfo["bossP"] or 0
  795 + if bossPoint < 1 then return 7 end
  796 +
  797 + local bossRecord = battleInfo["bossR"] or ""
  798 + local ok = false
  799 + if #preList == 0 then
  800 + ok = true
  801 + else
  802 + for _, i in ipairs(preList) do
  803 + local flag = string.char(string.getbit(bossRecord, i))
  804 + if flag == "1" then
  805 + ok = true
  806 + break
  807 + end
  808 + end
  809 + end
  810 + if not ok then return 8 end
  811 +
  812 + battleInfo["bossR"] = string.setbit(bossRecord, index)
  813 + actData[id] = battleInfo
  814 + role.activity:updateActData("ChallengeLevel", actData)
  815 +
  816 + local award = awardCfg.reward:toNumMap()
  817 + local reward, change = role:award(award, {log = {desc = "worldBossReward", int1 = actid, int2 = index}})
  818 + SendPacket(actionCodes.Activity_bossRewardRpc, MsgPack.pack(role:packReward(reward, change)))
788 819 return true
789 820 end
790 821  
... ...
src/actions/HeroAction.lua
... ... @@ -727,7 +727,7 @@ function _M.drawHeroRpc(agent, data)
727 727 end
728 728 end
729 729  
730   - -- 活动卡池
  730 + -- 另开活动卡池
731 731 if actid then
732 732 if not role.activity:isOpenById(actid, "ActHeroPool") then return end
733 733 local cfg = csvdb["activity_ctrlCsv"][actid]
... ... @@ -974,11 +974,16 @@ function _M.drawHeroRpc(agent, data)
974 974 })
975 975 SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组
976 976  
977   - if (buildTypeData["can_feedback"] or 0) == 1 then
  977 + local feedbackId = buildTypeData["can_feedback"] or 0
  978 + if feedbackId ~= 1 then
978 979 -- 达到一定次数,给响应奖励
979 980 local oldVal = role:getProperty("repayHero") or 0
  981 + if actid then
  982 + local actData = role.activity:getActData("ActHeroPool")
  983 + oldVal = actData[btype]
  984 + end
980 985 local newVal = oldVal + drawCount[drawType]
981   - local drawCardReward, val = role:getDrawCardExtraReward(oldVal, newVal)
  986 + local drawCardReward, val = role:getDrawCardExtraReward(feedbackId, oldVal, newVal)
982 987 -- 空字符穿代表直接给英雄 走以前repayHeroRpc
983 988 if drawCardReward == "" then
984 989 local repayHeroMaxCount = role:getProperty("repayMaxC") or 0
... ... @@ -992,7 +997,7 @@ function _M.drawHeroRpc(agent, data)
992 997 else
993 998 local giftHeroSet = {}
994 999 for gid, cfg in pairs(csvdb["build_giftCsv"]) do
995   - if cfg["pool_1"] ~= 0 and not role:isHaveHero(gid - ItemStartId.Hero) then
  1000 + if cfg["pool_"..feedbackId] ~= 0 and not role:isHaveHero(gid - ItemStartId.Hero) then
996 1001 giftHeroSet[gid] = {1}
997 1002 end
998 1003 end
... ... @@ -1021,7 +1026,13 @@ function _M.drawHeroRpc(agent, data)
1021 1026 r, change = role:award(drawCardReward, {log = {desc = "drawHeroExtraReward", int1 = oldVal, int2 = newVal}})
1022 1027 SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack(role:packReward(r, change)))
1023 1028 end
1024   - role:updateProperty({field = "repayHero", value = val})
  1029 + if not actid then
  1030 + role:updateProperty({field = "repayHero", value = val})
  1031 + else
  1032 + local actData = role.activity:getActData("ActHeroPool")
  1033 + actData[btype] = val
  1034 + role.activity:updateActData("ActHeroPool", actData)
  1035 + end
1025 1036 end
1026 1037 return true
1027 1038 end
... ...
src/actions/StoreAction.lua
... ... @@ -13,6 +13,9 @@ function _M.rechargeRpc(agent , data)
13 13  
14 14 --创建订单号
15 15 local partnerOrderId = role:getPurchaseOrder(id)
  16 + if partnerOrderId == "" then
  17 + return 1
  18 + end
16 19 SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({ order = partnerOrderId }))
17 20  
18 21  
... ...
1   -Subproject commit 591f2b4097214f9f5bf3b746f86ac704cbc9ea44
  1 +Subproject commit f0e032edd4de127bf13d4a915e3909d724ba7652
... ...
src/models/Activity.lua
... ... @@ -69,6 +69,8 @@ Activity.schema = {
69 69 act18 = {"table", {}, true}, -- {id=兑换数量}
70 70 act19 = {"number", 0}, -- {挂机信息}
71 71 act20 = {"table", {}}, -- {id=扭蛋抽出数量}
  72 +
  73 + act24 = {"table", {}, true}, -- 活动卡池 {id=repaynum}
72 74 }
73 75  
74 76 function Activity:data()
... ... @@ -489,6 +491,19 @@ activityFunc[Activity.ActivityType.Gachakon] = {
489 491 end,
490 492 }
491 493  
  494 +-- 活动卡池
  495 +activityFunc[Activity.ActivityType.ActHeroPool] = {
  496 + ["init"] = function(self, actType, isCrossDay, notify, actId)
  497 + end,
  498 + ["close"] = function(self, actType, notify, actId)
  499 + local actData = self:getActData(actType)
  500 + local cfg = csvdb["activity_ctrlCsv"][actId]
  501 + if not cfg then return end
  502 + actData[cfg.condition] = nil
  503 + self:updateActData(actType, actData, not notify)
  504 + end,
  505 +}
  506 +
492 507 -- 挂机掉落
493 508 activityFunc[Activity.ActivityType.HangDrop] = {
494 509 ["init"] = function(self, actType, isCrossDay, notify, actId)
... ... @@ -540,7 +555,9 @@ function Activity:closeActivity(actId, notify, notUpdateAct)
540 555 self:recycleActItem(actId)
541 556 end
542 557 if Activity.schema["act".. actType] then
543   - self:updateActData(actType, Activity.schema["act" .. actType][2], not notify or notUpdateAct)
  558 + if not Activity.schema["act" .. actType][3] then
  559 + self:updateActData(actType, Activity.schema["act" .. actType][2], not notify or notUpdateAct)
  560 + end
544 561 end
545 562 end
546 563  
... ...
src/models/RoleLog.lua
... ... @@ -50,6 +50,7 @@ local ItemReason = {
50 50 actHangDrop = 134, -- 掉落活动奖励
51 51 actBattle = 135, -- 活动关卡
52 52 actMilestone = 136, -- 活动关卡boss伤害里程碑
  53 + worldBossReward = 137, -- 世界boss翻牌奖励
53 54  
54 55  
55 56 advHang = 301, -- 拾荒挂机
... ...
src/models/RolePlugin.lua
... ... @@ -1580,15 +1580,17 @@ function RolePlugin.bind(Role)
1580 1580 return ""
1581 1581 end
1582 1582 local limit = rechargeData.limit
1583   - local rechargeRecord = self:getProperty("payR") or {}
  1583 + local rechargeRecord = self.storeData:getProperty("payR") or {}
1584 1584 if limit ~= 0 and limit <= (rechargeRecord[rechargeId] or 0) then
1585 1585 return ""
1586 1586 end
1587 1587  
1588 1588 --判断是否是活动商品
1589   - local actCfg = csvdb["activity_ctrlCsv"][rechargeData.activity_id]
1590   - if not actCfg then return "" end
1591   - if not self.activity:isOpenById(rechargeData.activity_id, "ActShopGoods") then return "" end
  1589 + if rechargeData.activity_id ~= 0 then
  1590 + local actCfg = csvdb["activity_ctrlCsv"][rechargeData.activity_id]
  1591 + if not actCfg then return "" end
  1592 + if not self.activity:isOpenById(rechargeData.activity_id, "ActShopGoods") then return "" end
  1593 + end
1592 1594  
1593 1595 local orderId = redisproxy:hget(string.format(R_ORDERS, roleId), rechargeId)
1594 1596 if orderId then
... ... @@ -1834,10 +1836,10 @@ function RolePlugin.bind(Role)
1834 1836 end
1835 1837  
1836 1838 -- 抽卡阶段奖励
1837   - function Role:getDrawCardExtraReward(oldVal, newVal)
  1839 + function Role:getDrawCardExtraReward(feedbackId, oldVal, newVal)
1838 1840 local reward = nil
1839 1841 local maxCount = 0
1840   - for k, v in pairs(csvdb["build_extraRewardCsv"]) do
  1842 + for k, v in pairs(csvdb["build_extraRewardCsv"][feedbackId]) do
1841 1843 if oldVal < k and newVal >= k then
1842 1844 reward = v["reward"] or ""
1843 1845 end
... ...