|
55 | 55 |
|
56 | 56 | local function addQuestModsRewardsConfigOptions(configSettings) |
57 | 57 | table.insert(configSettings, { section = "Quest Rewards", col = 3 }) |
| 58 | + |
| 59 | + -- Loop through sections of line to apply multiple mods |
| 60 | + local function applyModsFromString(source, str, modList) |
| 61 | + for line in tostring(str):gmatch("[^\r\n]+") do |
| 62 | + if line ~= "" then |
| 63 | + questModsRewards(source, line, modList) |
| 64 | + end |
| 65 | + end |
| 66 | + end |
58 | 67 |
|
59 | | - for i, quest in ipairs(data.questRewards) do |
| 68 | + for _, quest in ipairs(data.questRewards) do |
60 | 69 | if quest.useConfig == false then |
61 | 70 | goto continue |
62 | 71 | end |
| 72 | + local key = "questAct" .. quest.Act .. quest.Type .. quest.Area |
| 73 | + local label = string.format("Act %d %s: %s", quest.Act, quest.Type, quest.Area) |
63 | 74 | local source = string.format("Quest:Act %d %s %s", quest.Act, quest.Type, quest.Area) |
64 | 75 | if quest.Stat then |
65 | | - table.insert(configSettings,{ |
66 | | - var = "questAct".. quest.Act .. quest.Type .. quest.Area, |
67 | | - label = string.format("Act %d %s: %s", quest.Act, quest.Type, quest.Area), |
| 76 | + table.insert(configSettings, { |
| 77 | + var = key, |
| 78 | + label = label, |
68 | 79 | type = "check", |
69 | 80 | defaultState = true, |
70 | 81 | tooltip = quest.Stat, |
71 | 82 | apply = function(val, modList, enemyModList) |
72 | | - questModsRewards(source, quest.Stat, modList) |
| 83 | + applyModsFromString(source, quest.Stat, modList) |
73 | 84 | end |
74 | 85 | }) |
75 | 86 | elseif quest.Options then |
76 | 87 | local listOptions = { { label = "Nothing", val = "None" } } |
77 | | - for j, option in ipairs(quest.Options) do |
| 88 | + for _, option in ipairs(quest.Options) do |
78 | 89 | table.insert(listOptions, { label = option, val = option }) |
79 | 90 | end |
80 | | - table.insert(configSettings,{ |
81 | | - var = "questAct".. quest.Act .. quest.Type .. quest.Area, |
82 | | - label = string.format("Act %d %s: %s", quest.Act, quest.Type, quest.Area), |
| 91 | + table.insert(configSettings, { |
| 92 | + var = key, |
| 93 | + label = label, |
83 | 94 | type = "list", |
84 | 95 | list = listOptions, |
85 | 96 | defaultIndex = 1, |
86 | 97 | tooltip = "Choose one of the following options:\n" .. table.concat(quest.Options, "\n"), |
87 | 98 | apply = function(val, modList, enemyModList) |
88 | | - if val == "None" then |
89 | | - return |
90 | | - end |
91 | | - questModsRewards(source, val, modList) |
| 99 | + if val == "None" then |
| 100 | + return |
| 101 | + end |
| 102 | + applyModsFromString(source, val, modList) |
92 | 103 | end |
93 | 104 | }) |
94 | 105 | end |
|
0 commit comments