Commit a3e27e79379a58d1f10a12fbd99c6efd5a61752a

Authored by 熊润斐
2 parents f84286c1 7fe1158c

Merge branch 'cn/develop' into cn/publish/release

@@ -424,3 +424,14 @@ SystemBnousType = { @@ -424,3 +424,14 @@ SystemBnousType = {
424 ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加 424 ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加
425 ChangeBuyCount = 17, -- 每日奖励关卡挑战卡可购买次数增加, 425 ChangeBuyCount = 17, -- 每日奖励关卡挑战卡可购买次数增加,
426 } 426 }
  427 +
  428 +-- 开箱物品类型
  429 +ItemOccupy = {
  430 + EquipBase = 1, --装备
  431 + Rune = 2, --铭文
  432 + Diner = 3, --食材
  433 + CommonPaster = 4, --贴纸
  434 + Spark = 5, --火花
  435 + Other = 6,
  436 + CanUsed = 7, --可使用
  437 +}
427 \ No newline at end of file 438 \ No newline at end of file
src/actions/GmAction.lua
@@ -1029,9 +1029,9 @@ end @@ -1029,9 +1029,9 @@ end
1029 1029
1030 table.insert(helpDes, {"清讨伐电台", "clear_radio", "id"}) 1030 table.insert(helpDes, {"清讨伐电台", "clear_radio", "id"})
1031 function _M.clear_radio(role, pms) 1031 function _M.clear_radio(role, pms)
1032 - local id = pms.pm1 1032 + local id = tonumber(pms.pm1)
1033 local radioTask = role:getProperty("radioTask") 1033 local radioTask = role:getProperty("radioTask")
1034 - if id == 0 then 1034 + if id ~= 0 then
1035 radioTask[id] = nil 1035 radioTask[id] = nil
1036 else 1036 else
1037 radioTask = {} 1037 radioTask = {}
@@ -1044,9 +1044,9 @@ end @@ -1044,9 +1044,9 @@ end
1044 1044
1045 table.insert(helpDes, {"清代理拾荒", "clear_adv_hang", "id"}) 1045 table.insert(helpDes, {"清代理拾荒", "clear_adv_hang", "id"})
1046 function _M.clear_adv_hang(role, pms) 1046 function _M.clear_adv_hang(role, pms)
1047 - local id = pms.pm1 1047 + local id = tonumber(pms.pm1)
1048 local task = role:getProperty("advHang") 1048 local task = role:getProperty("advHang")
1049 - if id == 0 then 1049 + if id ~= 0 then
1050 task[id] = nil 1050 task[id] = nil
1051 else 1051 else
1052 task = {} 1052 task = {}
@@ -1058,10 +1058,10 @@ function _M.clear_adv_hang(role, pms) @@ -1058,10 +1058,10 @@ function _M.clear_adv_hang(role, pms)
1058 end 1058 end
1059 1059
1060 table.insert(helpDes, {"清海港贸易", "clear_sea", "id"}) 1060 table.insert(helpDes, {"清海港贸易", "clear_sea", "id"})
1061 -function _M.clear_radio(role, pms)  
1062 - local id = pms.pm1 1061 +function _M.clear_sea(role, pms)
  1062 + local id = tonumber(pms.pm1)
1063 local task = role:getProperty("seaport") 1063 local task = role:getProperty("seaport")
1064 - if id == 0 then 1064 + if id ~= 0 then
1065 task.collect[id] = nil 1065 task.collect[id] = nil
1066 else 1066 else
1067 task.collect = {} 1067 task.collect = {}
src/actions/RoleAction.lua
@@ -686,13 +686,17 @@ function _M.openTimeBoxRpc(agent, data) @@ -686,13 +686,17 @@ function _M.openTimeBoxRpc(agent, data)
686 local count, runeCount = 0, 0 686 local count, runeCount = 0, 0
687 for itemId, num in pairs(costs) do 687 for itemId, num in pairs(costs) do
688 local itemIdData = csvdb["itemCsv"][itemId] 688 local itemIdData = csvdb["itemCsv"][itemId]
689 - if not itemIdData or not csvdb["item_randomCsv"][itemId] or costIdData.quality ~= itemIdData.quality then return 7 end 689 + local itemRandomData = csvdb["item_randomCsv"][itemId]
  690 + if not itemIdData or not itemRandomData or costIdData.quality ~= itemIdData.quality then return 7 end
