mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-09 07:00:00 +00:00
libhealth: add function to query by name
This commit is contained in:
+13
-1
@@ -64,7 +64,18 @@ local function GetUnitHealth(self, unitstr)
|
||||
if unit and level and max == 100 then
|
||||
dbstring = string.format("%s:%s", unit, level)
|
||||
if mobdb[dbstring] and mobdb[dbstring][1] and mobdb[dbstring][2] > libhealth.reqdmg and mobdb[dbstring][3] > libhealth.reqhit then
|
||||
return ceil(mobdb[dbstring][1]/100*cur), mobdb[dbstring][1]
|
||||
return ceil(mobdb[dbstring][1]/100*cur), mobdb[dbstring][1], true
|
||||
end
|
||||
end
|
||||
|
||||
return cur, max
|
||||
end
|
||||
|
||||
local function GetUnitHealthByName(self, unit, level, cur, max)
|
||||
if max == 100 then
|
||||
dbstring = string.format("%s:%s", unit, (level or 0))
|
||||
if mobdb[dbstring] and mobdb[dbstring][1] and mobdb[dbstring][2] > libhealth.reqdmg and mobdb[dbstring][3] > libhealth.reqhit then
|
||||
return ceil(mobdb[dbstring][1]/100*cur), mobdb[dbstring][1], true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -82,4 +93,5 @@ end
|
||||
-- add api calls to global tree
|
||||
pfUI.libhealth = libhealth
|
||||
pfUI.libhealth.GetUnitHealth = GetUnitHealth
|
||||
pfUI.libhealth.GetUnitHealthByName = GetUnitHealthByName
|
||||
pfUI.libhealth.GetDBHealth = GetDBHealth
|
||||
|
||||
Reference in New Issue
Block a user