Druid Mana Management Block – LitePanels

I believe I have talked about LitePanels in the past, I have just finished off my block to replace Innervator, an addon I used to warn me when to use my Innervate.

The issue I had with it was it was set based on a number and it doesnt scale as you gear up etc etc

Instead I would like to use a percent of mana to be warned. Also I would like it to prompt me when to pop mana pot when that’s available too :)

This block goes hand-in-hand with my Smartervate addon (soon to be updated with some cool new features). The key block data is here for your own use;

 -- mana management
 {
 name = "manamgnt", parent = "BoxL",
 anchor_to="TOP", anchor_from="RIGHT",
 y_off = 200,

 text={
 string=function()

 -- If toon is dead return nil
 if(UnitIsDeadOrGhost("player") == 1) then return nil end

 -- If Smartervate is being used
 if(IsAddOnLoaded("Smartervate")) then
 -- Get Mana Threshold from there
 threshold = Smartervate:GetManaThreshold()
 else
 -- If not 50%
 threshold = 0.5
 end

 -- Options
 gcd = 1.109 -- this may need to be decreased based on GCD changes
 pot = "Crazy Alchemist's Potion"
 sounddelay = 15

 ourUnitClass,  ourUnitEngClass = UnitClass("player");
 if (ourUnitEngClass == 'DRUID') then

 current_time = time{year=date("%Y"), month=date("%m"), day=date("%d"), hour=date("%H"), min=date("%M"), sec=date("%S")}
 if(SoundLocked ~= nil and current_time > SoundLocked) then
 SoundLocked = nil
 end

 if(SmartervateDelay ~= nil and current_time > SmartervateDelay) then
 SmartervateDelay = nil
 end

 -- Get our Max Mana Pool
 local maxmana = UnitManaMax("player")

 -- Get our current mana
 local currentmana = UnitMana("player")

 -- Get our Percentage
 local manaperc = ( currentmana /  maxmana )

 -- Get our Mana Threshhold
 local manathreshhold = tonumber(threshold)

 if ( manaperc < manathreshhold) then

 if (SoundLocked == nil and UnitAffectingCombat("player") == 1) then
 PlaySound("GAMEHIGHLIGHTFRIENDLYUNIT")
 PlaySoundFile("Sound\\Spells\\PVPFlagTaken.wav")
 SoundLocked = current_time + tonumber(sounddelay) -- only play sound every 20 secs
 end

 -- Are we in combat?
 if (UnitAffectingCombat("player") == 1) then

 -- Yes! Check Our Innervate
 local start, duration = GetSpellCooldown("Innervate")
 if ( duration <= gcd ) then

 -- Innervate is available, notice to use it!
 return "|cffffd700Use Your Innervate|r"

 else

 -- OMG Innervate is used! Check Our Pot
 pot_startTime, pot_duration, pot_enable = GetItemCooldown(pot)
 if ( pot_startTime == 0 and pot_duration == 0 ) then

 -- Pot is available, Notice to use it!
 return "|cffffd700Use Your " .. pot .. "|r"

 else

 -- No pot either? Notice to trigger Smartervate!
 return "|cffffd700Use Smartervate!! /smv|r"

 end
 end
 else

 -- Out of combat and below threshhold? have a drink
 return "|cffffd700You're low on mana, have a drinky!|r"

 end

 else
 return nil
 end

 else
 return nil
 end

 end, update = 1,
 size=20, shadow=2, font = "Interface\\AddOns\\ArkInventory\\Fonts\\Emblem.ttf",
 }
 }

Basically the block will put a message and play a sound (when not on CD) and do apply the following logic;

  • Are we Dead? If Yes Stop, If No Continue
  • Is Smartervate Loaded? If Yes Threshold set to addons, if No use 50%
  • Are we a Druid? If No Stop, If Yes Continue
  • Is Mana less than Threshold? If No Stop, If Yes Play Sound (has internal cooldown) & Continue
  • Are we in Combat? If No Message to Drink, If Yes Continue
  • Is Innervate Available? If Yes Message to Use, If No Continue
  • Is Pot Available? If Yes Message to Use, If No Message to use Smartervate

Hope this helps :D

Categories: Uncategorized Tags:
  1. Cyx
    June 4th, 2010 at 11:10 | #1
     

    No blogging for over 2 weeks makes for a bad blogger.

    Unless this is a fiendish plan and you have created a mirror blog somewhere else where I can't comment!

  1. No trackbacks yet.

CommentLuv badge