690 691
691 - if itemIdData.type == ItemType.Rune then runeCount = runeCount + num end 692 + local itemRandomOccupy = role:getItemRandomOccupy(itemRandomData)
  693 + if next(itemRandomOccupy) then
  694 + runeCount = runeCount + (itemRandomOccupy[ItemOccupy.Rune] or 0) * num
  695 + end
692 count = count + num 696 count = count + num
693 end 697 end
694 698
695 - if role:checkRuneFully(runeCount) then return 10 end --开箱子,如果铭文仓库已经满了则不让开 699 + if role:checkRuneFully(runeCount) then return 10 end --开箱子,如果铭文仓库已经满了则不让开铭文
696 700
697 if role:getItemCount(costId) < count then return 8 end 701 if role:getItemCount(costId) < count then return 8 end
698 if not role:checkItemEnough(costs) then return 9 end 702 if not role:checkItemEnough(costs) then return 9 end
@@ -886,25 +890,14 @@ function _M.unLockStoryBookRpc(agent, data) @@ -886,25 +890,14 @@ function _M.unLockStoryBookRpc(agent, data)
886 return true 890 return true
887 end 891 end
888 892
889 -function _M.taskRpc(agent, data)  
890 - local role = agent.role  
891 - local msg = MsgPack.unpack(data)  
892 -  
893 - if not role:isFuncUnlock(FuncUnlock.TaskAchiv) then return end  
894 -  
895 - local taskType = msg.type -- 1 日常 2 周常  
896 - local taskId = msg.id --任务id  
897 - local roleField = {"dTask", "wTask"}  
898 - if not roleField[taskType] then return 1 end  
899 -  
900 - local taskData = csvdb["task_loopCsv"][taskType][taskId]  
901 - if not taskData then return 2 end 893 +local function getTaskReward(role, taskId, roleField, taskType, taskData)
  894 + if not taskData then return nil end
902 895
903 local taskStatus = role:getProperty(roleField[taskType]) 896 local taskStatus = role:getProperty(roleField[taskType])
904 local tStatus = taskStatus["t"] or {} 897 local tStatus = taskStatus["t"] or {}
905 898
906 if (tStatus[taskId] or 0) < taskData.condition1 then 899 if (tStatus[taskId] or 0) < taskData.condition1 then
907 - return 3 900 + return nil
908 end 901 end
909 902
910 local reward, change = role:award(taskData.reward, {log = {desc = "finishTask", int1 = taskType, int2 = taskId}}) 903 local reward, change = role:award(taskData.reward, {log = {desc = "finishTask", int1 = taskType, int2 = taskId}})
@@ -932,30 +925,49 @@ function _M.taskRpc(agent, data) @@ -932,30 +925,49 @@ function _M.taskRpc(agent, data)
932 task_reward_type = taskType, --任务奖励类型,见 任务奖励类型枚举表 925 task_reward_type = taskType, --任务奖励类型,见 任务奖励类型枚举表
933 task_reward_detail = reward, --任务奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} 926 task_reward_detail = reward, --任务奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
934 }) 927 })
935 -  
936 - SendPacket(actionCodes.Role_taskRpc, MsgPack.pack(role:packReward(reward, change)))  
937 - return true 928 + return reward, change
938 end 929 end
939 930
940 -function _M.taskActiveRpc(agent, data) 931 +function _M.taskRpc(agent, data)
941 local role = agent.role 932 local role = agent.role
942 local msg = MsgPack.unpack(data) 933 local msg = MsgPack.unpack(data)
943 934
944 if not role:isFuncUnlock(FuncUnlock.TaskAchiv) then return end 935 if not role:isFuncUnlock(FuncUnlock.TaskAchiv) then return end
945 936
946 - local taskType = msg.type -- 1 日常 2 周 937 + local taskType = msg.type -- 1 日常 2 周
947 local taskId = msg.id --任务id 938 local taskId = msg.id --任务id
948 local roleField = {"dTask", "wTask"} 939 local roleField = {"dTask", "wTask"}
949 - if not roleField[taskType] then return end 940 + if not roleField[taskType] then return 1 end
  941 +
  942 + local reward, change = {}, {}
  943 + if not taskId then
  944 +
  945 + for id, taskData in pairs(csvdb["task_loopCsv"][taskType]) do
  946 + local tmpreward, tmpchange = getTaskReward(role, id, roleField, taskType, taskData)
  947 + if tmpreward then
  948 + for k, v in pairs(tmpreward) do
  949 + reward[k] = (reward[k] or 0) + v
  950 + end
  951 + if tmpchange then table.insert(change, tmpchange) end
  952 + end
  953 + end
  954 + else
  955 + local taskData = csvdb["task_loopCsv"][taskType][taskId]
  956 + if not taskData then return 2 end
  957 + reward, change= getTaskReward(role, taskId, roleField, taskType, taskData)
  958 + end
  959 +
  960 + SendPacket(actionCodes.Role_taskRpc, MsgPack.pack(role:packReward(reward, change)))
  961 + return true
  962 +end
