-
Notifications
You must be signed in to change notification settings - Fork 0
/
EchoesOfLore_Util.lua
118 lines (103 loc) · 2.83 KB
/
EchoesOfLore_Util.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
-----------------------
---EchoesOfLore_UTIL---
-----------------------
function EchoesOfLore:debugMsg(text)
if text == nil then
return
end
if EchoesOfLore.savedVariables.debug then
d("(" .. EchoesOfLore.name .. ") " .. text);
end
end
function EchoesOfLore.debugMsg(self,text)
if text == nil then
return
end
if EchoesOfLore.savedVariables.debug then
d("(" .. EchoesOfLore.name .. ") " .. text);
end
end
function EchoesOfLore:getColoredString(color, s)
local c = ZO_ColorDef:New(GetInterfaceColor(INTERFACE_COLOR_TYPE_ITEM_QUALITY_COLORS, color))
return c:Colorize(s)
end
-- Wraps text with a color.
function EchoesOfLore.Colorize(text, color)
-- Default to addon's .color.
if not color then color = EchoesOfLore.color end
text = "|c" .. color .. text .. "|r"
return text
end
--[[
function EchoesOfLore:tabletostring(t)
d("tabletostring called ")
for key,value in pairs(t) do print(key,value) end
for key,value in ipairs(t) do print(key,value) end
end
]]--
function EchoesOfLore:matchStringList(str,itemlist)
for _, v in ipairs(itemlist) do
if v == str then
return true
end
end
return false;
end
--------
--------
--Sort--
local dungeonSortKeys =
{
["name"] = { },
["text"] = { tiebreaker = "name" },
["order"] = { tiebreaker = "name", isNumeric = true },
}
--Sort
function EchoesOfLore.SortDungeonData(a, b)
return ZO_TableOrderingFunction( a.data, b.data, "order", dungeonSortKeys, ZO_SORT_ORDER_DOWN )
end
--Sort
function EchoesOfLore.SortDungeonData2(a, b)
if(a==nil or a.order==nil)then return true end
if(b==nil or b.order==nil)then return false end
return a.order < b.order
end
--------
--Sort--
local bossesSortKeys =
{
["name"] = { },
["text"] = { tiebreaker = "name" },
["order"] = { tiebreaker = "name", isNumeric = true },
}
--Sort
function EchoesOfLore.SortBossesData(a, b)
return ZO_TableOrderingFunction( a, b, "order", bossesSortKeys, ZO_SORT_ORDER_DOWN )
end
function EchoesOfLore.SortBossesData2(a, b)
if(a==nil or a.order==nil)then return true end
if(b==nil or b.order==nil)then return false end
return a.order<b.order
end
--------
--Sort--
local buttonSortKeys =
{
["name"] = { },
["text"] = { tiebreaker = "name" },
["order"] = { tiebreaker = "text", isNumeric = true },
}
--Sort
function EchoesOfLore.SortButtonData(a, b)
return ZO_TableOrderingFunction( a, b, "order", buttonSortKeys, ZO_SORT_ORDER_DOWN )
end
--Sort
local dungeonSortKeys =
{
["name"] = { },
["order"] = { tiebreaker = "name", isNumeric = true },
}
--Sort
function EchoesOfLore.SortDungeonData(a, b)
return ZO_TableOrderingFunction( a.data, b.data, "order", dungeonSortKeys, ZO_SORT_ORDER_DOWN )
end