-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOptions.lua
131 lines (122 loc) · 4.73 KB
/
Options.lua
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
function ChatLootBidderOptionsFrame_InitializeChannelDropdown(level, menulist)
if level == nil then
-- Initialize the "outer Frame" to include a :SetValue() method which we can use externally
local widgetName = this:GetName()
local propName = string.sub(widgetName, strlen(this:GetParent():GetName())+1)
this.SetValue = function(self, value)
getglobal(widgetName .. "Text"):SetText((ChatLootBidder_i18n[propName] or propName) .. ": " .. value)
CloseDropDownMenus()
end
elseif level == 1 then
local widget = this:GetParent()
local widgetName = widget:GetName()
local propName = string.sub(widgetName, strlen(widget:GetParent():GetName())+1)
for _,c in pairs({"RAID","RAID_WARNING","OFFICER","PARTY","GUILD","SAY","YELL","EMOTE"}) do
local channel = {}
channel.text = c
channel.func = function()
getglobal("ChatLootBidderFrame"):SetPropValue(propName, channel.text)
widget:SetValue(channel.text)
end
UIDropDownMenu_AddButton(channel)
end
end
end
function ChatLootBidderOptionsFrame_Back()
if not ChatLootBidder_Store then return end
local k,prev
for k,_ in pairs(ChatLootBidder_Store.SoftReserveSessions) do
if ChatLootBidderOptionsFrameCurrentSoftReserve:GetText() == k and prev ~= nil then
break
end
prev = k
end
ChatLootBidderOptionsFrameCurrentSoftReserve:SetText(prev or "No List")
end
function ChatLootBidderOptionsFrame_Next()
if not ChatLootBidder_Store then return end
local k,isNext
for k,_ in pairs(ChatLootBidder_Store.SoftReserveSessions) do
if isNext then
ChatLootBidderOptionsFrameCurrentSoftReserve:SetText(k)
return
end
if ChatLootBidderOptionsFrameCurrentSoftReserve:GetText() == k then
isNext = true
end
end
k = next(ChatLootBidder_Store.SoftReserveSessions)
ChatLootBidderOptionsFrameCurrentSoftReserve:SetText(k or "No List")
end
function ChatLootBidderOptionsFrame_ToggleLock()
ChatLootBidderFrame:ToggleSrLock()
ChatLootBidderOptionsFrame_Reload()
end
function ChatLootBidderOptionsFrame_Reload()
local srName, sr = ChatLootBidderFrame:LoadedSoftReserveSession()
if sr then
local items, players, i = 0, 0, nil
for _,i in pairs(sr) do
players = players + 1
items = items + getn(i)
end
ChatLootBidderOptionsFrameCurrentSoftReserveLoaded:SetText("Loaded: " .. srName)
ChatLootBidderOptionsFrameCurrentSoftReservePlayers:SetText("Players: " .. players)
ChatLootBidderOptionsFrameCurrentSoftReserveItems:SetText("Items: " .. items)
for _,i in pairs({"csv","json","raidresfly","semicolon"}) do
getglobal("ChatLootBidderOptionsFrameSREncode_" .. i):Show()
end
ChatLootBidderOptionsFrameSRToggleLock:Show()
ChatLootBidderOptionsFrameSRList:Show()
ChatLootBidderOptionsFrameSRInstructions:Show()
ChatLootBidderOptionsFrameSRToggleLock:SetText(ChatLootBidderFrame:IsLocked() and "Unlock" or "Lock")
else
ChatLootBidderOptionsFrameCurrentSoftReserveLoaded:SetText("Loaded: ")
ChatLootBidderOptionsFrameCurrentSoftReservePlayers:SetText("Players: ")
ChatLootBidderOptionsFrameCurrentSoftReserveItems:SetText("Items: ")
local i
for _,i in pairs({"csv","json","raidresfly","semicolon"}) do
getglobal("ChatLootBidderOptionsFrameSREncode_" .. i):Hide()
end
ChatLootBidderOptionsFrameSRToggleLock:Hide()
ChatLootBidderOptionsFrameSRList:Hide()
ChatLootBidderOptionsFrameSRInstructions:Hide()
end
end
function ChatLootBidderOptionsFrame_Unload()
local srName, sr = ChatLootBidderFrame:LoadedSoftReserveSession()
ChatLootBidderFrame:HandleSrUnload(srName)
end
function ChatLootBidderOptionsFrame_Delete()
local listName = ChatLootBidderOptionsFrameCurrentSoftReserve:GetText()
if listName == "No List" then return end
local srName, sr = ChatLootBidderFrame:LoadedSoftReserveSession()
if sr and srName == listName then
ChatLootBidderFrame:HandleSrUnload(listName)
end
ChatLootBidderFrame:HandleSrDelete(listName)
ChatLootBidderOptionsFrame_Init()
end
function ChatLootBidderOptionsFrame_Load()
local listName = ChatLootBidderOptionsFrameCurrentSoftReserve:GetText()
if listName == "No List" then listName = nil end
ChatLootBidderFrame:HandleSrLoad(listName)
end
function ChatLootBidderOptionsFrame_Init(providedName)
if providedName then
ChatLootBidderOptionsFrameCurrentSoftReserve:SetText(providedName)
else
ChatLootBidderOptionsFrame_Back()
end
ChatLootBidderOptionsFrame_Reload()
end
function ChatLootBidderOptionsFrame_OnTooltip()
local len = string.len("ChatLootBidderOptionsFrameSR")
local text = string.sub(this:GetName(), len+1)
if text then
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
GameTooltip:ClearLines()
GameTooltip:AddLine(text)
GameTooltip:Show()
end
end