Download
(9 Kb)
Download
Updated: 05/30/20 04:31 PM
Compatibility:
Ascending Tide (7.3.5)
Deadlands (7.2.5)
Waking Flame (7.1.5)
Blackwood (7.0.5)
Flames of Ambition (6.3.5)
Markarth (6.2.5)
Stonethorn (6.1.5)
Greymoor (6.0.5)
Updated:05/30/20 04:31 PM
Created:05/28/20 06:35 AM
Monthly downloads:1,767
Total downloads:102,980
Favorites:25
MD5:
LibVampire  Popular! (More than 5000 hits)
Version: 1.2
by: Baertram [More]
LibVampire
A simple library to detect if you are a vampire, or not, and return some information about the stage, feed cooldown etc.

Global variable of the library:
Code:
LibVampire

Provides global constants:
Code:
VAMPIRE_STAGE_1 = 1
VAMPIRE_STAGE_2 = 2
VAMPIRE_STAGE_3 = 3
VAMPIRE_STAGE_4 = 4

Provides some vampire skill variables:
Code:
--2020-05-29, maybe changing due to ZOs one day!
lib.vampireSkillsID                     = 51                    --The skillLine ID of the vampire skills in skill type SKILL_TYPE_WORLD
lib.vampireSkillsType                   = SKILL_TYPE_WORLD      --The skillType of the vampire skills (World skills)
lib.vampireSkillLineIndexInWorldSkills  = 5                     --The skill types' SKILL_TYPE_WORLD skill line "Vampire"'s skillIndex. Will be updated at EVENT_ADD_ON_LOADED first so make sure you do not access it BEFORE this event of the lib has fired!

Provides a few functions to return:
-boolean if you are a vampire or not
-table containing information about the current vampire buff (timeStarted, timeEnd, textureName, buffName, buffNameClean without gender stuff like ^m)
-the current vampire stage
-texture name of the vampire stage
-boolean if you own the passive "blood moon" (feed) skill to turn others into children of Lamae Bal
-boolean if you are curently on feed cooldown
-seconds left of the feed cooldown

Chat slash commands
Code:
/vampire
Shows the current vampire texture and stage in the chat and as centers creen announcement message. Easy way to check your current vampire state.
Additional parameters of that slash command can be:
  • cd: show the feed cooldown as chat and center screen announce message
  • debug: change the debug mode of the library

API functions:
Code:
--Register a callback function "funcName" to the stage change of the vampire
--Params:
--> String addOnName: A unique addOn name for the callback registration
--> function callbackFunc: A callback function to be run as the stage changes
--   parameters of the function are all the parameters that the
--   EVENT_EFFECT_CHANGED provides (excluding the eventId as first parameter but instead adding the oldStageId and the newStageId number as first 2 parameters):
--    ( number oldStageId, number newStageId,
--        MsgEffectResult changeType, number effectSlot, string effectName, string unitTag,
--        number beginTime, number endTime, number stackCount, string iconName, string buffType, BuffEffectType effectType,
--        AbilityType abilityType, StatusEffectType statusEffectType, string unitName, number unitId, number abilityId,
--       CombatUnitType sourceType )
--> nilable table onlyCallForTheFollowingEffectChangedTypes: an optional table containing 1 or more MsgEffectResults as key
--   and the boolean true/false as value, e.g.
--     [EFFECT_RESULT_FADED] = true,
--     [EFFECT_RESULT_FULL_REFRESH] = false,
--     [EFFECT_RESULT_GAINED] = true,
--     [EFFECT_RESULT_TRANSFER] = false,
--     [EFFECT_RESULT_UPDATED] = false
--> nilable number oldStage: The old stage needs to be this stageId(1-4) to fire the callback
--> nilable number newStage: The new stage needs to be this stageId(1-4) to fire the callback
--Returns:
-->nilable boolean wasCallbackRegisteredNew: (true = yes; false = no it existed already for the addOnName; nil = Nothing was done or error occured)
function lib.AddStageChangeCallback(addOnName, callbackFunc, onlyCallForTheFollowingEffectChangedTypes, oldStage, newStage)


