View Single Post
10-17-20, 10:04 AM   #5
DahkCeles
A Cliff Giant
 
DahkCeles's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2020
Posts: 73
In that case, you might be able to get away with just using spellID 190356. I'm not sure if this corresponds to any particular ranks or classic vs retail... this is just grabbing it off wowpedia really fast.

The script below loads the spell data, and once the data is available it then creates a font string and scripts it to update any time your mana changes.

Lua Code:
  1. local spell = CreateSpellFromSpellID(190356)
  2. spell:ContinueOnSpellLoad(function()
  3.   local maxCost = GetSpellPowerCost(190356)[1].cost
  4.   local f = CreateFrame("Frame")
  5.   f:SetPoint("CENTER")
  6.   f:SetSize(25,25)
  7.   local fs = f:CreateFontString(nil, "ARTWORK")
  8.   fs:SetAllPoints()
  9.   f:RegisterUnitEvent("UNIT_POWER_UPDATE", "player")
  10.   f:SetScript("OnEvent", function()
  11.     if (manaCost) then
  12.       fs:SetText(string.format("%d", UnitPower("player", 0)/maxCost))
  13.     end
  14.   end)
  15. end)

Edit: disclaimer, I'm not a frost mage and I haven't tested this code.
  Reply With Quote