comparison core.lua @ 118:ec5174529e0f

Make more use of g_loot.raiders in the GUI rather than calling GRRI each time.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Thu, 16 Aug 2012 23:04:29 -0400
parents fc2ff128835a
children fb4bda3ad05c
comparison
equal deleted inserted replaced
117:dbdab3780757 118:ec5174529e0f
2171 -- conditionals). 2171 -- conditionals).
2172 function addon:filtered_loot_iter (filter_kind) 2172 function addon:filtered_loot_iter (filter_kind)
2173 return self._find_next_after, filter_kind, 0 2173 return self._find_next_after, filter_kind, 0
2174 end 2174 end
2175 2175
2176 -- Iterate through g_loot.raiders in sorted (alphabetical/collated) order. If
2177 -- USE_FULLNAME then the realmname is appended. If ONLINE_FILTER is present,
2178 -- then only raider entries with a matching 'online' key are included. Loop
2179 -- variables are a running count, the raider name, and the corresponding entry
2180 -- from g_loot.raiders.
2181 do
2182 local function nextr (list, index)
2183 index = index + 1
2184 local name = list[index]
2185 if not name then
2186 flib.del(list)
2187 return nil
2188 end
2189 return index, name, list.__safety[name]
2190 end
2191
2192 function addon:sorted_raiders_iter (use_fullname_p, opt_online_filter)
2193 local t = flib.new()
2194 for name,info in next, g_loot.raiders do
2195 if (not opt_online_filter) or (info.online == opt_online_filter) then
2196 -- this is not exactly "A?B:C" semantics, but it is exactly
2197 -- the behavior we want when fname is not present
2198 tinsert (t, use_fullname_p and info.fname or name)
2199 end
2200 end
2201 table.sort(t)
2202 t.__safety = g_loot.raiders
2203 return nextr, t, 0
2204 end
2205 end
2206
2176 do 2207 do
2177 local itt 2208 local itt
2178 local function create() 2209 local function create()
2179 local tip, lefts = CreateFrame("GameTooltip"), {} 2210 local tip, lefts = CreateFrame("GameTooltip"), {}
2180 for i = 1, 2 do -- scanning idea here also snagged from Talented 2211 for i = 1, 2 do -- scanning idea here also snagged from Talented
2243 self:zero_printed_fenceposts(0) -- g_loot.printed.* = 0 2274 self:zero_printed_fenceposts(0) -- g_loot.printed.* = 0
2244 end 2275 end
2245 if possible_st then 2276 if possible_st then
2246 possible_st:SetData(g_loot_wrapper) 2277 possible_st:SetData(g_loot_wrapper)
2247 end 2278 end
2279 -- Make sure we have a current .raiders array, since other dropdowns and
2280 -- whatnot depend on that information.
2281 self:CheckRoster()
2248 2282
2249 self.status_text = ("%s(r%s) communicating as ident %s commrev %s"): 2283 self.status_text = ("%s(r%s) communicating as ident %s commrev %s"):
2250 format (self.version, self.revision, self.ident, self.commrev) 2284 format (self.version, self.revision, self.ident, self.commrev)
2251 self:RegisterComm(self.ident) 2285 self:RegisterComm(self.ident)
2252 self:RegisterComm(self.identTg, "OnCommReceivedNocache") 2286 self:RegisterComm(self.identTg, "OnCommReceivedNocache")