Commit 4c553f2859481e75ae1de0506ef2218ed0d8dea4
Merge branch 'tr/bugfix-qa' into tr/publish/qa-out
Showing
2 changed files
with
27 additions
and
7 deletions
Show diff stats
src/actions/GmAction.lua
| @@ -558,6 +558,26 @@ function _M.actbattle(role, pms) | @@ -558,6 +558,26 @@ function _M.actbattle(role, pms) | ||
| 558 | return "成功" | 558 | return "成功" |
| 559 | end | 559 | end |
| 560 | 560 | ||
| 561 | +table.insert(helpDes, {"清空背包", "clearbag"}) | ||
| 562 | +function _M.clearbag(role, pms) | ||
| 563 | + -- 装备 | ||
| 564 | + role:updateProperty({field="equips", value = {}}) | ||
| 565 | + -- 道具 | ||
| 566 | + local items = role:getProperty("items"):toNumMap() | ||
| 567 | + for k, v in pairs(items) do | ||
| 568 | + role:addItem({itemId = k, count = -v, log = {desc = "gm"}}) | ||
| 569 | + end | ||
| 570 | + | ||
| 571 | + -- 铭文 | ||
| 572 | + local uids = {} | ||
| 573 | + for uid, _ in pairs(role.runeBag) do | ||
| 574 | + table.insert(uids, uid) | ||
| 575 | + end | ||
| 576 | + role:delRunes(uids, {log = {desc = "gm"}}) | ||
| 577 | + | ||
| 578 | + return "成功" | ||
| 579 | +end | ||
| 580 | + | ||
| 561 | function _M.helpRpc(agent, data) | 581 | function _M.helpRpc(agent, data) |
| 562 | SendPacket(actionCodes.Gm_helpRpc, MsgPack.pack({help = helpDes})) | 582 | SendPacket(actionCodes.Gm_helpRpc, MsgPack.pack({help = helpDes})) |
| 563 | return true | 583 | return true |
src/adv/Adv.lua
| @@ -812,14 +812,12 @@ function Adv:over(success, rewardRatio, overType) | @@ -812,14 +812,12 @@ function Adv:over(success, rewardRatio, overType) | ||
| 812 | local potionBag = self.owner:getProperty("potionBag") | 812 | local potionBag = self.owner:getProperty("potionBag") |
| 813 | for itemId, count in pairs(self.owner:getProperty("advItems"):toNumMap()) do | 813 | for itemId, count in pairs(self.owner:getProperty("advItems"):toNumMap()) do |
| 814 | local itemCsv = csvdb["itemCsv"][itemId] | 814 | local itemCsv = csvdb["itemCsv"][itemId] |
| 815 | - if not itemCsv then | 815 | + if advPotionCsv[itemId] then |
| 816 | + potionBag[itemId] = (potionBag[itemId] or 0) + count | ||
| 817 | + elseif not itemCsv then | ||
| 816 | print("ERROR: no itemId in ItemCsv : ", itemId) | 818 | print("ERROR: no itemId in ItemCsv : ", itemId) |
| 817 | elseif itemCsv.type ~= ItemType.AdvItem then | 819 | elseif itemCsv.type ~= ItemType.AdvItem then |
| 818 | - if advPotionCsv[itemId] then | ||
| 819 | - potionBag[itemId] = (potionBag[itemId] or 0) + count | ||
| 820 | - else | ||
| 821 | - reward[itemId] = math.ceil(count * rewardRatio / 100) | ||
| 822 | - end | 820 | + reward[itemId] = math.ceil(count * rewardRatio / 100) |
| 823 | end | 821 | end |
| 824 | end | 822 | end |
| 825 | reward = self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) | 823 | reward = self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) |
| @@ -1125,10 +1123,12 @@ function Adv:supplyPotion() | @@ -1125,10 +1123,12 @@ function Adv:supplyPotion() | ||
| 1125 | local potionCsv = csvdb["adv_potionCsv"] | 1123 | local potionCsv = csvdb["adv_potionCsv"] |
| 1126 | local potionBag = self.owner:getProperty("potionBag") | 1124 | local potionBag = self.owner:getProperty("potionBag") |
| 1127 | local advItems = self.owner:getProperty("advItems") | 1125 | local advItems = self.owner:getProperty("advItems") |
| 1126 | + local dishTree = self.owner.dinerData:getProperty("dishTree") | ||
| 1128 | for potionId, set in pairs(potionCsv) do | 1127 | for potionId, set in pairs(potionCsv) do |
| 1129 | local count = potionBag[potionId] or 0 | 1128 | local count = potionBag[potionId] or 0 |
| 1130 | if count > 0 then | 1129 | if count > 0 then |
| 1131 | - local num = math.min(set[1].limit,count) | 1130 | + local level = dishTree:getv(potionId,1) |
| 1131 | + local num = math.min(set[level].limit,count) | ||
| 1132 | advItems = advItems:setv(potionId,num) | 1132 | advItems = advItems:setv(potionId,num) |
| 1133 | potionBag[potionId] = num ~= count and (count - num) or nil | 1133 | potionBag[potionId] = num ~= count and (count - num) or nil |
| 1134 | end | 1134 | end |