Skip to content

Commit dc40b4f

Browse files
committed
Add NPC ID and spell Texture
1 parent 90d3fd1 commit dc40b4f

1 file changed

Lines changed: 120 additions & 10 deletions

File tree

Core.lua

Lines changed: 120 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,14 @@ local charDefaults = {
3737
enableSoulbindID = true,
3838
enableSoulbindBaseDPS = true,
3939
enableSoulbindBestDPS = true,
40+
enableSoulbindDPSOnUI = true,
4041
enableConduitID = true,
4142
enableConduitSpellID = true,
4243
enableConduitRank = true,
43-
enableConduitDPS = true
44+
enableConduitDPS = true,
45+
enableConduitDPSOnUI = true,
46+
enableNPCID = true,
47+
enableTextureID = false,
4448
}
4549
local profileDefaults = {
4650
trinket = {},
@@ -65,7 +69,9 @@ local UIElements={
6569
enablecheckbox,
6670
useOnUIChechbox,
6771
colorpicker,
68-
talentStrings={}
72+
talentStrings={},
73+
conduitStrings={},
74+
soulbindStrings={}
6975
}
7076
local UIParameters={
7177
--Consts
@@ -81,6 +87,9 @@ local UIParameters={
8187

8288
MAX_TALENT_ROW = 7,
8389
MAX_TALENT_PER_ROW = 3,
90+
91+
MAX_SOULBIND_ROW = 7,
92+
MAX_SOULBIND_PER_ROW = 3,
8493

8594
detailsLoaded=false,
8695
detailsDrawn=false,
@@ -98,6 +107,8 @@ local UIParameters={
98107
[5] = "legendary"
99108
},
100109
talentOnUILoaded=false,
110+
conduitOnUILoaded=false,
111+
soulbindOnUILoaded=false,
101112
}
102113

103114
local f = CreateFrame("Frame")
@@ -452,9 +463,10 @@ function MoreTooltipInfo.ItemDPSTooltip(destination, itemLink, itemID, personnal
452463
InfoType = "legendary"
453464
local itemSplit = MoreTooltipInfo.GetItemSplit(itemLink)
454465
local bonusIDs = MoreTooltipInfo.GetItemBonusID(itemSplit)
455-
466+
if not bonusIDs then return end
456467
if profiles[InfoType][classID] == nil then return end
457468
if profiles[InfoType][classID][specID] == nil then return end
469+
458470
for i, v in pairs(profiles[InfoType][classID][specID]) do
459471
if v["enable"] and v["data"] then
460472
for j, w in ipairs({strsplit("/", bonusIDs)}) do
@@ -771,20 +783,36 @@ function MoreTooltipInfo.SpellTooltipOverride(option, self, ...)
771783
if cfg.enableConduitDPS then MoreTooltipInfo.SpellDPSTooltip(self, spellID, option, conduitRank) end
772784
end
773785
MoreTooltipInfo.SpellDPSTooltip(self, spellID, "soulbind")
774-
786+
if cfg.enableTextureID then
787+
local spellTexture = GetSpellTexture(spellID)
788+
if spellTexture then MoreTooltipInfo.TooltipLine(self, spellTexture, "TextureID") end
789+
end
775790
if talentID > 0 then
776791
if cfg.enableSpellTalentID then MoreTooltipInfo.TooltipLine(self, talentID, "TalentID") end
777792
MoreTooltipInfo.SpellDPSTooltip(self, spellID, option)
778793
end
779794
end
780795
end
781796

797+
function MoreTooltipInfo.UnitTooltipOverride(self)
798+
if cfg.enableNPCID then
799+
local unit = select(2, self:GetUnit())
800+
if unit then
801+
local guid = UnitGUID(unit) or ""
802+
local id = tonumber(guid:match("-(%d+)-%x+$"), 10)
803+
if id and guid:match("%a+") ~= "Player" then MoreTooltipInfo.TooltipLine(self, id, "NPC ID") end
804+
end
805+
end
806+
end
807+
782808
function MoreTooltipInfo.ManageTooltips(tooltipType, option, ...)
783809
--print(tooltipType, option)
784810
if tooltipType =="spell" then
785811
MoreTooltipInfo.SpellTooltipOverride(option, ...)
786812
elseif tooltipType =="item" then
787813
MoreTooltipInfo.ItemTooltipOverride(...)
814+
elseif tooltipType =="unit" then
815+
MoreTooltipInfo.UnitTooltipOverride(...)
788816
end
789817
end
790818

@@ -1117,9 +1145,9 @@ function OpenProfileUI()
11171145
end)
11181146
UIElements.detailsGroup:AddChild(UIElements.enablecheckbox)
11191147

1120-
if UIParameters.availableOption[UIParameters.currentTypeIndex] == "talent" then
1148+
if UIParameters.availableOption[UIParameters.currentTypeIndex] == "talent" or UIParameters.availableOption[UIParameters.currentTypeIndex] == "conduit" or UIParameters.availableOption[UIParameters.currentTypeIndex] == "soulbind" then
11211149
UIElements.useOnUIChechbox = AGUI:Create("CheckBox")
1122-
UIElements.useOnUIChechbox:SetLabel("Show in the talent UI")
1150+
UIElements.useOnUIChechbox:SetLabel("Show in the " .. UIParameters.availableOption[UIParameters.currentTypeIndex] .. " UI")
11231151
UIElements.useOnUIChechbox:SetRelativeWidth(1)
11241152
UIElements.useOnUIChechbox:SetCallback("OnValueChanged", function(widget)
11251153
if profiles[UIParameters.currentType][UIParameters.currentClassID][UIParameters.currentSpecID][UIParameters.currentProfile]["useOnUI"] then
@@ -1203,6 +1231,12 @@ function f:CreateOptions()
12031231
width = "full",
12041232
order = 2,
12051233
},
1234+
enableTextureID = {
1235+
type = "toggle",
1236+
name = NORMAL_FONT_COLOR_CODE .. "Enable texture ID" .. FONT_COLOR_CODE_CLOSE,
1237+
width = "full",
1238+
order = 3,
1239+
},
12061240
},
12071241
},
12081242
gItem = {
@@ -1314,6 +1348,20 @@ function f:CreateOptions()
13141348
order = 2,
13151349
},
13161350
},
1351+
},
1352+
gOther = {
1353+
type = "group",
1354+
name = "Other",
1355+
inline = true,
1356+
order = 5,
1357+
args = {
1358+
enableNPCID = {
1359+
type = "toggle",
1360+
name = NORMAL_FONT_COLOR_CODE .. "Enable NPCID" .. FONT_COLOR_CODE_CLOSE,
1361+
width = "full",
1362+
order = 0,
1363+
},
1364+
},
13171365
},
13181366
},
13191367
}
@@ -1440,6 +1488,8 @@ ItemRefShoppingTooltip1:HookScript("OnTooltipSetItem", function (...) MoreToolti
14401488
ItemRefShoppingTooltip2:HookScript("OnTooltipSetItem", function (...) MoreTooltipInfo.ManageTooltips("item", nil, ...) end)
14411489
ShoppingTooltip1:HookScript("OnTooltipSetItem", function (...) MoreTooltipInfo.ManageTooltips("item", nil, ...) end)
14421490
ShoppingTooltip2:HookScript("OnTooltipSetItem", function (...) MoreTooltipInfo.ManageTooltips("item", nil, ...) end)
1491+
1492+
--NPC
14431493
GameTooltip:HookScript("OnTooltipSetUnit", function(...) MoreTooltipInfo.ManageTooltips("unit", nil, ...) end)
14441494

14451495
function createFontString(parent,text,textType)
@@ -1538,12 +1588,65 @@ function HideTalentOverlay()
15381588
end
15391589
end
15401590
end
1591+
function DrawConduitDPSOnUI()
1592+
if (not _G.PlayerTalentFrameSpecialization:IsShown()) then
1593+
--print("enter")
1594+
1595+
if UIParameters.conduitOnUILoaded then
1596+
local curentTalent
1597+
--print("show")
1598+
for i=1, UIParameters.MAX_TALENT_ROW do
1599+
1600+
end
1601+
else
1602+
--print("load")
1603+
local classID = MoreTooltipInfo.GetClassID()
1604+
local specID = MoreTooltipInfo.GetSpecID()
1605+
local data = {}
1606+
1607+
if profiles["conduit"][classID] == nil then return end
1608+
if profiles["conduit"][classID][specID] == nil then return end
1609+
for i, v in pairs(profiles["conduit"][classID][specID]) do
1610+
if v["enable"] and v["useOnUI"] then
1611+
data = v["data"]
1612+
end
1613+
end
1614+
1615+
local p, curentTalent, currentFrame, spellID, dps
1616+
for i=1, UIParameters.MAX_TALENT_ROW do
1617+
for j=1, UIParameters.MAX_TALENT_PER_ROW do
1618+
curentTalent = ""..i..j
1619+
currentFrame = "PlayerTalentFrameTalentsTalentRow"..i.."Talent"..j
1620+
1621+
_, _, _, _, _, spellID = GetTalentInfoByID(_G[currentFrame]:GetID())
1622+
1623+
p = _G[currentFrame]
1624+
UIElements.talentStrings[curentTalent] = {}
1625+
if data and data[spellID] and data[spellID]["Base"] then
1626+
dps = MoreTooltipInfo.FormatSpace(data[spellID]["Base"])
1627+
UIElements.talentStrings[curentTalent]["Base"] = createFontString(p,dps,"talentBase")
1628+
end
1629+
if data and data[spellID] and data[spellID]["Best"] then
1630+
dps = MoreTooltipInfo.FormatSpace(data[spellID]["Best"])
1631+
UIElements.talentStrings[curentTalent]["Best"] = createFontString(p,dps,"talentBest")
1632+
end
1633+
end
1634+
end
1635+
1636+
UIParameters.talentOnUILoaded = true
1637+
end
1638+
end
1639+
end
1640+
function HideConduitOverlay()
1641+
local curentConduit
1642+
1643+
end
15411644

15421645
---------------------
15431646
--Events management -
15441647
---------------------
15451648
function f:ADDON_LOADED(event, addon)
1546-
if addon == addonName then
1649+
if addon == addonName then --load settings
15471650
MoreTooltipInfoVars = MoreTooltipInfo:initDB(MoreTooltipInfoVars, dbDefaults)
15481651
db = MoreTooltipInfoVars
15491652
local playerName = UnitName("player")
@@ -1556,11 +1659,18 @@ function f:ADDON_LOADED(event, addon)
15561659
self:CreateOptions()
15571660
elseif addon == "Blizzard_TalentUI" then
15581661
--print("Talent loaded")
1559-
_G.PlayerTalentFrameTalents.PvpTalentButton:HookScript("OnShow", function() if cfg.enableConduitID then DrawTalentDPSOnUI() end end)
1560-
_G.PlayerTalentFrameTalents.PvpTalentButton:HookScript("OnHide", function() if cfg.enableConduitID then HideTalentOverlay() end end)
1662+
if cfg.enableTalentDPSOnUI then
1663+
_G.PlayerTalentFrameTalents.PvpTalentButton:HookScript("OnShow", function() if cfg.enableConduitID then DrawTalentDPSOnUI() end end)
1664+
_G.PlayerTalentFrameTalents.PvpTalentButton:HookScript("OnHide", function() if cfg.enableConduitID then HideTalentOverlay() end end)
1665+
end
15611666
elseif addon == "Blizzard_Soulbinds" then
15621667
--print("Soulbind loaded")
1563-
_G.SoulbindViewer.ConduitList.ScrollBox:HookScript("OnShow", function() testHook2("1") end)
1668+
if cfg.enableConduitDPSOnUI then
1669+
_G.SoulbindViewer.ConduitList.ScrollBox:HookScript("OnShow", function() testHook2("1") end)
1670+
end
1671+
if cfg.enableSoulbindDPSOnUI then
1672+
--_G.SoulbindViewer.ConduitList.ScrollBox:HookScript("OnShow", function() testHook2("1") end)
1673+
end
15641674
end
15651675
end
15661676

0 commit comments

Comments
 (0)