Commit cea66efddb9cc00a0c838ae73e90f64b9cd173e9
1 parent
2660491b
fix: 等级效果的bug,
把等级效果字段levelBnous数据从增量获取改为全量获取
Showing
3 changed files
with
67 additions
and
63 deletions
Show diff stats
src/models/Daily.lua
... | ... | @@ -69,7 +69,7 @@ function Daily:refreshDailyData(notify) |
69 | 69 | elseif field == "id" then |
70 | 70 | -- skip |
71 | 71 | elseif field == "treasureBase" then |
72 | - dataMap[field] = globalCsv.idle_treasure_base | |
72 | + dataMap[field] = globalCsv.idle_treasure_base + self.owner:getBnousTreasureBaseMaximum() | |
73 | 73 | elseif field == "treasureList" then |
74 | 74 | dataMap[field] = self:getTreasrueList() |
75 | 75 | elseif field == "pvpBought" then | ... | ... |
src/models/Role.lua
... | ... | @@ -76,7 +76,6 @@ Role.schema = { |
76 | 76 | expireItem = {"table", {}}, --物品过期检查 |
77 | 77 | funcOpen = {"table", {}}, --功能是否开放 |
78 | 78 | funcLv = {"table", {}}, --功能等级 |
79 | - levelBnous = {"table", {}}, --等级奖励 | |
80 | 79 | -- loveStatus = {"string", ""}, --统计角色的最高 好感度等级 类型相关 -- type=loveL type=loveL |
81 | 80 | crown = {"number", 0}, -- 看伴娘 |
82 | 81 | silent = {"number", 0}, --禁言解禁时间 |
... | ... | @@ -355,7 +354,6 @@ function Role:data() |
355 | 354 | items = self:getProperty("items"):toNumMap(), |
356 | 355 | funcOpen = self:getProperty("funcOpen"), |
357 | 356 | funcLv = self:getProperty("funcLv"), |
358 | - levelBnous = self:getProperty("levelBnous"), | |
359 | 357 | -- loveStatus = self:getProperty("loveStatus"):toNumMap(), |
360 | 358 | timeReset = self:getProperty("timeReset"), |
361 | 359 | diamond = self:getAllDiamond(), | ... | ... |
src/models/RolePlugin.lua
... | ... | @@ -284,7 +284,6 @@ function RolePlugin.bind(Role) |
284 | 284 | newExp = newExp - csvdb["player_expCsv"][level].exp |
285 | 285 | level = level + 1 |
286 | 286 | self:checkTaskEnter("RoleLevelUp", {level = level}) |
287 | - self:getLevelBnous(level) | |
288 | 287 | else |
289 | 288 | newExp = csvdb["player_expCsv"][level].exp - 1 -- 没有下一级了 经验溢出太多 扣除 |
290 | 289 | end |
... | ... | @@ -2760,27 +2759,30 @@ function RolePlugin.bind(Role) |
2760 | 2759 | |
2761 | 2760 | function Role:getBnousCrusade(value) |
2762 | 2761 | local towerBnous = self:getTowerBnousActive() |
2763 | - local levelValue = self:getDeltaValue(self:getProperty("levelBnous")[SystemBnousType.CrusadeTask], value) | |
2762 | + local levelBnous = self:getLevelBnous() | |
2763 | + | |
2764 | 2764 | local towerValue = self:getDeltaValue(towerBnous[SystemBnousType.CrusadeTask], value) |
2765 | + local levelValue = self:getDeltaValue(levelBnous[SystemBnousType.CrusadeTask], value) | |
2765 | 2766 | return levelValue + towerValue |
2766 | 2767 | end |
2767 | 2768 | |
2768 | 2769 | function Role:getBnousDiner(type, value) |
2769 | 2770 | local towerBnous = self:getTowerBnousActive() |
2771 | + local levelBnous = self:getLevelBnous() | |
2770 | 2772 | type = type or 1 |
2771 | 2773 | local result, levelReault |
2772 | 2774 | if type == 1 then |
2773 | 2775 | result = towerBnous[SystemBnousType.DinerGet] |
2774 | - levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerGet] | |
2776 | + levelReault = levelBnous[SystemBnousType.DinerGet] | |
2775 | 2777 | elseif type == 2 then |
2776 | 2778 | result = towerBnous[SystemBnousType.DinerLimit] |
2777 | - levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerLimit] | |
2779 | + levelReault = levelBnous[SystemBnousType.DinerLimit] | |
2778 | 2780 | elseif type == 3 then |
2779 | 2781 | result = towerBnous[SystemBnousType.DinerSell] |
2780 | - levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerSell] | |
2782 | + levelReault = levelBnous[SystemBnousType.DinerSell] | |
2781 | 2783 | elseif type == 4 then |
2782 | 2784 | result = towerBnous[SystemBnousType.DinerPrice] |
2783 | - levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerPrice] | |
2785 | + levelReault = levelBnous[SystemBnousType.DinerPrice] | |
2784 | 2786 | end |
2785 | 2787 | return self:getDeltaValue(result, value) + self:getDeltaValue(levelReault, value) |
2786 | 2788 | end |
... | ... | @@ -2798,108 +2800,112 @@ function RolePlugin.bind(Role) |
2798 | 2800 | end |
2799 | 2801 | function Role:getBnousAdv() |
2800 | 2802 | local towerBnous = self:getTowerBnousActive() |
2801 | - local levelBnous = self:getProperty("levelBnous")[SystemBnousType.Adv] or {} | |
2802 | - appendBnous(towerBnous[SystemBnousType.Adv], levelBnous) | |
2803 | + local levelBnous = self:getLevelBnous() | |
2804 | + local adv = levelBnous[SystemBnousType.Adv] or {} | |
2805 | + appendBnous(towerBnous[SystemBnousType.Adv], adv) | |
2803 | 2806 | return towerBnous[SystemBnousType.Adv] or {} |
2804 | 2807 | end |
2805 | 2808 | |
2806 | 2809 | function Role:getBnousHangTime() |
2807 | 2810 | local towerBnous = self:getTowerBnousActive() |
2808 | - local levelBnous = self:getProperty("levelBnous") or {} | |
2809 | - local tmptime = 0 | |
2810 | - if next(levelBnous) then | |
2811 | - tmptime = levelBnous[SystemBnousType.HangTime] or 0 | |
2812 | - end | |
2811 | + local levelBnous = self:getLevelBnous() | |
2812 | + local tmptime = levelBnous[SystemBnousType.HangTime] or 0 | |
2813 | 2813 | return towerBnous[SystemBnousType.HangTime] or 0 + tmptime |
2814 | 2814 | end |
2815 | 2815 | |
2816 | 2816 | function Role:getBnousPvpTicket() |
2817 | 2817 | local towerBnous = self:getTowerBnousActive() |
2818 | - local levelBnous = self:getProperty("levelBnous")[SystemBnousType.PvpTicket] or {} | |
2819 | - appendBnous(towerBnous[SystemBnousType.PvpTicket], levelBnous) | |
2818 | + local levelBnous = self:getLevelBnous() | |
2819 | + local pvpTicket = levelBnous[SystemBnousType.PvpTicket] or {} | |
2820 | + appendBnous(towerBnous[SystemBnousType.PvpTicket], pvpTicket) | |
2820 | 2821 | return towerBnous[SystemBnousType.PvpTicket] or {} |
2821 | 2822 | end |
2822 | 2823 | |
2823 | 2824 | function Role:getBnousSweep() |
2824 | 2825 | local towerBnous = self:getTowerBnousActive() |
2825 | - local levelBnous = self:getProperty("levelBnous")[SystemBnousType.SweepReward] or {} | |
2826 | - appendBnous(towerBnous[SystemBnousType.SweepReward], levelBnous) | |
2826 | + local levelBnous = self:getLevelBnous() | |
2827 | + local sweepReward = levelBnous[SystemBnousType.SweepReward] or {} | |
2828 | + appendBnous(towerBnous[SystemBnousType.SweepReward], sweepReward) | |
2827 | 2829 | return towerBnous[SystemBnousType.SweepReward] or {} |
2828 | 2830 | end |
2829 | 2831 | |
2830 | 2832 | function Role:getBnousDismantlingMaximum() |
2831 | - return self:getProperty("levelBnous")[SystemBnousType.DismantlingMaximum] or 0 | |
2833 | + local levelBnous = self:getLevelBnous() | |
2834 | + return levelBnous[SystemBnousType.DismantlingMaximum] or 0 | |
2832 | 2835 | end |
2833 | 2836 | |
2834 | 2837 | function Role:getBnousDismantlingImproved(value) |
2835 | - local result = self:getProperty("levelBnous")[SystemBnousType.DismantlingImproved] or {} | |
2838 | + local levelBnous = self:getLevelBnous() | |
2839 | + local result = levelBnous[SystemBnousType.DismantlingImproved] or {} | |
2836 | 2840 | return self:getDeltaValue(result, value) |
2837 | 2841 | end |
2838 | 2842 | |
2839 | 2843 | function Role:getBnousDaily() |
2844 | + local levelBnous = self:getLevelBnous() | |
2845 | + local dailyReward = levelBnous[SystemBnousType.DailyReward] or {} | |
2840 | 2846 | local reward = {} |
2841 | - local levelBnous = self:getProperty("levelBnous")[SystemBnousType.DailyReward] or {} | |
2842 | - for k, v in pairs(levelBnous) do | |
2847 | + for k, v in pairs(dailyReward) do | |
2843 | 2848 | reward[k] = (reward[k] or 0) + v |
2844 | 2849 | end |
2845 | 2850 | return reward |
2846 | 2851 | end |
2847 | 2852 | |
2848 | 2853 | function Role:getBnousTreasureBaseMaximum() |
2849 | - local levelBnous = self:getProperty("levelBnous")[SystemBnousType.TreasureBaseMaximum] or 0 | |
2850 | - local treasureBase = self.dailyData:getProperty("treasureBase") + levelBnous | |
2851 | - self.dailyData:updateProperty({field = "treasureBase", value = treasureBase}) | |
2854 | + local levelBnous = self:getLevelBnous() | |
2855 | + return levelBnous[SystemBnousType.TreasureBaseMaximum] or 0 | |
2852 | 2856 | end |
2853 | 2857 | |
2854 | 2858 | --@upType 加速类型 1探索加速, 2齿轮加速, 3餐厅加速 |
2855 | 2859 | function Role:getBnousUpSpeedNum(upType) |
2856 | - local levelBnous = self:getProperty("levelBnous")[SystemBnousType.UpSpeedNum] or {} | |
2857 | - if next(levelBnous) then | |
2858 | - return levelBnous[upType] or 0 | |
2859 | - end | |
2860 | - return 0 | |
2860 | + local levelBnous = self:getLevelBnous() | |
2861 | + local upSpeedNum = levelBnous[SystemBnousType.UpSpeedNum] or {} | |
2862 | + return upSpeedNum[upType] or 0 | |
2861 | 2863 | end |
2862 | 2864 | |
2863 | 2865 | function Role:getBnousChangeBaseCount() |
2864 | - return self:getProperty("levelBnous")[SystemBnousType.ChangeBaseCount] or 0 | |
2866 | + local levelBnous = self:getLevelBnous() | |
2867 | + return levelBnous[SystemBnousType.ChangeBaseCount] or 0 | |
2865 | 2868 | end |
2866 | 2869 | |
2867 | 2870 | function Role:getBnousChangeBuyCount() |
2868 | - return self:getProperty("levelBnous")[SystemBnousType.ChangeBuyCount] or 0 | |
2869 | - end | |
2870 | - | |
2871 | - function Role:getLevelBnous(level) | |
2872 | - local levelBnous = self:getProperty("levelBnous") | |
2873 | - local additionData = csvdb["level_additionCsv"][level] | |
2874 | - if additionData then | |
2875 | - local effects = additionData.effect:toTableArraySec() | |
2876 | - for _, effect in pairs(effects) do | |
2877 | - local pm1, pm2, pm3, pm4 = tonumber(effect[1]), tonumber(effect[2]), tonumber(effect[3]), tonumber(effect[4]) | |
2878 | - if not levelBnous[pm1] then | |
2879 | - levelBnous[pm1] = {} | |
2880 | - end | |
2881 | - if pm1 == SystemBnousType.TowerBuff then | |
2882 | - | |
2883 | - elseif pm1 == SystemBnousType.Adv then | |
2884 | - if not levelBnous[pm1][pm4] then | |
2885 | - levelBnous[pm1][pm4] = {} | |
2871 | + local levelBnous = self:getLevelBnous() | |
2872 | + return levelBnous[SystemBnousType.ChangeBuyCount] or 0 | |
2873 | + end | |
2874 | + | |
2875 | + function Role:getLevelBnous() | |
2876 | + local levelBnous = {} | |
2877 | + local curLevel = self:getProperty("level") | |
2878 | + for level, additionData in pairs(csvdb["level_additionCsv"]) do | |
2879 | + if level > curLevel then return levelBnous end | |
2880 | + if additionData then | |
2881 | + local effects = additionData.effect:toTableArraySec() | |
2882 | + for _, effect in pairs(effects) do | |
2883 | + local pm1, pm2, pm3, pm4 = tonumber(effect[1]), tonumber(effect[2]), tonumber(effect[3]), tonumber(effect[4]) | |
2884 | + if not levelBnous[pm1] then | |
2885 | + levelBnous[pm1] = {} | |
2886 | 2886 | end |
2887 | - levelBnous[pm1][pm4][pm2] = (levelBnous[pm1][pm4][pm2] or 0) + pm3 | |
2888 | - elseif pm1 == SystemBnousType.HangTime or | |
2889 | - pm1 == SystemBnousType.DismantlingMaximum or | |
2890 | - pm1 == SystemBnousType.TreasureBaseMaximum or | |
2891 | - pm1 == SystemBnousType.ChangeBaseCount or | |
2892 | - pm1 == SystemBnousType.ChangeBuyCount then | |
2893 | - if type(levelBnous[pm1]) == "table" then | |
2894 | - levelBnous[pm1] = 0 | |
2887 | + if pm1 == SystemBnousType.TowerBuff then | |
2888 | + | |
2889 | + elseif pm1 == SystemBnousType.Adv then | |
2890 | + if not levelBnous[pm1][pm4] then | |
2891 | + levelBnous[pm1][pm4] = {} | |
2892 | + end | |
2893 | + levelBnous[pm1][pm4][pm2] = (levelBnous[pm1][pm4][pm2] or 0) + pm3 | |
2894 | + elseif pm1 == SystemBnousType.HangTime or | |
2895 | + pm1 == SystemBnousType.DismantlingMaximum or | |
2896 | + pm1 == SystemBnousType.TreasureBaseMaximum or | |
2897 | + pm1 == SystemBnousType.ChangeBaseCount or | |
2898 | + pm1 == SystemBnousType.ChangeBuyCount then | |
2899 | + if type(levelBnous[pm1]) == "table" then | |
2900 | + levelBnous[pm1] = 0 | |
2901 | + end | |
2902 | + levelBnous[pm1] = levelBnous[pm1] + pm2 | |
2903 | + else | |
2904 | + levelBnous[pm1][pm2] = (levelBnous[pm1][pm2] or 0) + pm3 | |
2895 | 2905 | end |
2896 | - levelBnous[pm1] = levelBnous[pm1] + pm2 | |
2897 | - else | |
2898 | - levelBnous[pm1][pm2] = (levelBnous[pm1][pm2] or 0) + pm3 | |
2899 | 2906 | end |
2900 | 2907 | end |
2901 | 2908 | end |
2902 | - self:updateProperty({field = "levelBnous", value= levelBnous}) | |
2903 | 2909 | return levelBnous |
2904 | 2910 | end |
2905 | 2911 | ... | ... |