From a3b5266ac017b5f13c30f3991c83d3cf4d744718 Mon Sep 17 00:00:00 2001 From: "Zee V. (Philip)" Date: Sat, 19 Dec 2020 23:10:14 +0100 Subject: [PATCH] feat: provide configuration for min and max rolls #3 should be fixed by this --- Loot.lua | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/Loot.lua b/Loot.lua index 596767b..4b9d9fe 100644 --- a/Loot.lua +++ b/Loot.lua @@ -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, + } }, }