Commit 127a5787e8e6449e426cf1117db66daa16a3c03b
1 parent
b992f1ca
商人卖完走人
Showing
1 changed file
with
7 additions
and
1 deletions
Show diff stats
src/adv/Adv.lua
| @@ -798,7 +798,8 @@ local function clickTrader(self, room, block, params) | @@ -798,7 +798,8 @@ local function clickTrader(self, room, block, params) | ||
| 798 | if not block.event.shop or not block.event.shop[buyId] then return end | 798 | if not block.event.shop or not block.event.shop[buyId] then return end |
| 799 | if (block.event.status or ""):getv(buyId, 0) == 1 then return end -- 买过了 | 799 | if (block.event.status or ""):getv(buyId, 0) == 1 then return end -- 买过了 |
| 800 | 800 | ||
| 801 | - if traderData.purchasetime <= #((block.event.status or ""):toArray()) then return end | 801 | + local buyCount = #((block.event.status or ""):toArray()) |
| 802 | + if traderData.purchasetime <= buyCount then return end | ||
| 802 | 803 | ||
| 803 | local goodsData = csvdb["event_trader_goodsCsv"][block.event.shop[buyId][1]] | 804 | local goodsData = csvdb["event_trader_goodsCsv"][block.event.shop[buyId][1]] |
| 804 | if not goodsData then return end | 805 | if not goodsData then return end |
| @@ -815,9 +816,14 @@ local function clickTrader(self, room, block, params) | @@ -815,9 +816,14 @@ local function clickTrader(self, room, block, params) | ||
| 815 | self.owner:updateProperty({field = "advShop", value = advShop}) | 816 | self.owner:updateProperty({field = "advShop", value = advShop}) |
| 816 | end | 817 | end |
| 817 | block.event.status = block.event.status:setv(buyId, 1) | 818 | block.event.status = block.event.status:setv(buyId, 1) |
| 819 | + buyCount = buyCount + 1 | ||
| 818 | self:checkTask(Adv.TaskType.Shop, 1, block.event.id) | 820 | self:checkTask(Adv.TaskType.Shop, 1, block.event.id) |
| 819 | self:checkAchievement(Adv.AchievType.Shop, 1, block.event.id) | 821 | self:checkAchievement(Adv.AchievType.Shop, 1, block.event.id) |
| 820 | self:backReward(reward) | 822 | self:backReward(reward) |
| 823 | + | ||
| 824 | + if traderData.purchasetime <= buyCount or #block.event.shop <= buyCount then | ||
| 825 | + block:clear() | ||
| 826 | + end | ||
| 821 | return true | 827 | return true |
| 822 | end | 828 | end |
| 823 | 829 |