Commit 4b34fee85c860a4062f8395efe3f378402b65ee5

Authored by zhouhaihai
1 parent 866852ff

增加~= 0 判定

@@ -265,7 +265,9 @@ function Adv:awardRelay(relayData, notNotify) @@ -265,7 +265,9 @@ function Adv:awardRelay(relayData, notNotify)
265 local dropData = csvdb["event_dropCsv"][dropId] 265 local dropData = csvdb["event_dropCsv"][dropId]
266 if dropData then 266 if dropData then
267 local item = dropData["range"]:randWeight(true) 267 local item = dropData["range"]:randWeight(true)
268 - gift[item[1]] = (gift[item[1]] or 0) + item[2] 268 + if item[1] ~= 0 then
  269 + gift[item[1]] = (gift[item[1]] or 0) + item[2]
  270 + end
269 else 271 else
270 skynet.error(string.format("[ERROR]: event_dropCsv no id %s, adv_chapter_campsite", dropId)) 272 skynet.error(string.format("[ERROR]: event_dropCsv no id %s, adv_chapter_campsite", dropId))
271 end 273 end
@@ -1471,7 +1473,9 @@ local function doChooseEffect(self, effectStr, room, block, tag, chooseData) @@ -1471,7 +1473,9 @@ local function doChooseEffect(self, effectStr, room, block, tag, chooseData)
1471 local dropData = csvdb["event_dropCsv"][dropId] 1473 local dropData = csvdb["event_dropCsv"][dropId]
1472 if dropData then 1474 if dropData then
1473 local item = dropData["range"]:randWeight(true) 1475 local item = dropData["range"]:randWeight(true)
1474 - reward[item[1]] = (reward[item[1]] or 0) + item[2] 1476 + if item[1] ~= 0 then
  1477 + reward[item[1]] = (reward[item[1]] or 0) + item[2]
  1478 + end
1475 else 1479 else
1476 skynet.error(string.format("[ERROR]: event_dropCsv no id %s in %s id: %s", dropId, tag, chooseData.id)) 1480 skynet.error(string.format("[ERROR]: event_dropCsv no id %s in %s id: %s", dropId, tag, chooseData.id))
1477 end 1481 end
@@ -1778,7 +1782,9 @@ local function clickClick(self, room, block, params) @@ -1778,7 +1782,9 @@ local function clickClick(self, room, block, params)
1778 local reward = {} 1782 local reward = {}
1779 for _, dropId in ipairs(clickData.effect:toArray(true, "=")) do 1783 for _, dropId in ipairs(clickData.effect:toArray(true, "=")) do
1780 local item = csvdb["event_dropCsv"][dropId]["range"]:randWeight(true) 1784 local item = csvdb["event_dropCsv"][dropId]["range"]:randWeight(true)
1781 - reward[item[1]] = (reward[item[1]] or 0) + item[2] 1785 + if item[1] ~= 0 then
  1786 + reward[item[1]] = (reward[item[1]] or 0) + item[2]
  1787 + end
1782 end 1788 end
1783 self:award(reward, {log = {desc = "clickClick", int1 = block.event.id}}, {roomId = room.roomId, blockId = block.blockId}) 1789 self:award(reward, {log = {desc = "clickClick", int1 = block.event.id}}, {roomId = room.roomId, blockId = block.blockId})
1784 end, 1790 end,
src/adv/AdvBlock.lua
@@ -134,6 +134,9 @@ function Block:randomEvent() @@ -134,6 +134,9 @@ function Block:randomEvent()
134 randomFunc[AdvEventType.Drop] = function() 134 randomFunc[AdvEventType.Drop] = function()
135 if not self.event.item then 135 if not self.event.item then
136 self.event.item = csvdb["event_dropCsv"][self.event.id]["range"]:randWeight(true) 136 self.event.item = csvdb["event_dropCsv"][self.event.id]["range"]:randWeight(true)
  137 + if self.event.item[1] == 0 then
  138 + self:clear()
  139 + end
137 end 140 end
138 end 141 end
139 --交易 142 --交易
src/adv/AdvPassive.lua
@@ -527,8 +527,9 @@ function Passive:effect8(dropId) @@ -527,8 +527,9 @@ function Passive:effect8(dropId)
527 skynet.error(string.format("CSVDATA Error adv_map_passive %s effect 8 not id %s in event_drop", self.id, dropId)) 527 skynet.error(string.format("CSVDATA Error adv_map_passive %s effect 8 not id %s in event_drop", self.id, dropId))
528 end 528 end
529 local item = dropData["range"]:randWeight(true) 529 local item = dropData["range"]:randWeight(true)
530 - self.owner.battle.adv:award({[item[1]] = item[2]}, {log = {desc = "passive", int1 = self.id}}, {roomId = self.owner.roomId, blockId = self.owner.blockId})  
531 - 530 + if item[1] ~= 0 then
  531 + self.owner.battle.adv:award({[item[1]] = item[2]}, {log = {desc = "passive", int1 = self.id}}, {roomId = self.owner.roomId, blockId = self.owner.blockId})
  532 + end
532 end 533 end
533 534
534 --9=直接获得item(可在结算触发时使用) 535 --9=直接获得item(可在结算触发时使用)