This repository was archived by the owner on Nov 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFSLootTracker-Sort.lua
More file actions
163 lines (155 loc) · 3.11 KB
/
FSLootTracker-Sort.lua
File metadata and controls
163 lines (155 loc) · 3.11 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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
require "Window"
local FSLootTracker = Apollo.GetAddon("FSLootTracker")
local Info = Apollo.GetAddonInfo("FSLootTracker")
-- local tNewEntry =
-- {
-- recordType = karDataTypes.item,
-- itemID = itemInstance:GetItemId(),
-- count = itemCount,
-- cost = self.tConfig.defaultCost,
-- looter = self.tCache.LooterCache:GetAddValue(itemLooter),
-- quality = iQuality,
-- source = self.tCache.SourceCache:GetAddValue(self.tState.lastSource),
-- sourceType = karLootSources[itemSource],
-- rollType = itemNeed,
-- timeAdded = GameLib.GetGameTime(),
-- timeReported = GameLib.GetLocalTime(),
-- zone = self.tCache.ZoneCache:GetAddValue(GameLib.GetCurrentZoneMap().strName),
-- value = iValue
-- }
local karCurrentSorting =
{
Column = 4,
Order = 0
}
local karCurrentSortDisplay =
{
[1] = 0,
[2] = 0,
[3] = 0,
[4] = 0
}
local karUnselectedLabels = {
[1] = "Name",
[2] = "Source",
[3] = "Player",
[4] = "Time"
}
local karSortSources = {
Name = 1,
Time = 2,
Source = 3,
Location = 4,
Player = 5,
Loot = 6,
Time = 7,
Value = 8
}
local karSortOrderLabels = {
[1] = {
[0] = {
Label = "Name ▼",
Source = karSortSources.Name,
Direction = 0
},
[1] = {
Label = "Name ▲",
Source = karSortSources.Name,
Direction = 1
},
[2] = {
Label = "Type ▼",
Source = karSortSources.Type,
Direction = 0
},
[3] = {
Label = "Type ▲",
Source = karSortSources.Type,
Direction = 1
}
},
[2] = {
[0] = {
Label = "Source ▼",
Source = karSortSources.Source,
Direction = 0
},
[1] = {
Label = "Source ▲",
Source = karSortSources.Source,
Direction = 1
},
[2] = {
Label = "Location ▼",
Source = karSortSources.Location,
Direction = 0
},
[3] = {
Label = "Location ▲",
Source = karSortSources.Location,
Direction = 1
}
},
[3] = {
[0] = {
Label = "Player ▼",
Source = karSortSources.Player,
Direction = 0
},
[1] = {
Label = "Player ▲",
Source = karSortSources.Player,
Direction = 1
},
[2] = {
Label = "Loot ▼",
Source = karSortSources.Loot,
Direction = 0
},
[3] = {
Label = "Loot ▲",
Source = karSortSources.Loot,
Direction = 1
}
},
[4] = {
[0] = {
Label = "Time ▼",
Source = karSortSources.Time,
Direction = 0
},
[1] = {
Label = "Time ▲",
Source = karSortSources.Time,
Direction = 1
},
[2] = {
Label = "Value ▼",
Source = karSortSources.Value,
Direction = 0
},
[3] = {
Label = "Value ▲",
Source = karSortSources.Value,
Direction = 1
}
}
}
function FSLootTracker:ItemSorter(a, b)
if self.sortSettings.UseItemData then
local itemA = self.tCache.ItemCache:GetValue(a.itemID)
local itemB = self.tCache.ItemCache:GetValue(b.itemID)
if self.sortSettings.Direction then
return itemA[self.sortField] < itemB[self.sortField]
else
return itemA[self.sortField] > itemB[self.sortField]
end
else
if self.sortSettings.Direction then
return a[self.sortSettings.Field] < b[self.sortSettings.Field]
else
return a[self.sortSettings.Field] > b[self.sortSettings.Field]
end
end
return true
end