mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-26 00:40:15 +00:00
feat: enhance spell tooltips with cost, range, cast time, and cooldown
SetSpellByID now shows comprehensive spell information:
- Mana/Rage/Energy/Runic Power cost
- Range in yards (or omitted for self-cast)
- Cast time ("1.5 sec cast" or "Instant")
- Active cooldown remaining in red
Uses existing GetSpellInfo (castTime, range from DBC), GetSpellPowerCost
(mana cost from DBC), and GetSpellCooldown (remaining CD) to populate
the tooltip with real spell data.
This commit is contained in:
parent
22f8b721c7
commit
8d4478b87c
1 changed files with 23 additions and 1 deletions
|
|
@ -5408,10 +5408,32 @@ void LuaEngine::registerCoreAPI() {
|
|||
"function GameTooltip:SetSpellByID(spellId)\n"
|
||||
" self:ClearLines()\n"
|
||||
" if not spellId or spellId == 0 then return end\n"
|
||||
" local name, rank, icon = GetSpellInfo(spellId)\n"
|
||||
" local name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(spellId)\n"
|
||||
" if name then\n"
|
||||
" self:SetText(name, 1, 1, 1)\n"
|
||||
" if rank and rank ~= '' then self:AddLine(rank, 0.5, 0.5, 0.5) end\n"
|
||||
" -- Mana cost\n"
|
||||
" local cost, costType = GetSpellPowerCost(spellId)\n"
|
||||
" if cost and cost > 0 then\n"
|
||||
" local powerNames = {[0]='Mana',[1]='Rage',[2]='Focus',[3]='Energy',[6]='Runic Power'}\n"
|
||||
" self:AddLine(cost..' '..(powerNames[costType] or 'Mana'), 1, 1, 1)\n"
|
||||
" end\n"
|
||||
" -- Range\n"
|
||||
" if maxRange and maxRange > 0 then\n"
|
||||
" self:AddDoubleLine(string.format('%.0f yd range', maxRange), '', 1,1,1, 1,1,1)\n"
|
||||
" end\n"
|
||||
" -- Cast time\n"
|
||||
" if castTime and castTime > 0 then\n"
|
||||
" self:AddDoubleLine(string.format('%.1f sec cast', castTime / 1000), '', 1,1,1, 1,1,1)\n"
|
||||
" else\n"
|
||||
" self:AddDoubleLine('Instant', '', 1,1,1, 1,1,1)\n"
|
||||
" end\n"
|
||||
" -- Cooldown\n"
|
||||
" local start, dur = GetSpellCooldown(spellId)\n"
|
||||
" if dur and dur > 0 then\n"
|
||||
" local rem = start + dur - GetTime()\n"
|
||||
" if rem > 0.1 then self:AddLine(string.format('%.0f sec cooldown', rem), 1, 0, 0) end\n"
|
||||
" end\n"
|
||||
" self.__spellId = spellId\n"
|
||||
" end\n"
|
||||
"end\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue