Skip to content

Commit fc1f682

Browse files
author
LocalIdentity
committed
Add support for multi mod quest rewards
1 parent 352fc71 commit fc1f682

2 files changed

Lines changed: 27 additions & 19 deletions

File tree

src/Data/QuestRewards.lua

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,12 @@ return {
5858
},
5959
{
6060
-- "Medallion"
61-
-- NOTE: Both rewards include "+1 Charm Slot"
6261
["Act"] = 2,
6362
["Type"] = "",
6463
["Area"] = "Valley of the Titans",
6564
["Options"] = {
66-
"30% increased Charm Charges Gained",
67-
"30% increased Charm Effect Duration",
65+
"30% increased Charm Charges Gained\n\t+1 Charm Slot",
66+
"30% increased Charm Effect Duration\n\t+1 Charm Slot",
6867
},
6968
["AreaLevel"] = 26,
7069
["useConfig"] = true
@@ -247,8 +246,6 @@ return {
247246
},
248247
{
249248
-- "The Seven Pillars"
250-
-- TODO: The "5% increased Experience Gain" reward comes with the following downside:
251-
-- "-5% to Elemental Resistances,3% reduced Movement Speed,15% reduced Global Defences,20% reduced Presence Area Of Effect,12% reduced Cooldown Recovery Rate,5% reduced Attributes"
252249
["Act"] = 5,
253250
["Type"] = "Interlude 2",
254251
["Area"] = "Qimah",
@@ -259,7 +256,7 @@ return {
259256
"20% increased Presence Area Of Effect",
260257
"12% increased Cooldown Recovery Rate",
261258
"+5 to all Attributes",
262-
"5% increased Experience Gain",
259+
"5% increased Experience Gain\n\t-5% to Elemental Resistances\n\t3% reduced Movement Speed\n\t15% reduced Global Defences\n\t20% reduced Presence Area Of Effect\n\t12% reduced Cooldown Recovery Rate\n\t-5 to all Attributes",
263260
},
264261
["AreaLevel"] = 63,
265262
["useConfig"] = true

src/Modules/ConfigOptions.lua

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,40 +55,51 @@ end
5555

5656
local function addQuestModsRewardsConfigOptions(configSettings)
5757
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
5867

59-
for i, quest in ipairs(data.questRewards) do
68+
for _, quest in ipairs(data.questRewards) do
6069
if quest.useConfig == false then
6170
goto continue
6271
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)
6374
local source = string.format("Quest:Act %d %s %s", quest.Act, quest.Type, quest.Area)
6475
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,
6879
type = "check",
6980
defaultState = true,
7081
tooltip = quest.Stat,
7182
apply = function(val, modList, enemyModList)
72-
questModsRewards(source, quest.Stat, modList)
83+
applyModsFromString(source, quest.Stat, modList)
7384
end
7485
})
7586
elseif quest.Options then
7687
local listOptions = { { label = "Nothing", val = "None" } }
77-
for j, option in ipairs(quest.Options) do
88+
for _, option in ipairs(quest.Options) do
7889
table.insert(listOptions, { label = option, val = option })
7990
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,
8394
type = "list",
8495
list = listOptions,
8596
defaultIndex = 1,
8697
tooltip = "Choose one of the following options:\n" .. table.concat(quest.Options, "\n"),
8798
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)
92103
end
93104
})
94105
end

0 commit comments

Comments
 (0)