diff --git a/src/GlobalVar.lua b/src/GlobalVar.lua index 643edeb..b6d4d28 100644 --- a/src/GlobalVar.lua +++ b/src/GlobalVar.lua @@ -389,5 +389,5 @@ SystemBnousType = { Adv = 7, -- 代理拾荒获得额外道具 HangTime = 8, -- 挂机时间上限 PvpTicket = 9, -- 每周额外获得竞技场门票数量 - SweepReward = 10, -- 每次扫荡额外获得道具 + SweepReward = 10, -- 奖励关卡每次扫荡额外获得道具 } diff --git a/src/actions/AdvAction.lua b/src/actions/AdvAction.lua index 9a05601..81b98ca 100644 --- a/src/actions/AdvAction.lua +++ b/src/actions/AdvAction.lua @@ -276,7 +276,9 @@ function _M.startHangRpc(agent, data) if not adv_idle_time or not adv_idle_energy or not adv_idle_reward_coef then return 2 end - adv_idle_time = adv_idle_time * 60 + local timeAdd = role:getBnousHangTime() + adv_idle_time = adv_idle_time * 60 + timeAdd + local advHang = role:getProperty("advHang") if advHang[chapterId] then return 3 end --正在挂机 @@ -416,7 +418,8 @@ function _M.endHangRpc(agent, data) if not adv_idle_time or not adv_idle_energy or not adv_idle_reward_coef then return 2 end - adv_idle_time = adv_idle_time * 60 + local timeAdd = role:getBnousHangTime() + adv_idle_time = adv_idle_time * 60 + timeAdd local reward, isFull, change, heroFaithMap local heroCnt = 0 @@ -463,6 +466,15 @@ function _M.endHangRpc(agent, data) for itemId, count in pairs(idleReward) do idleReward[itemId] = count * adv_idle_reward_coef end + + local bnousReward = role:getBnousAdv() + for time, set in pairs(bnousReward) do + local delta = math.floor(adv_idle_time / time) + for key, value in pairs(set) do + idleReward[key] = (idleReward[key] or 0) + value * delta + end + end + reward, change = role:award(idleReward, {log = {desc = "advHang", int1 = chapterId}}) else if cancel then diff --git a/src/actions/DinerAction.lua b/src/actions/DinerAction.lua index ae12898..cd77abc 100644 --- a/src/actions/DinerAction.lua +++ b/src/actions/DinerAction.lua @@ -75,7 +75,8 @@ function _M.addSellRpc( agent, data ) sells[slot].count = count sells[slot].time = skynet.timex() - calSell.deltaTime - local needTime = sells[slot].count * dishData.sell_time + sells[slot].time - skynet.timex() + local timeSub = role:getBnousDiner(3,dishData.sell_time) + local needTime = sells[slot].count * (dishData.sell_time + timeSub) + sells[slot].time - skynet.timex() role:pushMsg({type = "food", slot = slot, time = needTime}) -- 检查解锁的顾客 @@ -742,11 +743,15 @@ function _M.getGreenhouseRpc( agent, data ) local now = skynet.timex() local gfood = role.dinerData:getProperty("gfood") if not next(gfood) then return end + + local timeSub = role:getBnousDiner(1,buildingData.speed) + local timeAdd = role:getBnousDiner(2,globalCsv.diner_get_food_time_max) + for k , v in pairs(gfood) do local itemId = v.id local st = v.st - local speed = globalCsv.diner_get_food_speed[csvdb["itemCsv"][itemId].quality] * buildingData.speed / 100 - local endTime = st + globalCsv.diner_get_food_time_max + local speed = globalCsv.diner_get_food_speed[csvdb["itemCsv"][itemId].quality] * (buildingData.speed + timeSub) / 100 + local endTime = st + globalCsv.diner_get_food_time_max + timeAdd local endTime2 = math.min(now, endTime) reward[itemId] = math.floor((endTime2 - st) / speed) if endTime2 == endTime then diff --git a/src/actions/HangAction.lua b/src/actions/HangAction.lua index 8cf7c0e..9a71056 100644 --- a/src/actions/HangAction.lua +++ b/src/actions/HangAction.lua @@ -508,7 +508,7 @@ function _M.buyBonusCountRpc(agent, data) return true end -local function bonusWinReward(role, bonusData, rewardType, count) +local function bonusWinReward(role, bonusData, rewardType, count, sweep) count = count or 1 local reward, change = {} @@ -548,6 +548,13 @@ local function bonusWinReward(role, bonusData, rewardType, count) end end + if sweep then + local bnousReward = role:getBnousSweep() + for key, value in pairs(bnousReward) do + reward[key] = (reward[key] or 0) + value * count + end + end + reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = bonusData.id}}) role:checkTaskEnter("BonusPass", {id = bonusData.id, count = count}) return reward, change @@ -589,7 +596,7 @@ function _M.startBonusBattleRpc(agent, data) bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + count role.dailyData:updateProperty({field = "bonusC", value = bonusC}) - local reward, change = bonusWinReward(role, bonusData, 3, count) + local reward, change = bonusWinReward(role, bonusData, 3, count, true) SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change})) role:checkTaskEnter("BonusQuick", {count = count}) diff --git a/src/actions/RadioAction.lua b/src/actions/RadioAction.lua index a4a1808..b734feb 100644 --- a/src/actions/RadioAction.lua +++ b/src/actions/RadioAction.lua @@ -95,8 +95,9 @@ function _M.startQuestRpc(agent, data) return 5 end -- start quest, set finish time + local timeSub = role:getBnousCrusade(config.time) local taskData = {} - taskData["time"] = skynet.timex() + config.time + taskData["time"] = skynet.timex() + config.time + timeSub taskData["heros"] = heros radioTask[id] = taskData role:updateProperty({field="radioTask", value=radioTask, notNotify=true}) diff --git a/src/models/Diner.lua b/src/models/Diner.lua index 1c5f29c..9b7b9d5 100644 --- a/src/models/Diner.lua +++ b/src/models/Diner.lua @@ -188,6 +188,10 @@ function Diner:calSellReward(sell, delta, dishData) local addReward = {} for key, value in pairs(dishData.item_normal:toNumMap()) do addReward[key] = (addReward[key] or 0) + value * delta + if key == ItemId.Gold then + local goldPriceAdd = self.owner:getBnousDiner(4,value) + addReward[key] = addReward[key] + goldPriceAdd * delta + end end popular = dishData.famous_normal * delta @@ -245,7 +249,7 @@ function Diner:updateSell(slot, calOnly) local deltaTime = 0 local deltaCount = 0 local timePass = skynet.timex() - sell.time - local sellTime = dishData.sell_time + local sellTime = dishData.sell_time + self.owner:getBnousDiner(3, dishData.sell_time) deltaCount = math.floor(timePass / sellTime) if deltaCount < sell.count then @@ -284,7 +288,7 @@ function Diner:expediteSell(slot) local dishData = csvdb["diner_dishCsv"][sell.dish][sell.level] local expediteCount = 0 local expediteTime = globalCsv.diner_sell_expediteTime - local sellTime = dishData.sell_time + local sellTime = dishData.sell_time + self.owner:getBnousDiner(3,dishData.sell_time) expediteCount = math.floor(expediteTime / sellTime) expediteCount = math.min(expediteCount, sell.count) local lastCount = sell.count - expediteCount diff --git a/src/models/RoleLog.lua b/src/models/RoleLog.lua index 1a0b258..2a65557 100644 --- a/src/models/RoleLog.lua +++ b/src/models/RoleLog.lua @@ -57,6 +57,7 @@ local ItemReason = { actBuyBpLevel = 141, -- 购买活动战令等级 newSign = 142,-- 新的活动签到 advLevelStage = 143, -- 拾荒活动阶段奖励 + towerBnous = 144, -- 爬塔到一定层数对某些功能的奖励 advHang = 301, -- 拾荒挂机 diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index 29b1e74..e4597e8 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -2159,8 +2159,6 @@ function RolePlugin.bind(Role) return hero:getProperty("faith") end - -- 电波塔加成 开始 - function Role:getTowerBnousActive(update) if not update and self.towerBnousActive then return self.towerBnousActive @@ -2205,53 +2203,64 @@ function RolePlugin.bind(Role) return self.towerBnousActive end - function Role:getTowerBnousBattleBuff() + function Role:getDeltaValue(result, value) + if not result then return 0 end + local delta = 0 + if result[1] and value then + delta = math.floor(value * result[1] / 100) + end + if result[0] then + delta = delta + result[0] + end + return delta + end + + function Role:getBnousBattleBuff() local towerBnous = self:getTowerBnousActive() return towerBnous[SystemBnousType.TowerBuff] end - function Role:getTowerBnousCrusade() + function Role:getBnousCrusade(value) local towerBnous = self:getTowerBnousActive() - return towerBnous[SystemBnousType.CrusadeTask] + return self:getDeltaValue(towerBnous[SystemBnousType.CrusadeTask], value) end - function Role:getTowerBnousDiner(type) + function Role:getBnousDiner(type, value) local towerBnous = self:getTowerBnousActive() type = type or 1 + local result if type == 1 then - return towerBnous[SystemBnousType.DinerGet] + result = towerBnous[SystemBnousType.DinerGet] elseif type == 2 then - return towerBnous[SystemBnousType.DinerLimit] + result = towerBnous[SystemBnousType.DinerLimit] elseif type == 3 then - return towerBnous[SystemBnousType.DinerSell] + result = towerBnous[SystemBnousType.DinerSell] elseif type == 4 then - return towerBnous[SystemBnousType.DinerPrice] + result = towerBnous[SystemBnousType.DinerPrice] end - return + return self:getDeltaValue(result, value) end - function Role:getTowerBnousAdv() + function Role:getBnousAdv() local towerBnous = self:getTowerBnousActive() - return towerBnous[SystemBnousType.Adv] + return towerBnous[SystemBnousType.Adv] or {} end - function Role:getTowerBnousHangTime() + function Role:getBnousHangTime() local towerBnous = self:getTowerBnousActive() - return towerBnous[SystemBnousType.HangTime] + return towerBnous[SystemBnousType.HangTime] or 0 end - function Role:getTowerBnousPvpTicket() + function Role:getBnousPvpTicket() local towerBnous = self:getTowerBnousActive() - return towerBnous[SystemBnousType.PvpTicket] + return towerBnous[SystemBnousType.PvpTicket] or {} end - function Role:getTowerBnousSweep() + function Role:getBnousSweep() local towerBnous = self:getTowerBnousActive() - return towerBnous[SystemBnousType.SweepReward] + return towerBnous[SystemBnousType.SweepReward] or {} end - -- 电波塔加成 结束 - end return RolePlugin \ No newline at end of file diff --git a/src/models/RoleTimeReset.lua b/src/models/RoleTimeReset.lua index 7112585..bdd6f8a 100644 --- a/src/models/RoleTimeReset.lua +++ b/src/models/RoleTimeReset.lua @@ -48,6 +48,12 @@ ResetFunc["CrossWeek"] = function(self, notify, response) response.dinerS = {} self.activity:refreshWeekData(notify) + + -- 跨周送一些道具 + local BnousReward = self:getBnousPvpTicket() + if next(BnousReward) then + local reward, change = self:award(BnousReward, {log = {desc = "towerBnous"}}) + end end -- libgit2 0.21.2