--Read player buffs and return a table with the vampire buff info
--params:
--> nilable boolean doOverride: Force the update of the buff data instead of taking the last known value from the library internally
--returns:
--> table = {
--      ["playerBuffIndex"] = number indexOfVampireBuffInPlayerBuffs
--      ["abilityId"] = number vampireBuffAbilityId
--      ["buffName"] = string buffName
--      ["buffNameClean"] = string buffName without any gender stuff like ^m etc.
--      ["timeStarted"] = number timeStarted
--      ["timeEnding"] = number timeEnding
--      ["textureName"]= string textureName
--   }
function lib.GetBuffInfo(doOverride)


--Check if we are a vampire and return some values
--params:
--returns:
--> boolean isVampire
--> number vampireStage (1-4)
--> string vampireBuff
--> string vampireBuffTexture
--> table buffInfo (see function lib.GetBuffInfo() return table)
function lib.IsVampire()


--Get the current stage of a vampire
--params:
--> table           buffInfo: Table containing the buffInfo in the following format
--->                buffInfo = { ["buffNameClean"] = "Vampirism stage <number 1-4>" }
--> nilable boolean doOverride: Force the update of the buff data instead of taking the last known value from the library internally
--returns:
--> number (1-4) vampireStage
function lib.GetVampireStage(buffInfo, doOverride)


--Get the texture .dds file of a vampire stage
--params:
--> number vampireStage: The stage of the vampire that the function should return the texture for
--returns:
--> string vampireStageTexturePath
function lib.GetVampireStageTexture(vampireStage)


--Check if the passive Vampire feed skill (to turn others into a Vampire) is given
--params:
--returns:
--> boolean isFeedPassiveBloodRitualGiven
function lib.IsFeedSkillGiven()


--Check if the passive Vampire feed skill (to turn others into a Vampire) is given and if it's on cooldown
--params:
--> nilable boolean doOverride: Force the update of the buff data instead of taking the last known value from the library internally
--returns:
--> boolean isFeedOnCooldown
--> boolean isFeedPassiveGiven
--> number secondsLeft (time the cooldown will be active in seconds)
--> table buffInfo (see function lib.GetBuffInfo() return table)
function lib.IsFeedOnCooldown(doOverride)


--Get the level and XP of the vampire skill line
--params:
--returns:
--> number vampireSkillLineLevel
--> number xpNowOfLevel
--> number xpMaxOfLevel
function lib.GetVampireLevelInfo()
GitHub: https://github.com/Baertram/LibVampire

Thanks to Eldrni for the help and brainstorming.
Version 1.2 (2020-05-31)
-Many improvements in the buff check code
-Added new functions to detect if the feed passive skill is given and if the feed cooldown is active + time left in seconds (see API at description)
-Added possibility to register callback function as the vampire stage changes (see API at description)
-Added slash command parameter cd
-Added slash command parameter debug


Version 1.1 (2020-05-28)
Fixed: Update throttle check prevented the buff update was done at least once every 1 second


Version 1 (2020-05-28)
Initial release
Optional Files (0)


Archived Files (2)
File Name
Version
Size
Uploader
Date
1.1
3kB
Baertram
05/28/20 07:56 AM
1
3kB
Baertram
05/28/20 06:35 AM


Post A Reply Comment Options
Unread 12/11/20, 06:58 AM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4912
File comments: 5990
Uploads: 78
Report comment to moderator  
Reply With Quote
Unread 12/11/20, 05:38 AM  
adran06

Forum posts: 5
File comments: 8
Uploads: 0
Does anything use this yet?

See the subject XD
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump:

Support AddOn Development!

You have just downloaded by the author . If you like this AddOn why not consider supporting the author? This author has set up a donation account. Donations ensure that authors can continue to develop useful tools for everyone.