Commit e1f521ec992e8bdba50d88b3d9dd03527b317bb8
Merge branch 'tr/bugfix-qa' into tr/develop
* tr/bugfix-qa: 清空背包gm 修复拾荒结算时,返还药剂错误导致药水被吞的bug 进入拾荒自动补给药水,按当前等级下的携带最大数量计算
Showing
2 changed files
with
27 additions
and
7 deletions
Show diff stats
src/actions/GmAction.lua
@@ -560,6 +560,26 @@ function _M.actbattle(role, pms) | @@ -560,6 +560,26 @@ function _M.actbattle(role, pms) | ||
560 | return "成功" | 560 | return "成功" |
561 | end | 561 | end |
562 | 562 | ||
563 | +table.insert(helpDes, {"清空背包", "clearbag"}) | ||
564 | +function _M.clearbag(role, pms) | ||
565 | + -- 装备 | ||
566 | + role:updateProperty({field="equips", value = {}}) | ||
567 | + -- 道具 | ||
568 | + local items = role:getProperty("items"):toNumMap() | ||
569 | + for k, v in pairs(items) do | ||
570 | + role:addItem({itemId = k, count = -v, log = {desc = "gm"}}) | ||
571 | + end | ||
572 | + | ||
573 | + -- 铭文 | ||
574 | + local uids = {} | ||
575 | + for uid, _ in pairs(role.runeBag) do | ||
576 | + table.insert(uids, uid) | ||
577 | + end | ||
578 | + role:delRunes(uids, {log = {desc = "gm"}}) | ||
579 | + | ||
580 | + return "成功" | ||
581 | +end | ||
582 | + | ||
563 | function _M.helpRpc(agent, data) | 583 | function _M.helpRpc(agent, data) |
564 | SendPacket(actionCodes.Gm_helpRpc, MsgPack.pack({help = helpDes})) | 584 | SendPacket(actionCodes.Gm_helpRpc, MsgPack.pack({help = helpDes})) |
565 | return true | 585 | return true |
src/adv/Adv.lua
@@ -869,14 +869,12 @@ function Adv:over(success, rewardRatio, overType) | @@ -869,14 +869,12 @@ function Adv:over(success, rewardRatio, overType) | ||
869 | local potionBag = self.owner:getProperty("potionBag") | 869 | local potionBag = self.owner:getProperty("potionBag") |
870 | for itemId, count in pairs(self.owner:getProperty("advItems"):toNumMap()) do | 870 | for itemId, count in pairs(self.owner:getProperty("advItems"):toNumMap()) do |
871 | local itemCsv = csvdb["itemCsv"][itemId] | 871 | local itemCsv = csvdb["itemCsv"][itemId] |
872 | - if not itemCsv then | 872 | + if advPotionCsv[itemId] then |
873 | + potionBag[itemId] = (potionBag[itemId] or 0) + count | ||
874 | + elseif not itemCsv then | ||
873 | print("ERROR: no itemId in ItemCsv : ", itemId) | 875 | print("ERROR: no itemId in ItemCsv : ", itemId) |
874 | elseif itemCsv.type ~= ItemType.AdvItem then | 876 | elseif itemCsv.type ~= ItemType.AdvItem then |
875 | - if advPotionCsv[itemId] then | ||
876 | - potionBag[itemId] = (potionBag[itemId] or 0) + count | ||
877 | - else | ||
878 | - reward[itemId] = math.ceil(count * rewardRatio / 100) | ||
879 | - end | 877 | + reward[itemId] = math.ceil(count * rewardRatio / 100) |
880 | end | 878 | end |
881 | end | 879 | end |
882 | reward = self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) | 880 | reward = self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) |
@@ -1185,10 +1183,12 @@ function Adv:supplyPotion() | @@ -1185,10 +1183,12 @@ function Adv:supplyPotion() | ||
1185 | local potionCsv = csvdb["adv_potionCsv"] | 1183 | local potionCsv = csvdb["adv_potionCsv"] |
1186 | local potionBag = self.owner:getProperty("potionBag") | 1184 | local potionBag = self.owner:getProperty("potionBag") |
1187 | local advItems = self.owner:getProperty("advItems") | 1185 | local advItems = self.owner:getProperty("advItems") |
1186 | + local dishTree = self.owner.dinerData:getProperty("dishTree") | ||
1188 | for potionId, set in pairs(potionCsv) do | 1187 | for potionId, set in pairs(potionCsv) do |
1189 | local count = potionBag[potionId] or 0 | 1188 | local count = potionBag[potionId] or 0 |
1190 | if count > 0 then | 1189 | if count > 0 then |
1191 | - local num = math.min(set[1].limit,count) | 1190 | + local level = dishTree:getv(potionId,1) |
1191 | + local num = math.min(set[level].limit,count) | ||
1192 | advItems = advItems:setv(potionId,num) | 1192 | advItems = advItems:setv(potionId,num) |
1193 | potionBag[potionId] = num ~= count and (count - num) or nil | 1193 | potionBag[potionId] = num ~= count and (count - num) or nil |
1194 | end | 1194 | end |