Skip to content

Commit

Permalink
feat: provide configuration for min and max rolls
Browse files Browse the repository at this point in the history
#3 should be fixed by this
  • Loading branch information
zeevallin committed Dec 19, 2020
1 parent ae9a1ca commit a3b5266
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion Loot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,46 @@ function Addon:OnInitialize()
descStyle = "inline",
width = "double",
type = "toggle",
order = 4,
order = 1,
set = function(info, val) self.db.profile.session.selfroll = val end,
get = function(info) return self.db.profile.session.selfroll end
},
minroll = {
name = "Minimum roll number",
desc = "The smallest value that can be rolled by players.",
width = "double",
type = "range",
order = 2,
step = 1,
min = 0,
max = 99,
validate = function(info, val)
if val >= self.db.profile.session.maxroll then
return "Minimum roll number needs to be smaller than the maximum one"
end
return true
end,
set = function(info, val) self.db.profile.session.minroll = val end,
get = function(info) return self.db.profile.session.minroll end,
},
maxroll = {
name = "Maximum roll number",
desc = "The largest value that can be rolled by players.",
width = "double",
type = "range",
order = 3,
step = 1,
min = 1,
max = 100,
validate = function(info, val)
if val <= self.db.profile.session.minroll then
return "Maximum roll number needs to be larger than the minimum one"
end
return true
end,
set = function(info, val) self.db.profile.session.maxroll = val end,
get = function(info) return self.db.profile.session.maxroll end,
}
},
}

Expand Down

0 comments on commit a3b5266

Please sign in to comment.