Quantcast Wild Mushroom aura for time left till expires - WoWInterface
Thread Tools Display Modes
03-23-15, 01:19 PM   #1
Quingar
A Deviate Faerie Dragon
Join Date: Apr 2011
Posts: 13
Wild Mushroom aura for time left till expires

Hello guys,
I want to ask you if there is possiblity to make in RealUI auras an info about Wild Mushroom timer. Right now there is only info about how many percent it has accumulated from renew overhealing.
But I want to see how much time it has left till the spell expires.
Is it possible to do it somehow ?

Thank you very much
Btw I really love RealUI
  Reply With Quote
03-24-15, 06:17 AM   #2
Quingar
A Deviate Faerie Dragon
Join Date: Apr 2011
Posts: 13
Hmm I was looking to the code which is there by default for Wild Mushrooms to see that overhaling done from Rejuv.
But I want to ask why is there 300 in those lines. I think there should be 30 not 300 right ?
Really would love to use realUI auras for this tracking of duration of Wild Mushrooms. Or else I will be forced to use weak auras

Code:
local nibRealUI = LibStub("AceAddon-3.0"):GetAddon("nibRealUI")

local _
local MODNAME = "AuraTracking_WildMushrooms"
local WildMushrooms = nibRealUI:NewModule(MODNAME, "AceEvent-3.0")

local AuraTracking = nibRealUI:GetModule("AuraTracking")

-- local ShroomID = 88747	-- Wild Mushrooms
local ShroomDuration = 300
local ShroomID = 145205	-- Wild Mushrooms
local ShroomName = ""
local BloomID = 102791	-- Wild Mushrooms: Bloom
local RejuvID = 774		-- Rejuvenation
local MaxHealthPercent = 2
local OverHealPercent = 1
local MinLevel = 84

local function GetMushroomTime()
	local time = 0
	local currentTime = GetTotemTimeLeft(1)
	if ( currentTime > 0 ) then
		time = currentTime
	else
		time = nil
	end
	return time
end

local function AuraUpdate(self)
	if self.inactive then return end

	-- Update Info
	if not(ShroomName) or not(self.texture) then
		local name,_,icon = GetSpellInfo(ShroomID)
		ShroomName = name
		self.activeSpellName = name
		self.texture = icon
		self.icon:SetTexture(icon)
	end

	-- Update Frame
	local shroomTime = GetMushroomTime()
	if shroomTime and self.AreShroomsDown then
		self.isActive = true
		
		-- Set Icon Desaturated
		self.icon:SetDesaturated(nil)

		-- Cooldown
		-- self.cd:SetCooldown(GetTime() - (300 - shroomTime), 300)
		-- self.cd:Show()
		-- self.count:SetParent(self.cd)

		-- Absorb
		if self.CurrentOverheal and (self.CurrentOverheal > 0) then
			if self.MaxOverheal > 0 then
				local per = self.CurrentOverheal / self.MaxOverheal
				-- local per = nibRealUI:Clamp(self.CurrentOverheal / self.MaxOverheal, 0, 1)
				self.count:SetFormattedText("%d.", per * 100)
				self.count:SetTextColor(nibRealUI:GetDurabilityColor(per))
			else
				self.count:SetText("100.")
				self.count:SetTextColor(nibRealUI:GetDurabilityColor(1))
			end
		else
			self.count:SetText("")
		end

		-- Show frame
		self:Show()
		if not self.isStatic then
			AuraTracking:FreeIndicatorUpdate(self, true)
		end
	else
		self.isActive = false
		if self.isStatic then
			self.icon:SetDesaturated(1)
		end

		-- self.cd:Hide()
		-- self.count:SetParent(self)
		self.count:SetText("")

		-- Hide frame
		if not self.isStatic then
			self:Hide()
			AuraTracking:FreeIndicatorUpdate(self, false)
		end
	end

	if self.isStatic then
		AuraTracking:StaticIndicatorUpdate(self)
	end
end
  Reply With Quote
03-24-15, 01:12 PM   #3
Gethe
RealUI Developer
 
Gethe's Avatar
Premium Member
Featured
Join Date: Sep 2008
Posts: 926
Replace the AuraUpdate and TotemUpdate functions with this:
Lua Code:
  1. local function AuraUpdate(self)
  2.     if self.inactive then return end
  3.  
  4.     -- Update Info
  5.     if not(ShroomName) or not(self.texture) then
  6.         local name,_,icon = GetSpellInfo(ShroomID)
  7.         ShroomName = name
  8.         self.activeSpellName = name
  9.         self.texture = icon
  10.         self.icon:SetTexture(icon)
  11.     end
  12.  
  13.     -- Update Frame
  14.     local haveTotem, _, startTime, duration = GetTotemInfo(1)
  15.     if haveTotem and self.AreShroomsDown then
  16.         self.isActive = true
  17.  
  18.         -- Set Icon Desaturated
  19.         self.icon:SetDesaturated(nil)
  20.  
  21.         -- Cooldown
  22.         self.cd:SetCooldown(startTime, duration)
  23.         self.cd:Show()
  24.         self.count:SetParent(self.cd)
  25.  
  26.         -- Absorb
  27.         if self.CurrentOverheal and (self.CurrentOverheal > 0) then
  28.             if self.MaxOverheal > 0 then
  29.                 local per = self.CurrentOverheal / self.MaxOverheal
  30.                 -- local per = nibRealUI:Clamp(self.CurrentOverheal / self.MaxOverheal, 0, 1)
  31.                 self.count:SetFormattedText("%d.", per * 100)
  32.                 self.count:SetTextColor(nibRealUI:GetDurabilityColor(per))
  33.             else
  34.                 self.count:SetText("100.")
  35.                 self.count:SetTextColor(nibRealUI:GetDurabilityColor(1))
  36.             end
  37.         else
  38.             self.count:SetText("")
  39.         end
  40.  
  41.         -- Show frame
  42.         self:Show()
  43.         if not self.isStatic then
  44.             AuraTracking:FreeIndicatorUpdate(self, true)
  45.         end
  46.     else
  47.         self.isActive = false
  48.         if self.isStatic then
  49.             self.icon:SetDesaturated(1)
  50.         end
  51.  
  52.         self.cd:Hide()
  53.         self.count:SetParent(self)
  54.         self.count:SetText("")
  55.  
  56.         -- Hide frame
  57.         if not self.isStatic then
  58.             self:Hide()
  59.             AuraTracking:FreeIndicatorUpdate(self, false)
  60.         end
  61.     end
  62.  
  63.     if self.isStatic then
  64.         AuraTracking:StaticIndicatorUpdate(self)
  65.     end
  66. end
  67.  
  68. -- Totem update
  69. -- Reset
  70. local function TotemUpdate(self)
  71.     local haveTotem = GetTotemInfo(1)
  72.     if not haveTotem then
  73.         self.CurrentOverheal = 0
  74.         self.AreShroomsDown = false
  75.     else
  76.         self.AreShroomsDown = true
  77.     end
  78.     AuraUpdate(self)
  79. end

I don't have a druid to test this with, so let me know if there are issues with it.
__________________
Knowledge = Power; Be OP

  Reply With Quote
03-24-15, 02:59 PM   #4
Quingar
A Deviate Faerie Dragon
Join Date: Apr 2011
Posts: 13
Great it is working
Thank you very very much
  Reply With Quote

WoWInterface » Featured Projects » RealUI » Wild Mushroom aura for time left till expires

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off