950 963
951 - local taskData = csvdb["task_activeCsv"][taskType][taskId]  
952 - if not taskData then return end  
953 964
  965 +local function getTaskActiveReward(role, taskId, roleField, taskType, taskData)
954 local taskStatus = role:getProperty(roleField[taskType]) 966 local taskStatus = role:getProperty(roleField[taskType])
955 local tStatus = taskStatus["at"] or {} 967 local tStatus = taskStatus["at"] or {}
956 968
957 if tStatus[taskId] == -1 or (taskStatus["a"] or 0) < taskData.active then 969 if tStatus[taskId] == -1 or (taskStatus["a"] or 0) < taskData.active then
958 - return 970 + return nil
959 end 971 end
960 972
961 local needReward = taskData.reward:toNumMap() 973 local needReward = taskData.reward:toNumMap()
@@ -970,12 +982,42 @@ function _M.taskActiveRpc(agent, data) @@ -970,12 +982,42 @@ function _M.taskActiveRpc(agent, data)
970 role:changeUpdates({ 982 role:changeUpdates({
971 { type = roleField[taskType], field = {"at", taskId}, value = -1 } 983 { type = roleField[taskType], field = {"at", taskId}, value = -1 }
972 }) 984 })
973 - 985 +
974 role:log("task_reward", { 986 role:log("task_reward", {
975 task_reward_id = taskId * 100 + taskType, --任务奖励ID 987 task_reward_id = taskId * 100 + taskType, --任务奖励ID
976 task_reward_type = 3, --任务奖励类型,见 任务奖励类型枚举表 988 task_reward_type = 3, --任务奖励类型,见 任务奖励类型枚举表
977 task_reward_detail = reward, --任务奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} 989 task_reward_detail = reward, --任务奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
978 }) 990 })
  991 + return reward, change
  992 +end
  993 +
  994 +function _M.taskActiveRpc(agent, data)
  995 + local role = agent.role
  996 + local msg = MsgPack.unpack(data)
  997 +
  998 + if not role:isFuncUnlock(FuncUnlock.TaskAchiv) then return end
  999 +
  1000 + local taskType = msg.type -- 1 日常 2 周长
  1001 + local taskId = msg.id --任务id
  1002 + local roleField = {"dTask", "wTask"}
  1003 + if not roleField[taskType] then return end
  1004 +
  1005 + local reward, change = {}, {}
  1006 + if not taskId then
  1007 + for id, taskData in pairs(csvdb["task_activeCsv"][taskType]) do
  1008 + local tmpreward, tmpchange = getTaskActiveReward(role, id, roleField, taskType, taskData)
  1009 + if tmpreward then
  1010 + for k, v in pairs(tmpreward) do
  1011 + reward[k] = (reward[k] or 0) + v
  1012 + end
  1013 + if tmpchange then table.insert(change, tmpchange) end
  1014 + end
  1015 + end
  1016 + else
  1017 + local taskData = csvdb["task_activeCsv"][taskType][taskId]
  1018 + if not taskData then return end
  1019 + reward, change= getTaskActiveReward(role, taskId, roleField, taskType, taskData)
  1020 + end
