From 0df83fa90cfe071a3afb211234ee114c4e1df4ac Mon Sep 17 00:00:00 2001 From: liuzujun <307836273@qq.com> Date: Tue, 20 Apr 2021 13:57:20 +0800 Subject: [PATCH] 料理解锁bug --- config/develop.lua | 4 ++-- src/actions/DinerAction.lua | 52 +++++++++++++++++++++++++++++++--------------------- src/csvdata | 2 +- src/models/RolePlugin.lua | 27 +++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 24 deletions(-) diff --git a/config/develop.lua b/config/develop.lua index 5d787b5..d7aeb74 100644 --- a/config/develop.lua +++ b/config/develop.lua @@ -1,6 +1,6 @@ include("basic.lua") -logd = 0 -- 是否开启日志 +logd = 1 -- 是否开启日志 thread = 4 codeurl = "192.168.0.199:9090" servId = 1 @@ -20,4 +20,4 @@ redis_auth = nil mysql_host = "127.0.0.1" mysql_port = 3306 mysql_user = "root" -mysql_password = "123456" \ No newline at end of file +mysql_password = "123456" diff --git a/src/actions/DinerAction.lua b/src/actions/DinerAction.lua index e1b7ec8..e71c814 100644 --- a/src/actions/DinerAction.lua +++ b/src/actions/DinerAction.lua @@ -703,31 +703,41 @@ function _M.addWantFoodRpc(agent , data) if #ids > buildingData.business then return 2 end local had = {} - for _, itemId in ipairs(ids) do - if had[itemId] then return end - had[itemId] = 1 - local foodData = csvdb["diner_materialCsv"][itemId] - if not foodData then return 3 end - if foodData.unlock ~= 0 then - -- 遍历adv_potion - for potionId, _ in pairs(csvdb["adv_potionCsv"]) do - local potionLv = role.dinerData:getProperty("dishTree"):getv(potionId, 0) - if potionLv < 1 then return 4 end - - local potionSet = csvdb["adv_potionCsv"][potionId] - if not potionSet then return 5 end - - local potionData = potionSet[potionLv] - if not potionData then return 6 end - - local cost = potionData.material:toNumMap() - if not cost[itemId] then return 7 end + -- 遍历adv_potion + for potionId, potionData in pairs(csvdb["adv_potionCsv"]) do + local potionLv = role:getPotionLevel(potionId) + if potionLv > 0 then + local cfg = potionData[potionLv] + if cfg then + local cost = cfg.material:toNumMap() + for id, _ in pairs(cost) do + local itemData = csvdb["itemCsv"][id] + local mData = csvdb["diner_materialCsv"][id] + if itemData.type == ItemType.Cuisine and not had[id] then + had[id] = true + end + end end - if not role:checkHangPass(foodData.unlock) then - return 4 + end + end + -- 遍历dish + for id, lv in pairs(role.dinerData:getProperty("dishTree"):toNumMap()) do + if csvdb["diner_dishCsv"][id] and csvdb["diner_dishCsv"][id][lv] then + local data = csvdb["diner_dishCsv"][id][lv] + local costs = data.material:toNumMap() + for id, _ in pairs(costs) do + local itemData = csvdb["itemCsv"][id] + local mData = csvdb["diner_materialCsv"][id] + if itemData.type == ItemType.Cuisine and not had[id] then + had[id] = true + end end end end + for _, itemId in ipairs(ids) do + if not had[itemId] then return 3 end + end + local gfood = {} for slot, itemId in ipairs(ids) do gfood[slot] = {id = itemId, st = skynet.timex()} diff --git a/src/csvdata b/src/csvdata index c676c60..bd32777 160000 --- a/src/csvdata +++ b/src/csvdata @@ -1 +1 @@ -Subproject commit c676c602628af1a3aa68b3d14b9bb80718ed4614 +Subproject commit bd3277759c409eff4355ef89ad2922db13bdd4db diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index 41b43bc..d180432 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -2757,6 +2757,33 @@ function RolePlugin.bind(Role) return towerBnous[SystemBnousType.SweepReward] or {} end + function Role:getPotionLevel(id) + local level = self.dinerData:getProperty("dishTree"):getv(id, 1) + local talentSet = csvdb["diner_talentCsv"][id] + if not talentSet then return 0 end + local talentData = talentSet[level] + if not talentData then return 0 end + + if talentData.pointFront == "" then + if talentData.levelFront ~= "" and not self:checkHangPass(tonumber(talentData.levelFront)) then + if level == 0 then return 0 end + end + return level + end + + if talentData.levelFront ~= "" and not self:checkHangPass(tonumber(talentData.levelFront)) then + if level == 0 then return 0 end + end + + for preId, needV in pairs(talentData.pointFront:toNumMap()) do + if self.dinerData:getProperty("dishTree"):getv(preId, 0) < needV then + if level == 0 then return 0 end + if level == 1 then return 0 end + end + end + return level + end + end return RolePlugin \ No newline at end of file -- libgit2 0.21.2