Quantcast
Download
(5 Kb)
Download
Updated: 07/22/18 02:41 PM
Compatibility:
Wolfhunter (4.1)
Summerset (4.0)
Updated:07/22/18 02:41 PM
Created:07/22/18 02:41 PM
Monthly downloads:80
Total downloads:84
Favorites:0
MD5:
4.1
LibPotionBuff
Version: 1.0
by: Baertram [More]
For Players
This Library is only for use by Add-on Developers

For Developers
This Library includes a list of all current potion buffs along with their type (non-crafted, crafted, from crown store).
It includes functions to get information about group member's and/or player potion statuses.
The Library can be used by itself or packaged in an Add-on without the standalone.lua file.

Code:
Structure
LibPotionBuff
|_LibPotionBuff.txt
|_LibPotionBuff.lua
|_LibStub
| |_LibStub.lua
If you want to package LibPotionBuff with your addon, you only need to use the file LibPotionBuff.lua inside your addon, without the .txt file!
Depends on: Your addon needs to use LibStub!

Functions
You need to create an instance of this library via LibStub like this:
Lua Code:
  1. --libPotionBuff
  2. local lib = LibStub:GetLibrary("LibPotionBuff")
Use the variable lib to call the following functions then:


Lua Code:
  1. function lib:GetTimeLeftInSeconds(timeInMilliseconds)
  2. Parameter: number timeInMilliseconds - any number in milliseconds
  3. Returns: time in seconds rounded up

Lua Code:
  1. function lib:GetPotionBuffInfos(unitTag)
  2. --Parameter: string unitTag - any unitTag (http://wiki.esoui.com/UnitTag)
  3. -- Returns: boolean isBuffActive, bool isCrafted, bool isFromCrownStore, number abilityId, string buffName, number timeStarted, number timeEnds, textureString iconTexture

Lua Code:
  1. function lib:IsPotionBuffActive(unitTag)
  2. --Parameter: string unitTag - any unitTag (http://wiki.esoui.com/UnitTag)
  3. -- Returns: bool isBuffActive

Lua Code:
  1. function lib:IsPotionBuffActiveAndGetTimeLeft(unitTag)
  2. --Parameter: string unitTag - any unitTag (http://wiki.esoui.com/UnitTag)
  3. -- Returns: bool isBuffActive, number timeLeftInSeconds , number abilityId

Lua Code:
  1. function lib:GetPotionSlotCooldown(chatOutput)
  2.     -- Parameter:   boolean chatOutput - true = output the info to the chat; false = do not show anyhting into the chat
  3.     -- Returns:     number timeLeftInMilliseconds, number buffTotalCooldownInMilliseconds

Lua Code:
  1. function lib:IsAbilityACraftedPotionBuff(abilityId)
  2. --Parameter: integer abilityId - any abilityId (http://esoitem.uesp.net/viewlog.php?record=minedSkills)
  3. -- Returns: nilable:bool IsAbilityACraftedPotionBuff(true) or false if not, or nil if not any potion buff

Lua Code:
  1. function lib:IsAbilityACrownStorePotionBuff(abilityId)
  2. --Parameter: integer abilityId - any abilityId (http://esoitem.uesp.net/viewlog.php?record=minedSkills)
  3. -- Returns: nilable:bool isAbilityACrownStorePotionBuff(true) or false if not, or nil if not any potion buff

Lua Code:
  1. function lib:IsAbilityAPotionBuff(abilityId)
  2. --Parameter: integer abilityId - any abilityId (http://esoitem.uesp.net/viewlog.php?record=minedSkills)
  3. -- Returns: bool isAbilityAnActivePotionBuff(true) or false if not


To register a callback function to the EVENT_EFFECT_CHANGED event for all the potion abilityIds you can use this function:
Lua Code:
  1. function lib:RegisterAbilityIdsFilterOnEventEffectChanged(addonEventNameSpace, callbackFunc, filterType, filterParameter)
  2. --Parameters:   addonEventNameSpace - prefered to insert your addon name. if you want to call this function twice, make sure the second/third/... addonEventNameSpace has another name. Example `addonName.."_01"`, `addonName.."_02"`
  3. --callbackFunc - any global function you want to run when the event is firing
  4. --filterType - choose any filter type from here: http://wiki.esoui.com/AddFilterForEvent
  5. --filterParameter - choose any filter parameter from here: http://wiki.esoui.com/AddFilterForEvent
To unregister your callback function to the EVENT_EFFECT_CHANGED event for all the potion abilityIds you can use this function:
Lua Code:
  1. function lib:UnRegisterAbilityIdsFilterOnEventEffectChanged()
Optional Files (0)


There have been no comments posted to this file.
Be the first to add one.



Category Jump: