Commit 2a5428655f723ce363ee74534eadf20878d1a3df
1 parent
a04fb7d7
齿轮、经验 奖励投放逻辑调整
Showing
5 changed files
with
44 additions
and
36 deletions
Show diff stats
src/actions/HangAction.lua
@@ -22,7 +22,8 @@ local function checkReward(role) | @@ -22,7 +22,8 @@ local function checkReward(role) | ||
22 | return false | 22 | return false |
23 | end | 23 | end |
24 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] | 24 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] |
25 | - local expCarbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | 25 | + --local expCarbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] |
26 | + local expCarbonData = hangInfo.expData or {} | ||
26 | local nowCoinTime = math.min(skynet.timex(), hangInfo.endCoinTime or 0) | 27 | local nowCoinTime = math.min(skynet.timex(), hangInfo.endCoinTime or 0) |
27 | local nowItemTime = math.min(skynet.timex(), hangInfo.endItemTime or 0) | 28 | local nowItemTime = math.min(skynet.timex(), hangInfo.endItemTime or 0) |
28 | 29 | ||
@@ -42,9 +43,9 @@ local function checkReward(role) | @@ -42,9 +43,9 @@ local function checkReward(role) | ||
42 | 43 | ||
43 | local items = role:getProperty("hangBag") | 44 | local items = role:getProperty("hangBag") |
44 | coinCount = (coinCount + coinDoubleCount) * expCoef | 45 | coinCount = (coinCount + coinDoubleCount) * expCoef |
45 | - items[ItemId.Gold] = math.floor((items[ItemId.Gold] or 0) + coinCount * expCarbonData.money) | ||
46 | - items[ItemId.Exp] = math.floor((items[ItemId.Exp] or 0) + coinCount * expCarbonData.exp) | ||
47 | - items[ItemId.PlayerExp] = math.floor((items[ItemId.PlayerExp] or 0) + coinCount * expCarbonData.playerExp) | 46 | + items[ItemId.Gold] = math.floor((items[ItemId.Gold] or 0) + coinCount * (expCarbonData.money or 0)) |
47 | + items[ItemId.Exp] = math.floor((items[ItemId.Exp] or 0) + coinCount * (expCarbonData.exp or 0)) | ||
48 | + items[ItemId.PlayerExp] = math.floor((items[ItemId.PlayerExp] or 0) + (coinCount * expCarbonData.playerExp or 0)) | ||
48 | 49 | ||
49 | local pool = {} | 50 | local pool = {} |
50 | for _, temp in pairs(carbonData.item:toArray()) do | 51 | for _, temp in pairs(carbonData.item:toArray()) do |
@@ -144,7 +145,7 @@ function _M.startRpc( agent, data ) | @@ -144,7 +145,7 @@ function _M.startRpc( agent, data ) | ||
144 | local hangInfo = role:getProperty("hangInfo") | 145 | local hangInfo = role:getProperty("hangInfo") |
145 | local isNew = not hangInfo.carbonId | 146 | local isNew = not hangInfo.carbonId |
146 | hangInfo.carbonId = carbonId | 147 | hangInfo.carbonId = carbonId |
147 | - hangInfo.expCarbonId = isNew and carbonId or hangInfo.expCarbonId | 148 | + --hangInfo.expCarbonId = isNew and carbonId or hangInfo.expCarbonId |
148 | local nowTime = skynet.timex() | 149 | local nowTime = skynet.timex() |
149 | if isNew then | 150 | if isNew then |
150 | hangInfo.coinTime = nowTime | 151 | hangInfo.coinTime = nowTime |
@@ -279,15 +280,25 @@ function _M.endBattleRpc(agent, data) | @@ -279,15 +280,25 @@ function _M.endBattleRpc(agent, data) | ||
279 | local nextCarbonId = role:getNextCarbonId(carbonId) | 280 | local nextCarbonId = role:getNextCarbonId(carbonId) |
280 | -- 设置挂机关卡 | 281 | -- 设置挂机关卡 |
281 | if isWin then --and (hangInfo.carbonId or 0) < nextCarbonId then | 282 | if isWin then --and (hangInfo.carbonId or 0) < nextCarbonId then |
282 | - if not hangInfo.expCarbonId then | ||
283 | - hangInfo.expCarbonId = carbonId | ||
284 | - else | ||
285 | - local oldCarbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | ||
286 | - local newCarbonData = csvdb["idle_battleCsv"][carbonId] | ||
287 | - if oldCarbonData.money < newCarbonData.money then | ||
288 | - hangInfo.expCarbonId = carbonId | ||
289 | - end | 283 | + local newCarbonData = csvdb["idle_battleCsv"][carbonId] |
284 | + if newCarbonData then | ||
285 | + local expData = hangInfo.expData or {} | ||
286 | + expData.exp = (expData.exp or 0) + newCarbonData.exp | ||
287 | + expData.money = (expData.money or 0) + newCarbonData.money | ||
288 | + expData.playerExp = (expData.playerExp or 0) + newCarbonData.playerExp | ||
289 | + hangInfo.expData = expData | ||
290 | end | 290 | end |
291 | + | ||
292 | + --if not hangInfo.expCarbonId then | ||
293 | + -- hangInfo.expCarbonId = carbonId | ||
294 | + --else | ||
295 | + -- local oldCarbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | ||
296 | + -- local newCarbonData = csvdb["idle_battleCsv"][carbonId] | ||
297 | + -- if oldCarbonData.money < newCarbonData.money then | ||
298 | + -- hangInfo.expCarbonId = carbonId | ||
299 | + -- end | ||
300 | + --end | ||
301 | + | ||
291 | --local cfg = csvdb["idle_battleCsv"][nextCarbonId] | 302 | --local cfg = csvdb["idle_battleCsv"][nextCarbonId] |
292 | --if cfg then | 303 | --if cfg then |
293 | -- hangInfo.bossTime = skynet.timex() + cfg.idle_time | 304 | -- hangInfo.bossTime = skynet.timex() + cfg.idle_time |
@@ -418,7 +429,8 @@ function _M.quickRpc(agent , data) | @@ -418,7 +429,8 @@ function _M.quickRpc(agent , data) | ||
418 | local hangInfo = role:getProperty("hangInfo") | 429 | local hangInfo = role:getProperty("hangInfo") |
419 | if not hangInfo.carbonId then return end | 430 | if not hangInfo.carbonId then return end |
420 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] | 431 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] |
421 | - local expCarbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | 432 | + --local expCarbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] |
433 | + local expCarbonData = hangInfo.expData or {} | ||
422 | 434 | ||
423 | local curCount = role.dailyData:getProperty("hangQC") + 1 | 435 | local curCount = role.dailyData:getProperty("hangQC") + 1 |
424 | local costs = globalCsv.idle_quickproduce_cost:toArray(true, "=") | 436 | local costs = globalCsv.idle_quickproduce_cost:toArray(true, "=") |
@@ -435,9 +447,9 @@ function _M.quickRpc(agent , data) | @@ -435,9 +447,9 @@ function _M.quickRpc(agent , data) | ||
435 | 447 | ||
436 | local coinCount = math.floor(time / globalCsv.idle_money_produce_cd) | 448 | local coinCount = math.floor(time / globalCsv.idle_money_produce_cd) |
437 | local itemCount = math.floor(time / globalCsv.idle_item_produce_cd) | 449 | local itemCount = math.floor(time / globalCsv.idle_item_produce_cd) |
438 | - reward[ItemId.Gold] = math.floor((reward[ItemId.Gold] or 0) + coinCount * expCarbonData.money) | ||
439 | - reward[ItemId.Exp] = math.floor((reward[ItemId.Exp] or 0) + coinCount * expCarbonData.exp) | ||
440 | - reward[ItemId.PlayerExp] = math.floor((reward[ItemId.PlayerExp] or 0) + coinCount * expCarbonData.playerExp) | 450 | + reward[ItemId.Gold] = math.floor((reward[ItemId.Gold] or 0) + coinCount * (expCarbonData.money or 0)) |
451 | + reward[ItemId.Exp] = math.floor((reward[ItemId.Exp] or 0) + coinCount * (expCarbonData.exp or 0)) | ||
452 | + reward[ItemId.PlayerExp] = math.floor((reward[ItemId.PlayerExp] or 0) + coinCount * (expCarbonData.playerExp or 0)) | ||
441 | 453 | ||
442 | local pool = {} | 454 | local pool = {} |
443 | for _, temp in pairs(carbonData.item:toArray()) do | 455 | for _, temp in pairs(carbonData.item:toArray()) do |
src/actions/RoleAction.lua
@@ -756,18 +756,14 @@ function _M.openSpeedUpBoxRpc(agent, data) | @@ -756,18 +756,14 @@ function _M.openSpeedUpBoxRpc(agent, data) | ||
756 | 756 | ||
757 | if useType == 1 then -- 挂机齿轮 | 757 | if useType == 1 then -- 挂机齿轮 |
758 | local hangInfo = role:getProperty("hangInfo") | 758 | local hangInfo = role:getProperty("hangInfo") |
759 | - if not hangInfo.expCarbonId then | ||
760 | - return 2 | ||
761 | - end | ||
762 | - local carbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | ||
763 | - reward[ItemId.Gold] = (reward[ItemId.Gold] or 0) + math.floor(time / globalCsv.idle_money_produce_cd) * carbonData.money * count | 759 | + local expData = hangInfo.expData or {} |
760 | + --local carbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | ||
761 | + reward[ItemId.Gold] = (reward[ItemId.Gold] or 0) + math.floor(time / globalCsv.idle_money_produce_cd) * (expData.money or 0) * count | ||
764 | elseif useType == 2 then -- 挂机经验 | 762 | elseif useType == 2 then -- 挂机经验 |
765 | local hangInfo = role:getProperty("hangInfo") | 763 | local hangInfo = role:getProperty("hangInfo") |
766 | - if not hangInfo.expCarbonId then | ||
767 | - return 3 | ||
768 | - end | ||
769 | - local carbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | ||
770 | - reward[ItemId.Exp] = (reward[ItemId.Exp] or 0) + math.floor(time / globalCsv.idle_money_produce_cd) * carbonData.exp * count | 764 | + local expData = hangInfo.expData or {} |
765 | + --local carbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | ||
766 | + reward[ItemId.Exp] = (reward[ItemId.Exp] or 0) + math.floor(time / globalCsv.idle_money_produce_cd) * (expData.exp or 0) * count | ||
771 | elseif useType == 3 then -- 食材商人收入 | 767 | elseif useType == 3 then -- 食材商人收入 |
772 | local buildType = 6 | 768 | local buildType = 6 |
773 | local level = role.dinerData:getProperty("buildL"):getv(buildType, 1) | 769 | local level = role.dinerData:getProperty("buildL"):getv(buildType, 1) |
src/actions/SeaportAction.lua
@@ -203,8 +203,8 @@ function _M.taskRpc(agent, data) | @@ -203,8 +203,8 @@ function _M.taskRpc(agent, data) | ||
203 | end | 203 | end |
204 | 204 | ||
205 | local carbonCsv = csvdb["idle_battleCsv"] | 205 | local carbonCsv = csvdb["idle_battleCsv"] |
206 | - local expCarbonId = role:getProperty("hangInfo").expCarbonId | ||
207 | - if not carbonCsv[expCarbonId] then return 7 end | 206 | + local expData = role:getProperty("hangInfo").expData or {} |
207 | + --if not carbonCsv[expCarbonId] then return 7 end | ||
208 | 208 | ||
209 | local totalCoef = 0 | 209 | local totalCoef = 0 |
210 | for _, heroId in ipairs(collect.team:toArray(true,"=")) do | 210 | for _, heroId in ipairs(collect.team:toArray(true,"=")) do |
@@ -222,8 +222,8 @@ function _M.taskRpc(agent, data) | @@ -222,8 +222,8 @@ function _M.taskRpc(agent, data) | ||
222 | bigSuccess = true | 222 | bigSuccess = true |
223 | end | 223 | end |
224 | 224 | ||
225 | - local money = math.ceil(carbonCsv[expCarbonId].money / 5 * data.time * data.money_clear) | ||
226 | - local exp = math.ceil(carbonCsv[expCarbonId].exp / 5 * data.time * data.exp_clear) | 225 | + local money = math.ceil((expData.money or 0) / 5 * data.time * data.money_clear) |
226 | + local exp = math.ceil((expData.exp or 0) / 5 * data.time * data.exp_clear) | ||
227 | local itemReward = data.item_clear_special:toNumMap() | 227 | local itemReward = data.item_clear_special:toNumMap() |
228 | itemReward[ItemId.Gold] = (itemReward[ItemId.Gold] or 0) + money | 228 | itemReward[ItemId.Gold] = (itemReward[ItemId.Gold] or 0) + money |
229 | itemReward[ItemId.Exp] = (itemReward[ItemId.Exp] or 0) + exp | 229 | itemReward[ItemId.Exp] = (itemReward[ItemId.Exp] or 0) + exp |
src/models/RolePlugin.lua
@@ -1409,7 +1409,7 @@ function RolePlugin.bind(Role) | @@ -1409,7 +1409,7 @@ function RolePlugin.bind(Role) | ||
1409 | end | 1409 | end |
1410 | 1410 | ||
1411 | local carbonCsv = csvdb["idle_battleCsv"] | 1411 | local carbonCsv = csvdb["idle_battleCsv"] |
1412 | - local expCarbonId = self:getProperty("hangInfo").expCarbonId | 1412 | + local expData = self:getProperty("hangInfo").expData or {} |
1413 | local taskCsv = csvdb["seaport_taskCsv"] | 1413 | local taskCsv = csvdb["seaport_taskCsv"] |
1414 | local endTime = openTime0 + 86400 * 2 | 1414 | local endTime = openTime0 + 86400 * 2 |
1415 | local reward = {} | 1415 | local reward = {} |
@@ -1422,7 +1422,7 @@ function RolePlugin.bind(Role) | @@ -1422,7 +1422,7 @@ function RolePlugin.bind(Role) | ||
1422 | local teams = collect[slot].team | 1422 | local teams = collect[slot].team |
1423 | local time = collect[slot].time | 1423 | local time = collect[slot].time |
1424 | if time + data.time <= endTime then | 1424 | if time + data.time <= endTime then |
1425 | - if not carbonCsv[expCarbonId] then break end | 1425 | + --if not carbonCsv[expCarbonId] then break end |
1426 | 1426 | ||
1427 | local totalCoef = 0 | 1427 | local totalCoef = 0 |
1428 | for _, heroId in ipairs(teams:toArray(true,"=")) do | 1428 | for _, heroId in ipairs(teams:toArray(true,"=")) do |
@@ -1439,8 +1439,8 @@ function RolePlugin.bind(Role) | @@ -1439,8 +1439,8 @@ function RolePlugin.bind(Role) | ||
1439 | bigSuccess = true | 1439 | bigSuccess = true |
1440 | end | 1440 | end |
1441 | 1441 | ||
1442 | - local money = math.ceil(carbonCsv[expCarbonId].money / 5 * data.time * data.money_clear) | ||
1443 | - local exp = math.ceil(carbonCsv[expCarbonId].exp / 5 * data.time * data.exp_clear) | 1442 | + local money = math.ceil((expData.money or 0) / 5 * data.time * data.money_clear) |
1443 | + local exp = math.ceil((expData.exp or 0) / 5 * data.time * data.exp_clear) | ||
1444 | local itemReward = data.item_clear_special:toNumMap() | 1444 | local itemReward = data.item_clear_special:toNumMap() |
1445 | itemReward[ItemId.Gold] = (itemReward[ItemId.Gold] or 0) + money | 1445 | itemReward[ItemId.Gold] = (itemReward[ItemId.Gold] or 0) + money |
1446 | itemReward[ItemId.Exp] = (itemReward[ItemId.Exp] or 0) + exp | 1446 | itemReward[ItemId.Exp] = (itemReward[ItemId.Exp] or 0) + exp |