979 1021
980 SendPacket(actionCodes.Role_taskActiveRpc, MsgPack.pack(role:packReward(reward, change))) 1022 SendPacket(actionCodes.Role_taskActiveRpc, MsgPack.pack(role:packReward(reward, change)))
981 return true 1023 return true
@@ -1405,7 +1447,7 @@ function _M.goldBuyRpc(agent, data) @@ -1405,7 +1447,7 @@ function _M.goldBuyRpc(agent, data)
1405 local maxCount = maxIdx + role:getBnousUpSpeedNum(UpSpeedType.GearUpSpeed) 1447 local maxCount = maxIdx + role:getBnousUpSpeedNum(UpSpeedType.GearUpSpeed)
1406 if curT > maxCount then return end 1448 if curT > maxCount then return end
1407 if curT > maxIdx then 1449 if curT > maxIdx then
1408 - for idx = maxIdx+1, curCount do 1450 + for idx = maxIdx+1, curT do
1409 costs[idx] = costs[maxIdx] 1451 costs[idx] = costs[maxIdx]
1410 end 1452 end
1411 end 1453 end
1 -Subproject commit 7e360667871839f748175e801bbb1ff39ba802ac 1 +Subproject commit 8f6460b1bc144989ece2f2caaf5c225ae434ac38
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,146 +2759,161 @@ function RolePlugin.bind(Role) @@ -2760,146 +2759,161 @@ 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
2787 2789
2788 - local function appendBnous(dstBnous, srcBnous)  
2789 - if not dstBnous or not srcBnous then return end 2790 + local function appendAdvBnous(dstBnous, srcBnous)
  2791 + if not dstBnous and not srcBnous then return {} end
  2792 + local result = clone(dstBnous or {})
2790 for time, set in pairs(srcBnous) do 2793 for time, set in pairs(srcBnous) do
2791 - if not dstBnous[time] then  
2792 - dstBnous[time] = {} 2794 + if not result[time] then
  2795 + result[time] = {}
2793 end 2796 end
2794 for key, value in pairs(set) do 2797 for key, value in pairs(set) do
2795 - dstBnous[time][key] = (dstBnous[time][key] or 0) + value 2798 + result[time][key] = (result[time][key] or 0) + value
2796 end 2799 end
2797 end 2800 end
  2801 + return result
  2802 + end
  2803 +
  2804 + local function appendTableBnous(dstBnous, srcBnous)
  2805 + if not dstBnous and not srcBnous then return {} end
  2806 + local result = clone(dstBnous or {})
  2807 + for k, v in pairs(srcBnous) do
  2808 + result[k] = (result[k] or 0) + v
  2809 + end
  2810 + return result
2798 end 2811 end
2799 function Role:getBnousAdv() 2812 function Role:getBnousAdv()
2800 local towerBnous = self:getTowerBnousActive() 2813 local towerBnous = self:getTowerBnousActive()
2801 - local levelBnous = self:getProperty("levelBnous")[SystemBnousType.Adv] or {}  
2802 - appendBnous(towerBnous[SystemBnousType.Adv], levelBnous)  
2803 - return towerBnous[SystemBnousType.Adv] or {} 2814 + local levelBnous = self:getLevelBnous()
  2815 + local adv = levelBnous[SystemBnousType.Adv] or {}
  2816 + return appendAdvBnous(towerBnous[SystemBnousType.Adv], adv)
2804 end 2817 end
2805 2818
2806 function Role:getBnousHangTime() 2819 function Role:getBnousHangTime()
2807 local towerBnous = self:getTowerBnousActive() 2820 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 2821 + local levelBnous = self:getLevelBnous()
  2822 + local tmptime = levelBnous[SystemBnousType.HangTime] or 0
