-
Notifications
You must be signed in to change notification settings - Fork 3
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
6 changed files
with
309 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/libs/*/ |
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,7 @@ | ||
externals: | ||
libs/LibStub: https://repos.wowace.com/wow/ace3/trunk/LibStub | ||
libs/AceAddon-3.0: https://repos.wowace.com/wow/ace3/trunk/AceAddon-3.0 | ||
libs/AceConfig-3.0: https://repos.wowace.com/wow/ace3/trunk/AceConfig-3.0 | ||
libs/AceConsole-3.0: https://repos.wowace.com/wow/ace3/trunk/AceConsole-3.0 | ||
libs/AceHook-3.0: https://repos.wowace.com/wow/ace3/trunk/AceHook-3.0 | ||
libs/AceEvent-3.0: https://repos.wowace.com/wow/ace3/trunk/AceEvent-3.0 |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd"> | ||
<Script file="LibStub\LibStub.lua"/> | ||
<Include file="AceAddon-3.0\AceAddon-3.0.xml"/> | ||
<Include file="AceConfig-3.0\AceConfig-3.0.xml"/> | ||
<Include file="AceConsole-3.0\AceConsole-3.0.xml"/> | ||
<Include file="AceHook-3.0\AceHook-3.0.xml"/> | ||
<Include file="AceEvent-3.0\AceEvent-3.0.xml"/> | ||
</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,174 @@ | ||
local _, TTT = ...; | ||
--- @type TalentTreeTweaks_Main | ||
local Main = TTT.Main; | ||
|
||
local Module = Main:NewModule('TooltipIds'); | ||
|
||
function Module:OnInitialize() | ||
EventRegistry:RegisterCallback("TalentDisplay.TooltipCreated", self.OnTalentTooltipCreated, self) | ||
EventRegistry:RegisterCallback("ProfessionSpecs.SpecPerkEntered", self.OnProfessionPerkEntered, self) | ||
EventRegistry:RegisterCallback("ProfessionSpecs.SpecPathEntered", self.OnProfessionPathEntered, self) | ||
end | ||
|
||
function Module:OnEnable() | ||
self.enabled = true | ||
end | ||
|
||
function Module:OnDisable() | ||
self.enabled = false | ||
end | ||
|
||
function Module:GetDescription() | ||
return 'Adds spell id and more to the various talent tree tooltips.' | ||
end | ||
|
||
function Module:GetName() | ||
return 'Tooltip IDs' | ||
end | ||
|
||
local defaultDb = { | ||
talentTooltip = { | ||
enabled = true, | ||
nodeId = true, | ||
entryId = false, | ||
definitionId = false, | ||
spellId = true, | ||
}, | ||
professionTooltip = { | ||
enabled = true, | ||
nodeId = true, | ||
entryId = false, | ||
definitionId = false, | ||
spellId = true, | ||
}, | ||
} | ||
|
||
function Module:GetOptions(defaultOptionsTable, db) | ||
self.db = db; | ||
for k, v in pairs(defaultDb) do | ||
if db[k] == nil then | ||
db[k] = v; | ||
end | ||
end | ||
|
||
local order = 5; | ||
local function increment() order = order + 1; return order; end; | ||
|
||
local getter = function(info, key) | ||
return self.db[info[#info]][key]; | ||
end; | ||
local setter = function(info, key, value) | ||
self.db[info[#info]][key] = value; | ||
end; | ||
|
||
defaultOptionsTable.args.talentTooltip = { | ||
order = increment(), | ||
type = 'multiselect', | ||
name = 'Talent Tooltip', | ||
desc = 'Toggles for the Talent Tooltips.', | ||
values = { | ||
enabled = 'Enable Talent Tooltip', | ||
nodeId = 'Enable Node ID', | ||
entryId = 'Enable Entry ID', | ||
definitionId = 'Enable Definition ID', | ||
spellId = 'Enable Spell ID', | ||
}, | ||
get = getter, | ||
set = setter, | ||
}; | ||
defaultOptionsTable.args.professionTooltip = { | ||
order = increment(), | ||
type = 'multiselect', | ||
name = 'Talent Tooltip', | ||
desc = 'Toggles for the Professions Tooltips.', | ||
values = { | ||
enabled = 'Enable Professions Tooltip', | ||
nodeId = 'Enable Node ID', | ||
entryId = 'Enable Entry ID', | ||
definitionId = 'Enable Definition ID', | ||
spellId = 'Enable Spell ID', | ||
}, | ||
get = getter, | ||
set = setter, | ||
}; | ||
|
||
return defaultOptionsTable; | ||
end | ||
|
||
function Module:AlreadyAdded(textLine, tooltip) | ||
if textLine == nil then | ||
return false | ||
end | ||
|
||
for i = 1,15 do | ||
local tooltipFrame = _G[tooltip:GetName() .. "TextLeft" .. i] | ||
local textRight = _G[tooltip:GetName().."TextRight"..i] | ||
local text, right | ||
if tooltipFrame then text = tooltipFrame:GetText() end | ||
if text and string.find(text, textLine, 1, true) then return true end | ||
if textRight then right = textRight:GetText() end | ||
if right and string.find(right, textLine, 1, true) then return true end | ||
end | ||
end | ||
|
||
function Module:AddItemToTooltip(idName, value, tooltip) | ||
if value == nil then | ||
return | ||
end | ||
local text = "|cFFEE6161" .. idName .. "|r " .. value | ||
if(not self:AlreadyAdded(text, tooltip)) then | ||
tooltip:AddLine(text) | ||
end | ||
tooltip:Show() | ||
end | ||
|
||
function Module:AddGenericTraitButtonTooltips(button, tooltip, settings) | ||
if settings.entryId then | ||
self:AddItemToTooltip('EntryId', button:GetEntryID(), tooltip) | ||
end | ||
if settings.spellId then | ||
self:AddItemToTooltip('SpellId', button:GetSpellID(), tooltip) | ||
end | ||
if settings.definitionId then | ||
self:AddItemToTooltip('DefinitionId', button.GetDefinitionID and button:GetDefinitionID() or nil, tooltip) | ||
end | ||
end | ||
|
||
function Module:OnTalentTooltipCreated(button, tooltip) | ||
if not self.enabled or not self.db.talentTooltip.enabled then return end | ||
local settings = self.db.talentTooltip | ||
if settings.nodeId then | ||
self:AddItemToTooltip('NodeId', button.GetNodeID and button:GetNodeID() or button:GetNodeInfo().ID, tooltip) | ||
end | ||
self:AddGenericTraitButtonTooltips(button, tooltip, settings) | ||
end | ||
|
||
function Module:OnProfessionPerkEntered(perkId) | ||
if not self.enabled or not self.db.professionTooltip.enabled then return end | ||
|
||
local tooltip = GameTooltip | ||
if not tooltip:IsShown() then return end | ||
local button = tooltip:GetOwner() | ||
if not button or button.perkID ~= perkId then return end | ||
|
||
local settings = self.db.professionTooltip | ||
if settings.nodeId then | ||
self:AddItemToTooltip('Perk NodeId', perkId, tooltip) | ||
end | ||
self:AddGenericTraitButtonTooltips(button, tooltip, settings) | ||
end | ||
|
||
function Module:OnProfessionPathEntered(nodeId) | ||
if not self.enabled or not self.db.professionTooltip.enabled then return end | ||
|
||
local tooltip = GameTooltip | ||
if not tooltip:IsShown() then return end | ||
local button = tooltip:GetOwner() | ||
if not button or not button.nodeInfo or button.nodeInfo.ID ~= nodeId then return end | ||
|
||
local settings = self.db.professionTooltip | ||
if settings.nodeId then | ||
self:AddItemToTooltip('Path NodeId', nodeId, tooltip) | ||
end | ||
self:AddGenericTraitButtonTooltips(button, tooltip, settings) | ||
end |