-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoptions.lua
More file actions
executable file
·66 lines (60 loc) · 1.81 KB
/
Copy pathoptions.lua
File metadata and controls
executable file
·66 lines (60 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
function GuildGroupFinder:InitOptions()
-- load db
local defaults = {
-- none as of yet
}
self.db = LibStub('AceDB-3.0'):New('GuildGroupFinderDB', defaults, true)
-- options UI definitions
local options = {
name = 'GuildGroupFinder',
handler = GuildGroupFinder,
type = 'group',
args = {
profile = {},
scale = {
type = 'group',
name = 'Config',
args = {
headerText = {
type = 'header',
name = 'There isn\'t any config at the moment',
},
}
}
}
}
-- Hook up to db
options.args.profile = LibStub('AceDBOptions-3.0'):GetOptionsTable(self.db)
-- Hook up to UI
LibStub('AceConfig-3.0'):RegisterOptionsTable('GuildGroupFinder', options, {'GuildGroupFinder'})
LibStub('AceConfigDialog-3.0'):AddToBlizOptions('GuildGroupFinder', nil, nil)
-- Register a command to open settings
self:RegisterChatCommand('ggf', 'ShowOptions')
end
function GuildGroupFinder:ShowOptions()
self:ShowOptionsGUI()
end
-- Option handlers (examples, for the moment)
function GuildGroupFinder:SetHPScale(info, msg)
if (type(msg) == 'number') then
self:SetHPScaleRaw(msg)
else
self:SetHPScaleRaw(tonumber(msg))
end
end
function GuildGroupFinder:GetHPScale(info)
return tostring(self.db.profile.hpScale)
end
-- Set based on params
function GuildGroupFinder:SetHPScaleRaw(scale)
local maxHP = UnitHealthMax('player')
self:Print('Max HP: ' .. maxHP .. ' scale ' .. scale .. ' new max hp ' .. (maxHP / scale))
self.db.profile.hpScale = scale
fastHPScale = scale
end
function GuildGroupFinder:SetManaScaleRaw(scale)
local maxMana = UnitPowerMax('player')
self:Print('Max HP: ' .. maxMana .. ' scale ' .. scale .. ' new max mana ' .. (maxMana / scale))
self.db.profile.manaScale = scale
fastManaScale = scale
end