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:
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
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.