Commit cea66efddb9cc00a0c838ae73e90f64b9cd173e9

Authored by zhangqijia
1 parent 2660491b

fix: 等级效果的bug,

把等级效果字段levelBnous数据从增量获取改为全量获取
src/models/Daily.lua
@@ -69,7 +69,7 @@ function Daily:refreshDailyData(notify) @@ -69,7 +69,7 @@ function Daily:refreshDailyData(notify)
69 elseif field == "id" then 69 elseif field == "id" then
70 -- skip 70 -- skip
71 elseif field == "treasureBase" then 71 elseif field == "treasureBase" then
72 - dataMap[field] = globalCsv.idle_treasure_base 72 + dataMap[field] = globalCsv.idle_treasure_base + self.owner:getBnousTreasureBaseMaximum()
73 elseif field == "treasureList" then 73 elseif field == "treasureList" then
74 dataMap[field] = self:getTreasrueList() 74 dataMap[field] = self:getTreasrueList()
75 elseif field == "pvpBought" then 75 elseif field == "pvpBought" then
src/models/Role.lua
@@ -76,7 +76,6 @@ Role.schema = { @@ -76,7 +76,6 @@ Role.schema = {
76 expireItem = {"table", {}}, --物品过期检查 76 expireItem = {"table", {}}, --物品过期检查
77 funcOpen = {"table", {}}, --功能是否开放 77 funcOpen = {"table", {}}, --功能是否开放
78 funcLv = {"table", {}}, --功能等级 78 funcLv = {"table", {}}, --功能等级
79 - levelBnous = {"table", {}}, --等级奖励  
80 -- loveStatus = {"string", ""}, --统计角色的最高 好感度等级 类型相关 -- type=loveL type=loveL 79 -- loveStatus = {"string", ""}, --统计角色的最高 好感度等级 类型相关 -- type=loveL type=loveL
81 crown = {"number", 0}, -- 看伴娘 80 crown = {"number", 0}, -- 看伴娘
82 silent = {"number", 0}, --禁言解禁时间 81 silent = {"number", 0}, --禁言解禁时间
@@ -355,7 +354,6 @@ function Role:data() @@ -355,7 +354,6 @@ function Role:data()
355 items = self:getProperty("items"):toNumMap(), 354 items = self:getProperty("items"):toNumMap(),
356 funcOpen = self:getProperty("funcOpen"), 355 funcOpen = self:getProperty("funcOpen"),
357 funcLv = self:getProperty("funcLv"), 356 funcLv = self:getProperty("funcLv"),
358 - levelBnous = self:getProperty("levelBnous"),  
359 -- loveStatus = self:getProperty("loveStatus"):toNumMap(), 357 -- loveStatus = self:getProperty("loveStatus"):toNumMap(),
360 timeReset = self:getProperty("timeReset"), 358 timeReset = self:getProperty("timeReset"),
361 diamond = self:getAllDiamond(), 359 diamond = self:getAllDiamond(),
src/models/RolePlugin.lua
@@ -284,7 +284,6 @@ function RolePlugin.bind(Role) @@ -284,7 +284,6 @@ function RolePlugin.bind(Role)
284 newExp = newExp - csvdb["player_expCsv"][level].exp 284 newExp = newExp - csvdb["player_expCsv"][level].exp
285 level = level + 1 285 level = level + 1
286 self:checkTaskEnter("RoleLevelUp", {level = level}) 286 self:checkTaskEnter("RoleLevelUp", {level = level})
287 - self:getLevelBnous(level)  
288 else 287 else
289 newExp = csvdb["player_expCsv"][level].exp - 1 -- 没有下一级了 经验溢出太多 扣除 288 newExp = csvdb["player_expCsv"][level].exp - 1 -- 没有下一级了 经验溢出太多 扣除
290 end 289 end
@@ -2760,27 +2759,30 @@ function RolePlugin.bind(Role) @@ -2760,27 +2759,30 @@ function RolePlugin.bind(Role)
2760 2759
2761 function Role:getBnousCrusade(value) 2760 function Role:getBnousCrusade(value)
2762 local towerBnous = self:getTowerBnousActive() 2761 local towerBnous = self:getTowerBnousActive()
2763 - local levelValue = self:getDeltaValue(self:getProperty("levelBnous")[SystemBnousType.CrusadeTask], value) 2762 + local levelBnous = self:getLevelBnous()
  2763 +
2764 local towerValue = self:getDeltaValue(towerBnous[SystemBnousType.CrusadeTask], value) 2764 local towerValue = self:getDeltaValue(towerBnous[SystemBnousType.CrusadeTask], value)
  2765 + local levelValue = self:getDeltaValue(levelBnous[SystemBnousType.CrusadeTask], value)
2765 return levelValue + towerValue 2766 return levelValue + towerValue
2766 end 2767 end
2767 2768
2768 function Role:getBnousDiner(type, value) 2769 function Role:getBnousDiner(type, value)
2769 local towerBnous = self:getTowerBnousActive() 2770 local towerBnous = self:getTowerBnousActive()
  2771 + local levelBnous = self:getLevelBnous()
2770 type = type or 1 2772 type = type or 1
2771 local result, levelReault 2773 local result, levelReault
2772 if type == 1 then 2774 if type == 1 then
2773 result = towerBnous[SystemBnousType.DinerGet] 2775 result = towerBnous[SystemBnousType.DinerGet]
2774 - levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerGet] 2776 + levelReault = levelBnous[SystemBnousType.DinerGet]
2775 elseif type == 2 then 2777 elseif type == 2 then
2776 result = towerBnous[SystemBnousType.DinerLimit] 2778 result = towerBnous[SystemBnousType.DinerLimit]
2777 - levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerLimit] 2779 + levelReault = levelBnous[SystemBnousType.DinerLimit]
2778 elseif type == 3 then 2780 elseif type == 3 then
2779 result = towerBnous[SystemBnousType.DinerSell] 2781 result = towerBnous[SystemBnousType.DinerSell]
2780 - levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerSell] 2782 + levelReault = levelBnous[SystemBnousType.DinerSell]
2781 elseif type == 4 then 2783 elseif type == 4 then
2782 result = towerBnous[SystemBnousType.DinerPrice] 2784 result = towerBnous[SystemBnousType.DinerPrice]
2783 - levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerPrice] 2785 + levelReault = levelBnous[SystemBnousType.DinerPrice]
2784 end 2786 end
2785 return self:getDeltaValue(result, value) + self:getDeltaValue(levelReault, value) 2787 return self:getDeltaValue(result, value) + self:getDeltaValue(levelReault, value)
2786 end 2788 end
@@ -2798,108 +2800,112 @@ function RolePlugin.bind(Role) @@ -2798,108 +2800,112 @@ function RolePlugin.bind(Role)
2798 end 2800 end
2799 function Role:getBnousAdv() 2801 function Role:getBnousAdv()
2800 local towerBnous = self:getTowerBnousActive() 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 return towerBnous[SystemBnousType.Adv] or {} 2806 return towerBnous[SystemBnousType.Adv] or {}
2804 end 2807 end
2805 2808
2806 function Role:getBnousHangTime() 2809 function Role:getBnousHangTime()
2807 local towerBnous = self:getTowerBnousActive() 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 return towerBnous[SystemBnousType.HangTime] or 0 + tmptime 2813 return towerBnous[SystemBnousType.HangTime] or 0 + tmptime
2814 end 2814 end
2815 2815
2816 function Role:getBnousPvpTicket() 2816 function Role:getBnousPvpTicket()
2817 local towerBnous = self:getTowerBnousActive() 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 return towerBnous[SystemBnousType.PvpTicket] or {} 2821 return towerBnous[SystemBnousType.PvpTicket] or {}
2821 end 2822 end
2822 2823
2823 function Role:getBnousSweep() 2824 function Role:getBnousSweep()
2824 local towerBnous = self:getTowerBnousActive() 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 return towerBnous[SystemBnousType.SweepReward] or {} 2829 return towerBnous[SystemBnousType.SweepReward] or {}
2828 end 2830 end
2829 2831
2830 function Role:getBnousDismantlingMaximum() 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 end 2835 end
2833 2836
2834 function Role:getBnousDismantlingImproved(value) 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 return self:getDeltaValue(result, value) 2840 return self:getDeltaValue(result, value)
2837 end 2841 end
2838 2842
2839 function Role:getBnousDaily() 2843 function Role:getBnousDaily()
  2844 + local levelBnous = self:getLevelBnous()
  2845 + local dailyReward = levelBnous[SystemBnousType.DailyReward] or {}
2840 local reward = {} 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 reward[k] = (reward[k] or 0) + v 2848 reward[k] = (reward[k] or 0) + v
2844 end 2849 end
2845 return reward 2850 return reward
2846 end 2851 end
2847 2852
2848 function Role:getBnousTreasureBaseMaximum() 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 end 2856 end
2853 2857
2854 --@upType 加速类型 1探索加速, 2齿轮加速, 3餐厅加速 2858 --@upType 加速类型 1探索加速, 2齿轮加速, 3餐厅加速
2855 function Role:getBnousUpSpeedNum(upType) 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 end 2863 end
2862 2864
2863 function Role:getBnousChangeBaseCount() 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 end 2868 end
2866 2869
2867 function Role:getBnousChangeBuyCount() 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 end 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 end 2905 end
2896 - levelBnous[pm1] = levelBnous[pm1] + pm2  
2897 - else  
2898 - levelBnous[pm1][pm2] = (levelBnous[pm1][pm2] or 0) + pm3  
2899 end 2906 end
2900 end 2907 end
2901 end 2908 end
2902 - self:updateProperty({field = "levelBnous", value= levelBnous})  
2903 return levelBnous 2909 return levelBnous
2904 end 2910 end
2905 2911