Add all settings
This commit is contained in:
12
Autoloot.lua
12
Autoloot.lua
@@ -243,14 +243,15 @@ function shared.Autoloot.Init()
|
|||||||
local type = Type(slot)
|
local type = Type(slot)
|
||||||
if not type:Eq("Tradeskill") then return false end
|
if not type:Eq("Tradeskill") then return false end
|
||||||
local subtype = SubType(slot)
|
local subtype = SubType(slot)
|
||||||
return shared.config.autoloot.filter.profession.professions[subtype] or false
|
local professions = { strsplit(",", shared.config.autoloot.filter.profession.professions) }
|
||||||
|
return shared.TableContains(professions, subtype) or false
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
---@class ValueFilter : Filter
|
---@class ValueFilter : Filter
|
||||||
local ValueFilter = {
|
local ValueFilter = {
|
||||||
Matches = function(self, slot)
|
Matches = function(self, slot)
|
||||||
if not shared.config.autoloot.filter.value.enabled then return false end
|
if not shared.config.autoloot.filter.value.enabled then return false end
|
||||||
local value = ItemValue(slot)
|
local value = Value(slot)
|
||||||
if shared.config.autoloot.filter.value.byStack then
|
if shared.config.autoloot.filter.value.byStack then
|
||||||
value = value * Quantity(slot).value
|
value = value * Quantity(slot).value
|
||||||
end
|
end
|
||||||
@@ -263,7 +264,7 @@ function shared.Autoloot.Init()
|
|||||||
if not shared.config.autoloot.filter.greyvalue.enabled then return false end
|
if not shared.config.autoloot.filter.greyvalue.enabled then return false end
|
||||||
local quality = Quality(slot)
|
local quality = Quality(slot)
|
||||||
if not quality:Eq(0) then return false end
|
if not quality:Eq(0) then return false end
|
||||||
local value = ItemValue(slot)
|
local value = Value(slot)
|
||||||
if shared.config.autoloot.filter.greyvalue.byStack then
|
if shared.config.autoloot.filter.greyvalue.byStack then
|
||||||
value = value * Quantity(slot).value
|
value = value * Quantity(slot).value
|
||||||
end
|
end
|
||||||
@@ -293,7 +294,7 @@ function shared.Autoloot.Init()
|
|||||||
local NameFilter = {
|
local NameFilter = {
|
||||||
Matches = function(self, slot)
|
Matches = function(self, slot)
|
||||||
if not shared.config.autoloot.filter.name.enabled then return false end
|
if not shared.config.autoloot.filter.name.enabled then return false end
|
||||||
local whitelist = strsplit(",", shared.config.autoloot.filter.name.whitelist)
|
local whitelist = { strsplit(",", shared.config.autoloot.filter.name.whitelist) }
|
||||||
for _, name in ipairs(whitelist) do
|
for _, name in ipairs(whitelist) do
|
||||||
if not shared.config.autoloot.filter.name.caseSensitive then name = name:lower() end
|
if not shared.config.autoloot.filter.name.caseSensitive then name = name:lower() end
|
||||||
if shared.config.autoloot.filter.name.exact then
|
if shared.config.autoloot.filter.name.exact then
|
||||||
@@ -324,7 +325,8 @@ function shared.Autoloot.Init()
|
|||||||
local APFilter = {
|
local APFilter = {
|
||||||
Matches = function(self, slot)
|
Matches = function(self, slot)
|
||||||
if not shared.config.autoloot.filter.ap.enabled then return false end
|
if not shared.config.autoloot.filter.ap.enabled then return false end
|
||||||
return Value(slot):Eq(0) and Type(slot):Eq("Consumable") and SubType(slot):Eq("Other") and SubclassId(slot):Eq(8)
|
return Value(slot):Eq(0) and Type(slot):Eq("Consumable") and SubType(slot):Eq("Other") and
|
||||||
|
SubclassId(slot):Eq(8)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
---@class EverythingFilter : Filter
|
---@class EverythingFilter : Filter
|
||||||
|
69
Cyka.lua
69
Cyka.lua
@@ -11,6 +11,7 @@ local addonname, shared = ...
|
|||||||
---@field data CykaData
|
---@field data CykaData
|
||||||
---@field GetOrDefault fun(table: table<any, any>, keys: string[], default: any): any
|
---@field GetOrDefault fun(table: table<any, any>, keys: string[], default: any): any
|
||||||
---@field DumpTable fun(table: table<any, any>, depth: number)
|
---@field DumpTable fun(table: table<any, any>, depth: number)
|
||||||
|
---@field TableContains fun(table: table<any, any>, value: any): boolean
|
||||||
---@field Autoloot Autoloot
|
---@field Autoloot Autoloot
|
||||||
|
|
||||||
---@class CykaData
|
---@class CykaData
|
||||||
@@ -24,6 +25,17 @@ local addonname, shared = ...
|
|||||||
|
|
||||||
---@class CykaAutoLootFilterConfig
|
---@class CykaAutoLootFilterConfig
|
||||||
---@field gold { enabled: boolean }
|
---@field gold { enabled: boolean }
|
||||||
|
---@field orderResource { enabled: boolean }
|
||||||
|
---@field mount { enabled: boolean }
|
||||||
|
---@field ilvl { enabled: boolean, value: number }
|
||||||
|
---@field profession { enabled: boolean, professions: string }
|
||||||
|
---@field value { enabled: boolean, byStack: boolean, value: number }
|
||||||
|
---@field greyvalue { enabled: boolean, byStack: boolean, value: number }
|
||||||
|
---@field questItem { enabled: boolean }
|
||||||
|
---@field classGear { enabled: boolean, ilvlThreshold: number, qualityThreshold: number }
|
||||||
|
---@field name { enabled: boolean, exact: boolean, caseSensitive: boolean, whitelist: string }
|
||||||
|
---@field boe { enabled: boolean, ilvlThreshold: number, qualityThreshold: number }
|
||||||
|
---@field ap { enabled: boolean }
|
||||||
|
|
||||||
local function init()
|
local function init()
|
||||||
if not CykaPersistentData then CykaPersistentData = {} end
|
if not CykaPersistentData then CykaPersistentData = {} end
|
||||||
@@ -74,13 +86,68 @@ local function init()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param table table<any, any>
|
||||||
|
---@param value any
|
||||||
|
shared.TableContains = function(table, value)
|
||||||
|
for _, v in pairs(table) do
|
||||||
|
if v == value then return true end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
shared.config = {
|
shared.config = {
|
||||||
autoloot = {
|
autoloot = {
|
||||||
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "enabled" }, true),
|
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "enabled" }, true),
|
||||||
filter = {
|
filter = {
|
||||||
gold = {
|
gold = {
|
||||||
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "gold", "enabled" }, true),
|
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "gold", "enabled" }, true),
|
||||||
}
|
},
|
||||||
|
orderResource = {
|
||||||
|
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "orderResource", "enabled" }, true),
|
||||||
|
},
|
||||||
|
mount = {
|
||||||
|
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "mount", "enabled" }, true),
|
||||||
|
},
|
||||||
|
ilvl = {
|
||||||
|
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "ilvl", "enabled" }, true),
|
||||||
|
value = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "ilvl", "value" }, 910),
|
||||||
|
},
|
||||||
|
profession = {
|
||||||
|
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "profession", "enabled" }, true),
|
||||||
|
professions = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "profession", "professions" }, ""),
|
||||||
|
},
|
||||||
|
value = {
|
||||||
|
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "value", "enabled" }, true),
|
||||||
|
byStack = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "value", "byStack" }, false),
|
||||||
|
value = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "value", "value" }, 10000),
|
||||||
|
},
|
||||||
|
greyvalue = {
|
||||||
|
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "greyvalue", "enabled" }, true),
|
||||||
|
byStack = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "greyvalue", "byStack" }, false),
|
||||||
|
value = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "greyvalue", "value" }, 100000),
|
||||||
|
},
|
||||||
|
questItem = {
|
||||||
|
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "questItem", "enabled" }, true),
|
||||||
|
},
|
||||||
|
classGear = {
|
||||||
|
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "classGear", "enabled" }, true),
|
||||||
|
ilvlThreshold = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "classGear", "ilvlThreshold" }, 910),
|
||||||
|
qualityThreshold = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "classGear", "qualityThreshold" }, 3),
|
||||||
|
},
|
||||||
|
boe = {
|
||||||
|
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "boe", "enabled" }, true),
|
||||||
|
ilvlThreshold = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "boe", "ilvlThreshold" }, 910),
|
||||||
|
qualityThreshold = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "boe", "qualityThreshold" }, 3),
|
||||||
|
},
|
||||||
|
ap = {
|
||||||
|
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "ap", "enabled" }, true),
|
||||||
|
},
|
||||||
|
name = {
|
||||||
|
enabled = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "name", "enabled" }, false),
|
||||||
|
exact = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "name", "exact" }, false),
|
||||||
|
caseSensitive = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "name", "caseSensitive" }, false),
|
||||||
|
whitelist = shared.GetOrDefault(CykaPersistentData.config, { "autoloot", "filter", "name", "whitelist" }, ""),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user