api/Utils
PitBull4.Utils.BetterUnitClassification(unit)
Return the unit classification of the given unit.
This acts like UnitClassification(unit), but returns "worldboss" for bosses that match LibBossIDs-1.0
Parameters
- unit
- The unit to check the classification of.
Return value
one of "worldboss", "elite", "rareelite", "rare", "normal", "trivial", or "minus"
PitBull4.Utils.ConvertMethodToFunction(namespace, func_name)
Leave a function as-is or if a string is passed in, convert it to a namespace-method function call.
Parameters
- namespace
- a table with the method func_name on it
- func_name
- a function (which would then just return) or a string, which is the name of the method.
Return value
a function
Usage
PitBull4.Utils.ConvertMethodToFunction({}, function(value) return value end)("blah") == "blah"
PitBull4.Utils.ConvertMethodToFunction({ method = function(self, value) return value end }, "method")("blah") == "blah"
PitBull4.Utils.GetBestUnitID(unit)
Return the best UnitID for the UnitID provided
Parameters
- unit
- the known UnitID
Return value
the best UnitID. If the ID is invalid, it will return false
Usage
PitBull4.Utils.GetBestUnitID("playerpet") == "pet"
PitBull4.Utils.GetLocalizedClassification(classification)
Return a localized form of the unit classification.
Parameters
- classification
- a unit classification, e.g. "player", "party", "partypet"
Return value
a localized string of the unit classification
Usage
PitBull4.Utils.GetLocalizedClassification("player") == "Player"
PitBull4.Utils.GetLocalizedClassification("target") == "Player's target"
PitBull4.Utils.GetLocalizedClassification("partypettarget") == "Party pet targets"
PitBull4.Utils.GetMobIDFromGuid(guid)
Return the Mob ID of the given GUID.
It doesn't matter if the guid starts with "0x" or not.
This will only work for NPCs, not other types of guids, such as players.
Parameters
- guid
Usage
PitBull4.Utils.GetMobIDFromGuid("0xF13000046514911F") == 1125
PitBull4.Utils.GetMobIDFromGuid("F13000046514911F") == 1125
PitBull4.Utils.IsSingletonUnitID(unit)
Return whether the UnitID provided is a singleton
Parameters
- unit
- the UnitID to check
Return value
whether it is a singleton
Usage
PitBull4.Utils.IsSingletonUnitID("player") == true
PitBull4.Utils.IsSingletonUnitID("party1") == false
PitBull4.Utils.IsValidClassification(unit, classification)
Return whether the classification is valid
Parameters
- unit
- classification
- the classification to check
Return value
whether it is a a valid classification
Usage
PitBull4.Utils.IsValidClassification("player") == true
PitBull4.Utils.IsValidClassification("party") == true
PitBull4.Utils.IsValidClassification("partytarget") == true
PitBull4.Utils.IsValidClassification("partypettarget") == true
PitBull4.Utils.IsValidClassification("party1") == false
PitBull4.Utils.IsWackyUnitGroup(classification)
Return whether the classification provided is considered "wacky"
Parameters
- classification
- the classification in question
Return value
whether it is wacky
Usage
assert(not PitBull4.Utils.IsWackyUnitGroup("player"))
assert(PitBull4.Utils.IsWackyUnitGroup("targettarget"))
assert(PitBull4.Utils.IsWackyUnitGroup("partytarget"))
Comments