2813 return towerBnous[SystemBnousType.HangTime] or 0 + tmptime 2823 return towerBnous[SystemBnousType.HangTime] or 0 + tmptime
2814 end 2824 end
2815 2825
2816 function Role:getBnousPvpTicket() 2826 function Role:getBnousPvpTicket()
2817 local towerBnous = self:getTowerBnousActive() 2827 local towerBnous = self:getTowerBnousActive()
2818 - local levelBnous = self:getProperty("levelBnous")[SystemBnousType.PvpTicket] or {}  
2819 - appendBnous(towerBnous[SystemBnousType.PvpTicket], levelBnous)  
2820 - return towerBnous[SystemBnousType.PvpTicket] or {} 2828 + local levelBnous = self:getLevelBnous()
  2829 + local pvpTicket = levelBnous[SystemBnousType.PvpTicket] or {}
  2830 + return appendTableBnous(towerBnous[SystemBnousType.PvpTicket], pvpTicket)
2821 end 2831 end
2822 2832
2823 function Role:getBnousSweep() 2833 function Role:getBnousSweep()
2824 local towerBnous = self:getTowerBnousActive() 2834 local towerBnous = self:getTowerBnousActive()
2825 - local levelBnous = self:getProperty("levelBnous")[SystemBnousType.SweepReward] or {}  
2826 - appendBnous(towerBnous[SystemBnousType.SweepReward], levelBnous)  
2827 - return towerBnous[SystemBnousType.SweepReward] or {} 2835 + local levelBnous = self:getLevelBnous()
  2836 + local sweepReward = levelBnous[SystemBnousType.SweepReward] or {}
  2837 + return appendTableBnous(towerBnous[SystemBnousType.SweepReward], sweepReward)
2828 end 2838 end
2829 2839
2830 function Role:getBnousDismantlingMaximum() 2840 function Role:getBnousDismantlingMaximum()
2831 - return self:getProperty("levelBnous")[SystemBnousType.DismantlingMaximum] or 0 2841 + local levelBnous = self:getLevelBnous()
  2842 + return levelBnous[SystemBnousType.DismantlingMaximum] or 0
2832 end 2843 end
2833 2844
2834 function Role:getBnousDismantlingImproved(value) 2845 function Role:getBnousDismantlingImproved(value)
2835 - local result = self:getProperty("levelBnous")[SystemBnousType.DismantlingImproved] or {} 2846 + local levelBnous = self:getLevelBnous()
  2847 + local result = levelBnous[SystemBnousType.DismantlingImproved] or {}
2836 return self:getDeltaValue(result, value) 2848 return self:getDeltaValue(result, value)
2837 end 2849 end
2838 2850
2839 function Role:getBnousDaily() 2851 function Role:getBnousDaily()
  2852 + local levelBnous = self:getLevelBnous()
  2853 + local dailyReward = levelBnous[SystemBnousType.DailyReward] or {}
2840 local reward = {} 2854 local reward = {}
2841 - local levelBnous = self:getProperty("levelBnous")[SystemBnousType.DailyReward] or {}  
2842 - for k, v in pairs(levelBnous) do 2855 + for k, v in pairs(dailyReward) do
2843 reward[k] = (reward[k] or 0) + v 2856 reward[k] = (reward[k] or 0) + v
2844 end 2857 end
2845 return reward 2858 return reward
2846 end 2859 end
2847 2860
2848 function Role:getBnousTreasureBaseMaximum() 2861 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}) 2862 + local levelBnous = self:getLevelBnous()
  2863 + return levelBnous[SystemBnousType.TreasureBaseMaximum] or 0
2852 end 2864 end
2853 2865
2854 --@upType 加速类型 1探索加速, 2齿轮加速, 3餐厅加速 2866 --@upType 加速类型 1探索加速, 2齿轮加速, 3餐厅加速
2855 function Role:getBnousUpSpeedNum(upType) 2867 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 2868 + local levelBnous = self:getLevelBnous()
  2869 + local upSpeedNum = levelBnous[SystemBnousType.UpSpeedNum] or {}
  2870 + return upSpeedNum[upType] or 0
