-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
338 additions
and
372 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
<Ui xmlns="http://www.blizzard.com/wow/ui/"> | ||
<Script file="indicator.lua"/> | ||
<Script file="mouseover.lua"/> | ||
<Script file="quest.lua"/> | ||
<Script file="raidtarget.lua"/> | ||
<Script file="selected.lua"/> | ||
<Script file="totem.lua"/> | ||
</Ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
local F, C = unpack(select(2, ...)) | ||
local NAMEPLATE = F:GetModule('Nameplate') | ||
|
||
function NAMEPLATE:IsMouseoverUnit() | ||
if not self or not self.unit then | ||
return | ||
end | ||
|
||
if self:IsVisible() and UnitExists('mouseover') then | ||
return UnitIsUnit('mouseover', self.unit) | ||
end | ||
return false | ||
end | ||
|
||
function NAMEPLATE:HighlightOnUpdate(elapsed) | ||
self.elapsed = (self.elapsed or 0) + elapsed | ||
if self.elapsed > 0.1 then | ||
if not NAMEPLATE.IsMouseoverUnit(self.__owner) then | ||
self:Hide() | ||
end | ||
self.elapsed = 0 | ||
end | ||
end | ||
|
||
function NAMEPLATE:HighlightOnHide() | ||
self.__owner.HighlightIndicator:Hide() | ||
end | ||
|
||
function NAMEPLATE:UpdateMouseoverShown() | ||
if not self or not self.unit then | ||
return | ||
end | ||
|
||
if self:IsShown() and UnitIsUnit('mouseover', self.unit) then | ||
self.HighlightIndicator:Show() | ||
self.HighlightUpdater:Show() | ||
else | ||
self.HighlightUpdater:Hide() | ||
end | ||
end | ||
|
||
function NAMEPLATE:CreateMouseoverIndicator(self) | ||
local highlight = CreateFrame('Frame', nil, self.Health) | ||
highlight:SetAllPoints(self) | ||
highlight:Hide() | ||
local texture = highlight:CreateTexture(nil, 'ARTWORK') | ||
texture:SetAllPoints() | ||
texture:SetColorTexture(1, 1, 1, 0.25) | ||
|
||
self:RegisterEvent('UPDATE_MOUSEOVER_UNIT', NAMEPLATE.UpdateMouseoverShown, true) | ||
|
||
local updater = CreateFrame('Frame', nil, self) | ||
updater.__owner = self | ||
updater:SetScript('OnUpdate', NAMEPLATE.HighlightOnUpdate) | ||
updater:HookScript('OnHide', NAMEPLATE.HighlightOnHide) | ||
|
||
self.HighlightIndicator = highlight | ||
self.HighlightUpdater = updater | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
local F, C = unpack(select(2, ...)) | ||
local NAMEPLATE = F:GetModule('Nameplate') | ||
|
||
local isInInstance | ||
local function CheckInstanceStatus() | ||
isInInstance = IsInInstance() | ||
end | ||
|
||
function NAMEPLATE:QuestIconCheck() | ||
if not C.DB.Nameplate.QuestIndicator then | ||
return | ||
end | ||
|
||
CheckInstanceStatus() | ||
F:RegisterEvent('PLAYER_ENTERING_WORLD', CheckInstanceStatus) | ||
end | ||
|
||
local function isQuestTitle(textLine) | ||
local r, g, b = textLine:GetTextColor() | ||
if r > 0.99 and g > 0.82 and b == 0 then | ||
return true | ||
end | ||
end | ||
|
||
function NAMEPLATE:UpdateQuestUnit(_, unit) | ||
if not C.DB.Nameplate.QuestIndicator then | ||
return | ||
end | ||
|
||
local isNameOnly = self.plateType == 'NameOnly' | ||
local isInGroup = IsInRaid() or IsInGroup() | ||
|
||
if isInInstance then | ||
self.questIcon:Hide() | ||
self.questCount:SetText('') | ||
return | ||
end | ||
|
||
unit = unit or self.unit | ||
|
||
local startLooking, questProgress | ||
F.ScanTip:SetOwner(_G.UIParent, 'ANCHOR_NONE') | ||
F.ScanTip:SetUnit(unit) | ||
|
||
for i = 2, F.ScanTip:NumLines() do | ||
local textLine = _G[C.ADDON_NAME .. 'ScanTooltipTextLeft' .. i] | ||
local text = textLine and textLine:GetText() | ||
|
||
if not text then | ||
break | ||
end | ||
|
||
if text ~= ' ' then | ||
if isInGroup and text == C.MY_NAME or (not isInGroup and isQuestTitle(textLine)) then | ||
startLooking = true | ||
elseif startLooking then | ||
local current, goal = string.match(text, '(%d+)/(%d+)') | ||
local progress = string.match(text, '(%d+)%%') | ||
if current and goal then | ||
local diff = math.floor(goal - current) | ||
if diff > 0 then | ||
questProgress = diff | ||
break | ||
end | ||
elseif progress and not string.match(text, _G.THREAT_TOOLTIP) then | ||
if math.floor(100 - progress) > 0 then | ||
questProgress = progress .. '%' -- lower priority on progress, keep looking | ||
end | ||
else | ||
break | ||
end | ||
end | ||
end | ||
end | ||
|
||
if questProgress and not isNameOnly then | ||
self.questCount:SetText(questProgress) | ||
self.questIcon:SetAtlas('Warfronts-BaseMapIcons-Horde-Barracks-Minimap') | ||
self.questIcon:Show() | ||
else | ||
self.questCount:SetText('') | ||
self.questIcon:Hide() | ||
end | ||
end | ||
|
||
function NAMEPLATE:CreateQuestIndicator(self) | ||
if not C.DB.Nameplate.QuestIndicator then | ||
return | ||
end | ||
|
||
local height = C.DB.Nameplate.Height | ||
local qicon = self:CreateTexture(nil, 'OVERLAY', nil, 2) | ||
qicon:SetPoint('LEFT', self, 'RIGHT', 3, 0) | ||
qicon:SetSize(height + 10, height + 10) | ||
qicon:SetAtlas('adventureguide-microbutton-alert') | ||
qicon:Hide() | ||
|
||
local count = F.CreateFS(self, C.Assets.Font.Condensed, 12, nil, '', nil, true) | ||
count:SetPoint('LEFT', qicon, 'RIGHT', -3, 0) | ||
count:SetTextColor(0.6, 0.8, 1) | ||
|
||
self.questIcon = qicon | ||
self.questCount = count | ||
self:RegisterEvent('QUEST_LOG_UPDATE', NAMEPLATE.UpdateQuestUnit, true) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.