Commit a3e27e79379a58d1f10a12fbd99c6efd5a61752a
Merge branch 'cn/develop' into cn/publish/release
Showing
8 changed files
with
207 additions
and
114 deletions
Show diff stats
src/GlobalVar.lua
... | ... | @@ -424,3 +424,14 @@ SystemBnousType = { |
424 | 424 | ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加 |
425 | 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 | 438 | \ No newline at end of file | ... | ... |
src/actions/GmAction.lua
... | ... | @@ -1029,9 +1029,9 @@ end |
1029 | 1029 | |
1030 | 1030 | table.insert(helpDes, {"清讨伐电台", "clear_radio", "id"}) |
1031 | 1031 | function _M.clear_radio(role, pms) |
1032 | - local id = pms.pm1 | |
1032 | + local id = tonumber(pms.pm1) | |
1033 | 1033 | local radioTask = role:getProperty("radioTask") |
1034 | - if id == 0 then | |
1034 | + if id ~= 0 then | |
1035 | 1035 | radioTask[id] = nil |
1036 | 1036 | else |
1037 | 1037 | radioTask = {} |
... | ... | @@ -1044,9 +1044,9 @@ end |
1044 | 1044 | |
1045 | 1045 | table.insert(helpDes, {"清代理拾荒", "clear_adv_hang", "id"}) |
1046 | 1046 | function _M.clear_adv_hang(role, pms) |
1047 | - local id = pms.pm1 | |
1047 | + local id = tonumber(pms.pm1) | |
1048 | 1048 | local task = role:getProperty("advHang") |
1049 | - if id == 0 then | |
1049 | + if id ~= 0 then | |
1050 | 1050 | task[id] = nil |
1051 | 1051 | else |
1052 | 1052 | task = {} |
... | ... | @@ -1058,10 +1058,10 @@ function _M.clear_adv_hang(role, pms) |
1058 | 1058 | end |
1059 | 1059 | |
1060 | 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 | 1063 | local task = role:getProperty("seaport") |
1064 | - if id == 0 then | |
1064 | + if id ~= 0 then | |
1065 | 1065 | task.collect[id] = nil |
1066 | 1066 | else |
1067 | 1067 | task.collect = {} | ... | ... |
src/actions/RoleAction.lua
... | ... | @@ -686,13 +686,17 @@ function _M.openTimeBoxRpc(agent, data) |
686 | 686 | local count, runeCount = 0, 0 |
687 | 687 | for itemId, num in pairs(costs) do |
688 | 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 | 696 | count = count + num |
693 | 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 | 701 | if role:getItemCount(costId) < count then return 8 end |
698 | 702 | if not role:checkItemEnough(costs) then return 9 end |
... | ... | @@ -886,25 +890,14 @@ function _M.unLockStoryBookRpc(agent, data) |
886 | 890 | return true |
887 | 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 | 896 | local taskStatus = role:getProperty(roleField[taskType]) |
904 | 897 | local tStatus = taskStatus["t"] or {} |
905 | 898 | |
906 | 899 | if (tStatus[taskId] or 0) < taskData.condition1 then |
907 | - return 3 | |
900 | + return nil | |
908 | 901 | end |
909 | 902 | |
910 | 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 | 925 | task_reward_type = taskType, --任务奖励类型,见 任务奖励类型枚举表 |
933 | 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 | 929 | end |
939 | 930 | |
940 | -function _M.taskActiveRpc(agent, data) | |
931 | +function _M.taskRpc(agent, data) | |
941 | 932 | local role = agent.role |
942 | 933 | local msg = MsgPack.unpack(data) |
943 | 934 | |
944 | 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 | 938 | local taskId = msg.id --任务id |
948 | 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 | 966 | local taskStatus = role:getProperty(roleField[taskType]) |
955 | 967 | local tStatus = taskStatus["at"] or {} |
956 | 968 | |
957 | 969 | if tStatus[taskId] == -1 or (taskStatus["a"] or 0) < taskData.active then |
958 | - return | |
970 | + return nil | |
959 | 971 | end |
960 | 972 | |
961 | 973 | local needReward = taskData.reward:toNumMap() |
... | ... | @@ -970,12 +982,42 @@ function _M.taskActiveRpc(agent, data) |
970 | 982 | role:changeUpdates({ |
971 | 983 | { type = roleField[taskType], field = {"at", taskId}, value = -1 } |
972 | 984 | }) |
973 | - | |
985 | + | |
974 | 986 | role:log("task_reward", { |
975 | 987 | task_reward_id = taskId * 100 + taskType, --任务奖励ID |
976 | 988 | task_reward_type = 3, --任务奖励类型,见 任务奖励类型枚举表 |
977 | 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 | 1022 | SendPacket(actionCodes.Role_taskActiveRpc, MsgPack.pack(role:packReward(reward, change))) |
981 | 1023 | return true |
... | ... | @@ -1405,7 +1447,7 @@ function _M.goldBuyRpc(agent, data) |
1405 | 1447 | local maxCount = maxIdx + role:getBnousUpSpeedNum(UpSpeedType.GearUpSpeed) |
1406 | 1448 | if curT > maxCount then return end |
1407 | 1449 | if curT > maxIdx then |
1408 | - for idx = maxIdx+1, curCount do | |
1450 | + for idx = maxIdx+1, curT do | |
1409 | 1451 | costs[idx] = costs[maxIdx] |
1410 | 1452 | end |
1411 | 1453 | end | ... | ... |
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,146 +2759,161 @@ 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 |
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 | 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 | 2796 | end |
2794 | 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 | 2799 | end |
2797 | 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 | 2811 | end |
2799 | 2812 | function Role:getBnousAdv() |
2800 | 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 | 2817 | end |
2805 | 2818 | |
2806 | 2819 | function Role:getBnousHangTime() |
2807 | 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 | 2823 | return towerBnous[SystemBnousType.HangTime] or 0 + tmptime |
2814 | 2824 | end |
2815 | 2825 | |
2816 | 2826 | function Role:getBnousPvpTicket() |
2817 | 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 | 2831 | end |
2822 | 2832 | |
2823 | 2833 | function Role:getBnousSweep() |
2824 | 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 | 2838 | end |
2829 | 2839 | |
2830 | 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 | 2843 | end |
2833 | 2844 | |
2834 | 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 | 2848 | return self:getDeltaValue(result, value) |
2837 | 2849 | end |
2838 | 2850 | |
2839 | 2851 | function Role:getBnousDaily() |
2852 | + local levelBnous = self:getLevelBnous() | |
2853 | + local dailyReward = levelBnous[SystemBnousType.DailyReward] or {} | |
2840 | 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 | 2856 | reward[k] = (reward[k] or 0) + v |
2844 | 2857 | end |
2845 | 2858 | return reward |
2846 | 2859 | end |
2847 | 2860 | |
2848 | 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 | 2864 | end |
2853 | 2865 | |
2854 | 2866 | --@upType 加速类型 1探索加速, 2齿轮加速, 3餐厅加速 |
2855 | 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 | 2871 | end |
2862 | 2872 | |
2863 | 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 | 2876 | end |
2866 | 2877 | |
2867 | 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 | 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 | 2913 | end |
2896 | - levelBnous[pm1] = levelBnous[pm1] + pm2 | |
2897 | - else | |
2898 | - levelBnous[pm1][pm2] = (levelBnous[pm1][pm2] or 0) + pm3 | |
2899 | 2914 | end |
2900 | 2915 | end |
2901 | 2916 | end |
2902 | - self:updateProperty({field = "levelBnous", value= levelBnous}) | |
2903 | 2917 | return levelBnous |
2904 | 2918 | end |
2905 | 2919 | |
... | ... | @@ -2934,11 +2948,13 @@ function RolePlugin.bind(Role) |
2934 | 2948 | self:mylog("hero_action", {desc = desc, int1 = heroType}) |
2935 | 2949 | end |
2936 | 2950 | |
2937 | - function Role:getRuneBatCount() | |
2951 | + function Role:getRuneBagCount() | |
2938 | 2952 | local count = 0 |
2939 | 2953 | for _, rune in pairs(self.runeBag) do |
2940 | 2954 | if next(rune) then |
2941 | - count = count + 1 | |
2955 | + if rune:getProperty("refer") == 0 then | |
2956 | + count = count + 1 | |
2957 | + end | |
2942 | 2958 | end |
2943 | 2959 | end |
2944 | 2960 | return count or 0 |
... | ... | @@ -2947,13 +2963,28 @@ function RolePlugin.bind(Role) |
2947 | 2963 | -- 铭文仓库是否满仓 |
2948 | 2964 | function Role:checkRuneFully(count) |
2949 | 2965 | count = count or 0 |
2966 | + if count == 0 then return false end | |
2967 | + | |
2950 | 2968 | local page = globalCsv.store_type[ItemType.Rune] |
2951 | 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 | 2982 | end |
2954 | 2983 | |
2955 | 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 | 2988 | local page = globalCsv.store_type[ItemType.Rune] |
2958 | 2989 | local limit = self:getProperty("bagLimit")[page] |
2959 | 2990 | if count >= limit then |
... | ... | @@ -2972,7 +3003,7 @@ function RolePlugin.bind(Role) |
2972 | 3003 | -- 把溢出的铭文奖励通过邮件发送 |
2973 | 3004 | function Role:checkRuneCount(reward) |
2974 | 3005 | local firstMore = false |
2975 | - local count = self:getRuneBatCount() | |
3006 | + local count = self:getRuneBagCount() | |
2976 | 3007 | local page = globalCsv.store_type[ItemType.Rune] |
2977 | 3008 | local limit = self:getProperty("bagLimit")[page] |
2978 | 3009 | if count >= limit then |
... | ... | @@ -3001,6 +3032,16 @@ function RolePlugin.bind(Role) |
3001 | 3032 | end |
3002 | 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 | 3046 | end |
3006 | 3047 | ... | ... |
src/models/Rune.lua
... | ... | @@ -92,8 +92,9 @@ function Rune:generateAttrs() |
92 | 92 | local attrs = "" |
93 | 93 | local typ, value = getRandomValue(runeData.attr1,runeData.range1) |
94 | 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 | 98 | self:setProperty("attrs",attrs) |
98 | 99 | end |
99 | 100 | ... | ... |