From eb5ffd1c55aaf335dc8103d6fbb914b5b116f3fd Mon Sep 17 00:00:00 2001 From: liuzujun <307836273@qq.com> Date: Wed, 23 Dec 2020 19:04:36 +0800 Subject: [PATCH] 世界boss翻牌奖励 活动卡池保底单独记录 --- src/actions/ActivityAction.lua | 39 +++++++++++++++++++++++++++++++++++---- src/actions/HeroAction.lua | 21 ++++++++++++++++----- src/actions/StoreAction.lua | 3 +++ src/csvdata | 2 +- src/models/Activity.lua | 19 ++++++++++++++++++- src/models/RoleLog.lua | 1 + src/models/RolePlugin.lua | 14 ++++++++------ 7 files changed, 82 insertions(+), 17 deletions(-) diff --git a/src/actions/ActivityAction.lua b/src/actions/ActivityAction.lua index d44a7c6..bd897f9 100644 --- a/src/actions/ActivityAction.lua +++ b/src/actions/ActivityAction.lua @@ -780,11 +780,42 @@ function _M.bossRewardRpc(agent, data) local battleCfg = actCfg[id] if not battleCfg then return 3 end - if battleCfg.boss_reward_id == 0 then return 4 end + if battleCfg.worldBoss_award == 0 then return 4 end - --local award = mileCfg.reward:toNumMap() - --local reward, change = role:award(award, {log = {desc = "actMilestone", int1 = actid, int2 = index}}) - --SendPacket(actionCodes.Activity_battleMilestoneRpc, MsgPack.pack(role:packReward(reward, change))) + actCfg = csvdb["activity_wordboss_awardCsv"][battleCfg.worldBoss_award] + if not actCfg then return 5 end + local awardCfg = actCfg[index] + if not awardCfg then return 6 end + + local preList = awardCfg.condition1:toArray(true, "=") + + local actData = role.activity:getActData("ChallengeLevel") or {} + local battleInfo = actData[id] or {} + local bossPoint = battleInfo["bossP"] or 0 + if bossPoint < 1 then return 7 end + + local bossRecord = battleInfo["bossR"] or "" + local ok = false + if #preList == 0 then + ok = true + else + for _, i in ipairs(preList) do + local flag = string.char(string.getbit(bossRecord, i)) + if flag == "1" then + ok = true + break + end + end + end + if not ok then return 8 end + + battleInfo["bossR"] = string.setbit(bossRecord, index) + actData[id] = battleInfo + role.activity:updateActData("ChallengeLevel", actData) + + local award = awardCfg.reward:toNumMap() + local reward, change = role:award(award, {log = {desc = "worldBossReward", int1 = actid, int2 = index}}) + SendPacket(actionCodes.Activity_bossRewardRpc, MsgPack.pack(role:packReward(reward, change))) return true end diff --git a/src/actions/HeroAction.lua b/src/actions/HeroAction.lua index 0ef5af0..169d1a7 100644 --- a/src/actions/HeroAction.lua +++ b/src/actions/HeroAction.lua @@ -727,7 +727,7 @@ function _M.drawHeroRpc(agent, data) end end - -- 活动卡池 + -- 另开活动卡池 if actid then if not role.activity:isOpenById(actid, "ActHeroPool") then return end local cfg = csvdb["activity_ctrlCsv"][actid] @@ -974,11 +974,16 @@ function _M.drawHeroRpc(agent, data) }) SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 - if (buildTypeData["can_feedback"] or 0) == 1 then + local feedbackId = buildTypeData["can_feedback"] or 0 + if feedbackId ~= 1 then -- 达到一定次数,给响应奖励 local oldVal = role:getProperty("repayHero") or 0 + if actid then + local actData = role.activity:getActData("ActHeroPool") + oldVal = actData[btype] + end local newVal = oldVal + drawCount[drawType] - local drawCardReward, val = role:getDrawCardExtraReward(oldVal, newVal) + local drawCardReward, val = role:getDrawCardExtraReward(feedbackId, oldVal, newVal) -- 空字符穿代表直接给英雄 走以前repayHeroRpc if drawCardReward == "" then local repayHeroMaxCount = role:getProperty("repayMaxC") or 0 @@ -992,7 +997,7 @@ function _M.drawHeroRpc(agent, data) else local giftHeroSet = {} for gid, cfg in pairs(csvdb["build_giftCsv"]) do - if cfg["pool_1"] ~= 0 and not role:isHaveHero(gid - ItemStartId.Hero) then + if cfg["pool_"..feedbackId] ~= 0 and not role:isHaveHero(gid - ItemStartId.Hero) then giftHeroSet[gid] = {1} end end @@ -1021,7 +1026,13 @@ function _M.drawHeroRpc(agent, data) r, change = role:award(drawCardReward, {log = {desc = "drawHeroExtraReward", int1 = oldVal, int2 = newVal}}) SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack(role:packReward(r, change))) end - role:updateProperty({field = "repayHero", value = val}) + if not actid then + role:updateProperty({field = "repayHero", value = val}) + else + local actData = role.activity:getActData("ActHeroPool") + actData[btype] = val + role.activity:updateActData("ActHeroPool", actData) + end end return true end diff --git a/src/actions/StoreAction.lua b/src/actions/StoreAction.lua index fea5a20..766e1ed 100644 --- a/src/actions/StoreAction.lua +++ b/src/actions/StoreAction.lua @@ -13,6 +13,9 @@ function _M.rechargeRpc(agent , data) --创建订单号 local partnerOrderId = role:getPurchaseOrder(id) + if partnerOrderId == "" then + return 1 + end SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({ order = partnerOrderId })) diff --git a/src/csvdata b/src/csvdata index 591f2b4..f0e032e 160000 --- a/src/csvdata +++ b/src/csvdata @@ -1 +1 @@ -Subproject commit 591f2b4097214f9f5bf3b746f86ac704cbc9ea44 +Subproject commit f0e032edd4de127bf13d4a915e3909d724ba7652 diff --git a/src/models/Activity.lua b/src/models/Activity.lua index 4a659c8..59ff94e 100644 --- a/src/models/Activity.lua +++ b/src/models/Activity.lua @@ -69,6 +69,8 @@ Activity.schema = { act18 = {"table", {}, true}, -- {id=兑换数量} act19 = {"number", 0}, -- {挂机信息} act20 = {"table", {}}, -- {id=扭蛋抽出数量} + + act24 = {"table", {}, true}, -- 活动卡池 {id=repaynum} } function Activity:data() @@ -489,6 +491,19 @@ activityFunc[Activity.ActivityType.Gachakon] = { end, } +-- 活动卡池 +activityFunc[Activity.ActivityType.ActHeroPool] = { + ["init"] = function(self, actType, isCrossDay, notify, actId) + end, + ["close"] = function(self, actType, notify, actId) + local actData = self:getActData(actType) + local cfg = csvdb["activity_ctrlCsv"][actId] + if not cfg then return end + actData[cfg.condition] = nil + self:updateActData(actType, actData, not notify) + end, +} + -- 挂机掉落 activityFunc[Activity.ActivityType.HangDrop] = { ["init"] = function(self, actType, isCrossDay, notify, actId) @@ -540,7 +555,9 @@ function Activity:closeActivity(actId, notify, notUpdateAct) self:recycleActItem(actId) end if Activity.schema["act".. actType] then - self:updateActData(actType, Activity.schema["act" .. actType][2], not notify or notUpdateAct) + if not Activity.schema["act" .. actType][3] then + self:updateActData(actType, Activity.schema["act" .. actType][2], not notify or notUpdateAct) + end end end diff --git a/src/models/RoleLog.lua b/src/models/RoleLog.lua index 23ff502..beff556 100644 --- a/src/models/RoleLog.lua +++ b/src/models/RoleLog.lua @@ -50,6 +50,7 @@ local ItemReason = { actHangDrop = 134, -- 掉落活动奖励 actBattle = 135, -- 活动关卡 actMilestone = 136, -- 活动关卡boss伤害里程碑 + worldBossReward = 137, -- 世界boss翻牌奖励 advHang = 301, -- 拾荒挂机 diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index 57080a7..404f8d6 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -1580,15 +1580,17 @@ function RolePlugin.bind(Role) return "" end local limit = rechargeData.limit - local rechargeRecord = self:getProperty("payR") or {} + local rechargeRecord = self.storeData:getProperty("payR") or {} if limit ~= 0 and limit <= (rechargeRecord[rechargeId] or 0) then return "" end --判断是否是活动商品 - local actCfg = csvdb["activity_ctrlCsv"][rechargeData.activity_id] - if not actCfg then return "" end - if not self.activity:isOpenById(rechargeData.activity_id, "ActShopGoods") then return "" end + if rechargeData.activity_id ~= 0 then + local actCfg = csvdb["activity_ctrlCsv"][rechargeData.activity_id] + if not actCfg then return "" end + if not self.activity:isOpenById(rechargeData.activity_id, "ActShopGoods") then return "" end + end local orderId = redisproxy:hget(string.format(R_ORDERS, roleId), rechargeId) if orderId then @@ -1834,10 +1836,10 @@ function RolePlugin.bind(Role) end -- 抽卡阶段奖励 - function Role:getDrawCardExtraReward(oldVal, newVal) + function Role:getDrawCardExtraReward(feedbackId, oldVal, newVal) local reward = nil local maxCount = 0 - for k, v in pairs(csvdb["build_extraRewardCsv"]) do + for k, v in pairs(csvdb["build_extraRewardCsv"][feedbackId]) do if oldVal < k and newVal >= k then reward = v["reward"] or "" end -- libgit2 0.21.2