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 | 22 | return false |
23 | 23 | end |
24 | 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 | 27 | local nowCoinTime = math.min(skynet.timex(), hangInfo.endCoinTime or 0) |
27 | 28 | local nowItemTime = math.min(skynet.timex(), hangInfo.endItemTime or 0) |
28 | 29 | |
... | ... | @@ -42,9 +43,9 @@ local function checkReward(role) |
42 | 43 | |
43 | 44 | local items = role:getProperty("hangBag") |
44 | 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 | 50 | local pool = {} |
50 | 51 | for _, temp in pairs(carbonData.item:toArray()) do |
... | ... | @@ -144,7 +145,7 @@ function _M.startRpc( agent, data ) |
144 | 145 | local hangInfo = role:getProperty("hangInfo") |
145 | 146 | local isNew = not hangInfo.carbonId |
146 | 147 | hangInfo.carbonId = carbonId |
147 | - hangInfo.expCarbonId = isNew and carbonId or hangInfo.expCarbonId | |
148 | + --hangInfo.expCarbonId = isNew and carbonId or hangInfo.expCarbonId | |
148 | 149 | local nowTime = skynet.timex() |
149 | 150 | if isNew then |
150 | 151 | hangInfo.coinTime = nowTime |
... | ... | @@ -279,15 +280,25 @@ function _M.endBattleRpc(agent, data) |
279 | 280 | local nextCarbonId = role:getNextCarbonId(carbonId) |
280 | 281 | -- 设置挂机关卡 |
281 | 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 | 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 | 302 | --local cfg = csvdb["idle_battleCsv"][nextCarbonId] |
292 | 303 | --if cfg then |
293 | 304 | -- hangInfo.bossTime = skynet.timex() + cfg.idle_time |
... | ... | @@ -418,7 +429,8 @@ function _M.quickRpc(agent , data) |
418 | 429 | local hangInfo = role:getProperty("hangInfo") |
419 | 430 | if not hangInfo.carbonId then return end |
420 | 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 | 435 | local curCount = role.dailyData:getProperty("hangQC") + 1 |
424 | 436 | local costs = globalCsv.idle_quickproduce_cost:toArray(true, "=") |
... | ... | @@ -435,9 +447,9 @@ function _M.quickRpc(agent , data) |
435 | 447 | |
436 | 448 | local coinCount = math.floor(time / globalCsv.idle_money_produce_cd) |
437 | 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 | 454 | local pool = {} |
443 | 455 | for _, temp in pairs(carbonData.item:toArray()) do | ... | ... |
src/actions/RoleAction.lua
... | ... | @@ -756,18 +756,14 @@ function _M.openSpeedUpBoxRpc(agent, data) |
756 | 756 | |
757 | 757 | if useType == 1 then -- 挂机齿轮 |
758 | 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 | 762 | elseif useType == 2 then -- 挂机经验 |
765 | 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 | 767 | elseif useType == 3 then -- 食材商人收入 |
772 | 768 | local buildType = 6 |
773 | 769 | local level = role.dinerData:getProperty("buildL"):getv(buildType, 1) | ... | ... |
src/actions/SeaportAction.lua
... | ... | @@ -203,8 +203,8 @@ function _M.taskRpc(agent, data) |
203 | 203 | end |
204 | 204 | |
205 | 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 | 209 | local totalCoef = 0 |
210 | 210 | for _, heroId in ipairs(collect.team:toArray(true,"=")) do |
... | ... | @@ -222,8 +222,8 @@ function _M.taskRpc(agent, data) |
222 | 222 | bigSuccess = true |
223 | 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 | 227 | local itemReward = data.item_clear_special:toNumMap() |
228 | 228 | itemReward[ItemId.Gold] = (itemReward[ItemId.Gold] or 0) + money |
229 | 229 | itemReward[ItemId.Exp] = (itemReward[ItemId.Exp] or 0) + exp | ... | ... |
src/models/RolePlugin.lua
... | ... | @@ -1409,7 +1409,7 @@ function RolePlugin.bind(Role) |
1409 | 1409 | end |
1410 | 1410 | |
1411 | 1411 | local carbonCsv = csvdb["idle_battleCsv"] |
1412 | - local expCarbonId = self:getProperty("hangInfo").expCarbonId | |
1412 | + local expData = self:getProperty("hangInfo").expData or {} | |
1413 | 1413 | local taskCsv = csvdb["seaport_taskCsv"] |
1414 | 1414 | local endTime = openTime0 + 86400 * 2 |
1415 | 1415 | local reward = {} |
... | ... | @@ -1422,7 +1422,7 @@ function RolePlugin.bind(Role) |
1422 | 1422 | local teams = collect[slot].team |
1423 | 1423 | local time = collect[slot].time |
1424 | 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 | 1427 | local totalCoef = 0 |
1428 | 1428 | for _, heroId in ipairs(teams:toArray(true,"=")) do |
... | ... | @@ -1439,8 +1439,8 @@ function RolePlugin.bind(Role) |
1439 | 1439 | bigSuccess = true |
1440 | 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 | 1444 | local itemReward = data.item_clear_special:toNumMap() |
1445 | 1445 | itemReward[ItemId.Gold] = (itemReward[ItemId.Gold] or 0) + money |
1446 | 1446 | itemReward[ItemId.Exp] = (itemReward[ItemId.Exp] or 0) + exp | ... | ... |