2861 end 2871 end
2862 2872
2863 function Role:getBnousChangeBaseCount() 2873 function Role:getBnousChangeBaseCount()
2864 - return self:getProperty("levelBnous")[SystemBnousType.ChangeBaseCount] or 0 2874 + local levelBnous = self:getLevelBnous()
  2875 + return levelBnous[SystemBnousType.ChangeBaseCount] or 0
2865 end 2876 end
2866 2877
2867 function Role:getBnousChangeBuyCount() 2878 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] = {} 2879 + local levelBnous = self:getLevelBnous()
  2880 + return levelBnous[SystemBnousType.ChangeBuyCount] or 0
  2881 + end
  2882 +
  2883 + function Role:getLevelBnous()
  2884 + local levelBnous = {}
  2885 + local curLevel = self:getProperty("level")
  2886 + for level, additionData in pairs(csvdb["level_additionCsv"]) do
  2887 + if level > curLevel then return levelBnous end
  2888 + if additionData then
  2889 + local effects = additionData.effect:toTableArraySec()
  2890 + for _, effect in pairs(effects) do
  2891 + local pm1, pm2, pm3, pm4 = tonumber(effect[1]), tonumber(effect[2]), tonumber(effect[3]), tonumber(effect[4])
  2892 + if not levelBnous[pm1] then
  2893 + levelBnous[pm1] = {}
2886 end 2894 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 2895 + if pm1 == SystemBnousType.TowerBuff then
  2896 +
  2897 + elseif pm1 == SystemBnousType.Adv then
  2898 + if not levelBnous[pm1][pm4] then
  2899 + levelBnous[pm1][pm4] = {}
  2900 + end
  2901 + levelBnous[pm1][pm4][pm2] = (levelBnous[pm1][pm4][pm2] or 0) + pm3
  2902 + elseif pm1 == SystemBnousType.HangTime or
  2903 + pm1 == SystemBnousType.DismantlingMaximum or
  2904 + pm1 == SystemBnousType.TreasureBaseMaximum or
  2905 + pm1 == SystemBnousType.ChangeBaseCount or
  2906 + pm1 == SystemBnousType.ChangeBuyCount then
  2907 + if type(levelBnous[pm1]) == "table" then
  2908 + levelBnous[pm1] = 0
  2909 + end
  2910 + levelBnous[pm1] = levelBnous[pm1] + pm2
  2911 + else
  2912 + levelBnous[pm1][pm2] = (levelBnous[pm1][pm2] or 0) + pm3
2895 end 2913 end
2896 - levelBnous[pm1] = levelBnous[pm1] + pm2  
2897 - else  
2898 - levelBnous[pm1][pm2] = (levelBnous[pm1][pm2] or 0) + pm3  
2899 end 2914 end
2900 end 2915 end
2901 end 2916 end
2902 - self:updateProperty({field = "levelBnous", value= levelBnous})  
2903 return levelBnous 2917 return levelBnous
2904 end 2918 end
2905 2919
@@ -2934,11 +2948,13 @@ function RolePlugin.bind(Role) @@ -2934,11 +2948,13 @@ function RolePlugin.bind(Role)
2934 self:mylog("hero_action", {desc = desc, int1 = heroType}) 2948 self:mylog("hero_action", {desc = desc, int1 = heroType})
2935 end 2949 end
2936 2950
2937 - function Role:getRuneBatCount() 2951 + function Role:getRuneBagCount()
2938 local count = 0 2952 local count = 0
2939 for _, rune in pairs(self.runeBag) do 2953 for _, rune in pairs(self.runeBag) do
2940 if next(rune) then 2954 if next(rune) then
2941 - count = count + 1 2955 + if rune:getProperty("refer") == 0 then
  2956 + count = count + 1
  2957 + end
2942 end 2958 end
2943 end 2959 end
2944 return count or 0 2960 return count or 0
@@ -2947,13 +2963,28 @@ function RolePlugin.bind(Role) @@ -2947,13 +2963,28 @@ function RolePlugin.bind(Role)
2947 -- 铭文仓库是否满仓 2963 -- 铭文仓库是否满仓
2948 function Role:checkRuneFully(count) 2964 function Role:checkRuneFully(count)
2949 count = count or 0 2965 count = count or 0
  2966 + if count == 0 then return false end
  2967 +
