Skip to content

Commit

Permalink
refactor raid and group info lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
Pazza committed Sep 19, 2019
1 parent 0cc6acb commit f23853a
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions Sources/WindowHandler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ local strsub = strsub;
local time = time;
local Ambiguate = Ambiguate;
local GetGuildInfo = GetGuildInfo;
local UnitClass = UnitClass;
local UnitLevel = UnitLevel;
local UnitRace = UnitRace;

-- set namespace
setfenv(1, WIM);
Expand Down Expand Up @@ -1050,25 +1053,33 @@ local function instantiateWindow(obj)
for i = 1, _G.GetNumGroupMembers() do
local unitId = "raid"..i
local name = _G.GetUnitName(unitId, true)
if self.theUser == name then
self.class = _G.UnitClass(unitId) or "";
self.level = _G.UnitLevel(unitId) or "";
self.race = _G.UnitRace(unitId) or "";
self:UpdateIcon();
self:UpdateCharDetails();
if self.theUser == name then
self.WhoCallback({
Name = name,
Online = true,
Guild = self.guild or "",
Class = UnitClass(unitId) or "",
Level = UnitLevel(unitId) or "",
Race = UnitRace(unitId) or "",
Zone = self.zone or ""
});
break
end
end
elseif _G.IsInGroup() then
for i = 1, _G.GetNumSubgroupMembers() do
local unitId = "party"..i
local name = _G.GetUnitName(unitId, true)
if self.theUser == name then
self.class = _G.UnitClass(unitId) or "";
self.level = _G.UnitLevel(unitId) or "";
self.race = _G.UnitRace(unitId) or "";
self:UpdateIcon();
self:UpdateCharDetails();
if self.theUser == name then
self.WhoCallback({
Name = name,
Online = true,
Guild = self.guild or "",
Class = UnitClass(unitId) or "",
Level = UnitLevel(unitId) or "",
Race = UnitRace(unitId) or "",
Zone = self.zone or ""
});
break
end
end
Expand Down

0 comments on commit f23853a

Please sign in to comment.