Commit b0a09a2469124bd89d7b20afb91352121708897a

Authored by 熊润斐
2 parents 5add8320 b3ca5d1f

Merge branch 'tr/bugfix-qa' into tr/publish/qa-dev

src/actions/GmAction.lua
... ... @@ -558,6 +558,26 @@ function _M.actbattle(role, pms)
558 558 return "成功"
559 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 581 function _M.helpRpc(agent, data)
562 582 SendPacket(actionCodes.Gm_helpRpc, MsgPack.pack({help = helpDes}))
563 583 return true
... ...
src/adv/Adv.lua
... ... @@ -812,14 +812,12 @@ function Adv:over(success, rewardRatio, overType)
812 812 local potionBag = self.owner:getProperty("potionBag")
813 813 for itemId, count in pairs(self.owner:getProperty("advItems"):toNumMap()) do
814 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 818 print("ERROR: no itemId in ItemCsv : ", itemId)
817 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 821 end
824 822 end
825 823 reward = self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}})
... ... @@ -1129,10 +1127,17 @@ function Adv:supplyPotion()
1129 1127 for potionId, set in pairs(potionCsv) do
1130 1128 local count = potionBag[potionId] or 0
1131 1129 if count > 0 then
1132   - local level = dishTree:getv(potionId,1)
1133   - local num = math.min(set[level].limit,count)
1134   - advItems = advItems:setv(potionId,num)
1135   - potionBag[potionId] = num ~= count and (count - num) or nil
  1130 + local max = set[dishTree:getv(potionId,1)].limit
  1131 + local old = advItems:getv(potionId,0)
  1132 + local need = max - old
  1133 +
  1134 + if need < count then
  1135 + advItems = advItems:setv(potionId,max)
  1136 + potionBag[potionId] = count - need
  1137 + else
  1138 + advItems = advItems:setv(potionId,old + count)
  1139 + potionBag[potionId] = nil
  1140 + end
1136 1141 end
1137 1142 end
1138 1143 self.owner:updateProperties({
... ...
src/models/Activity.lua
... ... @@ -834,25 +834,27 @@ activityFunc[Activity.ActivityType.Crisis] = {
834 834 for id, actSet in pairs(actCsv) do
835 835 if actSet.type == atype then
836 836 local status = actData.task[id] or 0
837   - status = status + count
838   - if status >= actSet.condition1 then
839   - local reward
840   - if actSet.loop == 1 then
841   - local rcount = math.floor(status / actSet.condition1)
842   - reward = actSet.reward:toNumMap()
843   - for itemId, itemC in pairs(reward) do
844   - reward[itemId] = itemC * rcount
  837 + if status ~= -1 then
  838 + status = status + count
  839 + if status >= actSet.condition1 then
  840 + local reward
  841 + if actSet.loop == 1 then
  842 + local rcount = math.floor(status / actSet.condition1)
  843 + reward = actSet.reward:toNumMap()
  844 + for itemId, itemC in pairs(reward) do
  845 + reward[itemId] = itemC * rcount
  846 + end
  847 + status = status % actSet.condition1
  848 + else
  849 + reward = actSet.reward
  850 + status = -1
845 851 end
846   - status = status % actSet.condition1
847   - else
848   - reward = actSet.reward
849   - status = -1
850   - end
851 852  
852   - self.owner:award(reward, {log = {desc = "activity_crisis"}, notNotify = not notify})
  853 + self.owner:award(reward, {log = {desc = "activity_crisis"}, notNotify = not notify})
  854 + end
  855 + actData.task[id] = status
  856 + change = true
853 857 end
854   - actData.task[id] = status
855   - change = true
856 858 end
857 859 end
858 860 if change then
... ...