2950 local page = globalCsv.store_type[ItemType.Rune] 2968 local page = globalCsv.store_type[ItemType.Rune]
2951 local limit = self:getProperty("bagLimit")[page] 2969 local limit = self:getProperty("bagLimit")[page]
2952 - return self:getRuneBatCount() + count > limit 2970 + return self:getRuneBagCount() + count > limit
  2971 + end
  2972 +
  2973 + local function checkHasRuneByReward(reward)
  2974 + reward = reward or {}
  2975 + for itemId, _ in pairs(reward) do
  2976 + local itemData = csvdb["itemCsv"][itemId]
  2977 + if itemData and itemData.type == ItemType.Rune then
  2978 + return true
  2979 + end
  2980 + end
  2981 + return false
2953 end 2982 end
2954 2983
2955 function Role:checkRuneFullyByReward(reward) 2984 function Role:checkRuneFullyByReward(reward)
2956 - local count = self:getRuneBatCount() 2985 + if not checkHasRuneByReward(reward) then return false end
  2986 +
  2987 + local count = self:getRuneBagCount()
2957 local page = globalCsv.store_type[ItemType.Rune] 2988 local page = globalCsv.store_type[ItemType.Rune]
2958 local limit = self:getProperty("bagLimit")[page] 2989 local limit = self:getProperty("bagLimit")[page]
2959 if count >= limit then 2990 if count >= limit then
@@ -2972,7 +3003,7 @@ function RolePlugin.bind(Role) @@ -2972,7 +3003,7 @@ function RolePlugin.bind(Role)
2972 -- 把溢出的铭文奖励通过邮件发送 3003 -- 把溢出的铭文奖励通过邮件发送
2973 function Role:checkRuneCount(reward) 3004 function Role:checkRuneCount(reward)
2974 local firstMore = false 3005 local firstMore = false
2975 - local count = self:getRuneBatCount() 3006 + local count = self:getRuneBagCount()
2976 local page = globalCsv.store_type[ItemType.Rune] 3007 local page = globalCsv.store_type[ItemType.Rune]
2977 local limit = self:getProperty("bagLimit")[page] 3008 local limit = self:getProperty("bagLimit")[page]
2978 if count >= limit then 3009 if count >= limit then
@@ -3001,6 +3032,16 @@ function RolePlugin.bind(Role) @@ -3001,6 +3032,16 @@ function RolePlugin.bind(Role)
3001 end 3032 end
3002 end 3033 end
3003 3034
  3035 + function Role:getItemRandomOccupy(itemRandomData)
  3036 + local itemRandomOccupy = {}
  3037 + if itemRandomData then
  3038 + for typ, n in pairs(itemRandomData.ware:toNumMap() or {}) do
  3039 + itemRandomOccupy[typ] = n
  3040 + end
  3041 + end
  3042 + return itemRandomOccupy
  3043 + end
  3044 +
3004 3045
3005 end 3046 end
3006 3047
src/models/Rune.lua
@@ -92,8 +92,9 @@ function Rune:generateAttrs() @@ -92,8 +92,9 @@ function Rune:generateAttrs()
92 local attrs = "" 92 local attrs = ""
93 local typ, value = getRandomValue(runeData.attr1,runeData.range1) 93 local typ, value = getRandomValue(runeData.attr1,runeData.range1)
94 attrs = attrs:setv(typ, value) 94 attrs = attrs:setv(typ, value)
95 - local typ, value = getRandomValue(runeData.attr2,runeData.range2)  
96 - attrs = attrs:setv(typ, value) 95 + local typ, value = getRandomValue(runeData.attr2,runeData.range2)
  96 + attrs = string.format("%s %d=%d", attrs, typ, value)
  97 + --attrs = attrs:setv(typ, value)
97 self:setProperty("attrs",attrs) 98 self:setProperty("attrs",attrs)
98 end 99 end
99 100