Commit 058b4f092a0228868802b42018f8ac161eccca38
1 parent
4d684a8b
feat: 限制每天购买竞技场门票的张数
Showing
2 changed files
with
10 additions
and
0 deletions
Show diff stats
src/actions/PvpAction.lua
| @@ -243,6 +243,12 @@ function _M.buyCountRpc(agent, data) | @@ -243,6 +243,12 @@ function _M.buyCountRpc(agent, data) | ||
| 243 | 243 | ||
| 244 | local cost = {[ItemId.Jade] = globalCsv.pvp_buy_cost * count} | 244 | local cost = {[ItemId.Jade] = globalCsv.pvp_buy_cost * count} |
| 245 | if not role:checkItemEnough(cost) then return 2 end | 245 | if not role:checkItemEnough(cost) then return 2 end |
| 246 | + | ||
| 247 | + --限制每天购买次数 | ||
| 248 | + local pvpBought = role.dailyData:getProperty("pvpBought") | ||
| 249 | + if count + pvpBought > globalCsv["pvp_buy_max"] then return 3 end | ||
| 250 | + role.dailyData:updateProperty({field = "pvpBought", value = count + pvpBought}) | ||
| 251 | + | ||
| 246 | role:costItems(cost, {log = {desc = "buyPvpKey"}}) | 252 | role:costItems(cost, {log = {desc = "buyPvpKey"}}) |
| 247 | role:award({[ItemId.PvpKey] = count}, {log = {desc = "buyPvpKey"}}) | 253 | role:award({[ItemId.PvpKey] = count}, {log = {desc = "buyPvpKey"}}) |
| 248 | 254 |
src/models/Daily.lua
| @@ -22,6 +22,7 @@ Daily.schema = { | @@ -22,6 +22,7 @@ Daily.schema = { | ||
| 22 | getFP = {"table", {}}, -- 领过谁的心心 | 22 | getFP = {"table", {}}, -- 领过谁的心心 |
| 23 | pvpFree = {"number", 0}, -- pvp使用免费次数 | 23 | pvpFree = {"number", 0}, -- pvp使用免费次数 |
| 24 | pvpFreeH = {"number", 0}, -- 高级pvp使用免费次数 | 24 | pvpFreeH = {"number", 0}, -- 高级pvp使用免费次数 |
| 25 | + pvpBought = {"number", 0}, -- pvp购买次数 | ||
| 25 | 26 | ||
| 26 | dailySDC = {"table", {}}, -- daily shop diamond count {[id] = count} -- 每日商城购买次数统计 | 27 | dailySDC = {"table", {}}, -- daily shop diamond count {[id] = count} -- 每日商城购买次数统计 |
| 27 | dailySDD = {"table", {}}, -- daily shop diamond disount {[id] = 1} -- 每日商城折扣统计 | 28 | dailySDD = {"table", {}}, -- daily shop diamond disount {[id] = 1} -- 每日商城折扣统计 |
| @@ -69,6 +70,8 @@ function Daily:refreshDailyData(notify) | @@ -69,6 +70,8 @@ function Daily:refreshDailyData(notify) | ||
| 69 | -- skip | 70 | -- skip |
| 70 | elseif field == "treasureList" then | 71 | elseif field == "treasureList" then |
| 71 | dataMap[field] = self:getTreasrueList() | 72 | dataMap[field] = self:getTreasrueList() |
| 73 | + elseif field == "pvpBought" then | ||
| 74 | + dataMap[field] = 0 | ||
| 72 | elseif field ~= "key" then | 75 | elseif field ~= "key" then |
| 73 | local typ, def = table.unpack(schema) | 76 | local typ, def = table.unpack(schema) |
| 74 | dataMap[field] = def | 77 | dataMap[field] = def |
| @@ -367,6 +370,7 @@ function Daily:data() | @@ -367,6 +370,7 @@ function Daily:data() | ||
| 367 | getFP = self:getProperty("getFP"), | 370 | getFP = self:getProperty("getFP"), |
| 368 | pvpFree = self:getProperty("pvpFree"), | 371 | pvpFree = self:getProperty("pvpFree"), |
| 369 | pvpFreeH = self:getProperty("pvpFreeH"), | 372 | pvpFreeH = self:getProperty("pvpFreeH"), |
| 373 | + pvpBought = self:getProperty("pvpBought"), | ||
| 370 | dailySDC = self:getProperty("dailySDC"), | 374 | dailySDC = self:getProperty("dailySDC"), |
| 371 | dailySDD = self:getProperty("dailySDD"), | 375 | dailySDD = self:getProperty("dailySDD"), |
| 372 | advSupRe = self:getProperty("advSupRe"), | 376 | advSupRe = self:getProperty("advSupRe"), |