Search added to options panel
This commit is contained in:
+100
-7
@@ -16,6 +16,16 @@ local loadstring = loadstring --> lua local
|
||||
|
||||
local IS_WOW_PROJECT_MAINLINE = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
|
||||
local IS_WOW_PROJECT_NOT_MAINLINE = WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE
|
||||
local IS_WOW_PROJECT_CLASSIC_ERA = WOW_PROJECT_ID == WOW_PROJECT_CLASSIC
|
||||
local IS_WOW_PROJECT_CLASSIC_TBC = WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC
|
||||
|
||||
local UnitCastingInfo = UnitCastingInfo
|
||||
local UnitChannelInfo = UnitChannelInfo
|
||||
|
||||
if IS_WOW_PROJECT_CLASSIC_ERA then
|
||||
UnitCastingInfo = CastingInfo
|
||||
UnitChannelInfo = ChannelInfo
|
||||
end
|
||||
|
||||
local PixelUtil = PixelUtil or DFPixelUtil
|
||||
|
||||
@@ -7233,7 +7243,7 @@ DF.StatusBarFunctions = {
|
||||
{"UNIT_HEALTH", true},
|
||||
{"UNIT_MAXHEALTH", true},
|
||||
{(IS_WOW_PROJECT_NOT_MAINLINE) and "UNIT_HEALTH_FREQUENT", true}, -- this one is classic-only...
|
||||
{(IS_WOW_PROJECT_MAINLINE) and "UNIT_HEAL_PREDICTION", true},
|
||||
{"UNIT_HEAL_PREDICTION", true},
|
||||
{(IS_WOW_PROJECT_MAINLINE) and "UNIT_ABSORB_AMOUNT_CHANGED", true},
|
||||
{(IS_WOW_PROJECT_MAINLINE) and "UNIT_HEAL_ABSORB_AMOUNT_CHANGED", true},
|
||||
}
|
||||
@@ -7264,8 +7274,8 @@ DF.StatusBarFunctions = {
|
||||
|
||||
--> check for settings and update some events
|
||||
if (not self.Settings.ShowHealingPrediction) then
|
||||
self:UnregisterEvent ("UNIT_HEAL_PREDICTION")
|
||||
if IS_WOW_PROJECT_MAINLINE then
|
||||
self:UnregisterEvent ("UNIT_HEAL_PREDICTION")
|
||||
self:UnregisterEvent ("UNIT_HEAL_ABSORB_AMOUNT_CHANGED")
|
||||
end
|
||||
self.incomingHealIndicator:Hide()
|
||||
@@ -7365,7 +7375,6 @@ DF.StatusBarFunctions = {
|
||||
|
||||
--health and absorbs prediction
|
||||
healthBarMetaFunctions.UpdateHealPrediction = function (self)
|
||||
if IS_WOW_PROJECT_NOT_MAINLINE then return end
|
||||
local currentHealth = self.currentHealth
|
||||
local currentHealthMax = self.currentHealthMax
|
||||
local healthPercent = currentHealth / currentHealthMax
|
||||
@@ -7381,7 +7390,7 @@ DF.StatusBarFunctions = {
|
||||
--incoming heal on the unit from all sources
|
||||
local unitHealIncoming = self.displayedUnit and UnitGetIncomingHeals (self.displayedUnit) or 0
|
||||
--heal absorbs
|
||||
local unitHealAbsorb = self.displayedUnit and UnitGetTotalHealAbsorbs (self.displayedUnit) or 0
|
||||
local unitHealAbsorb = IS_WOW_PROJECT_MAINLINE and self.displayedUnit and UnitGetTotalHealAbsorbs (self.displayedUnit) or 0
|
||||
|
||||
if (unitHealIncoming > 0) then
|
||||
--calculate what is the percent of health incoming based on the max health the player has
|
||||
@@ -7405,7 +7414,7 @@ DF.StatusBarFunctions = {
|
||||
end
|
||||
end
|
||||
|
||||
if (self.Settings.ShowShields) then
|
||||
if (self.Settings.ShowShields and IS_WOW_PROJECT_MAINLINE) then
|
||||
--damage absorbs
|
||||
local unitDamageAbsorb = self.displayedUnit and UnitGetTotalAbsorbs (self.displayedUnit) or 0
|
||||
|
||||
@@ -8360,7 +8369,7 @@ DF.CastFrameFunctions = {
|
||||
|
||||
UpdateCastingInfo = function (self, unit)
|
||||
local name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible, spellID
|
||||
if IS_WOW_PROJECT_MAINLINE then
|
||||
if not IS_WOW_PROJECT_CLASSIC_TBC then
|
||||
name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible, spellID = UnitCastingInfo (unit)
|
||||
else
|
||||
name, text, texture, startTime, endTime, isTradeSkill, castID, spellID = UnitCastingInfo (unit)
|
||||
@@ -8428,7 +8437,7 @@ DF.CastFrameFunctions = {
|
||||
|
||||
UpdateChannelInfo = function (self, unit, ...)
|
||||
local name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID
|
||||
if IS_WOW_PROJECT_MAINLINE then
|
||||
if not IS_WOW_PROJECT_CLASSIC_TBC then
|
||||
name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID = UnitChannelInfo (unit)
|
||||
else
|
||||
name, text, texture, startTime, endTime, isTradeSkill, spellID = UnitChannelInfo (unit)
|
||||
@@ -8651,6 +8660,90 @@ DF.CastFrameFunctions = {
|
||||
|
||||
}
|
||||
|
||||
-- for classic era use LibClassicCasterino:
|
||||
local LibCC = LibStub ("LibClassicCasterino", true)
|
||||
if IS_WOW_PROJECT_CLASSIC_ERA and LibCC then
|
||||
local fCast = CreateFrame("frame")
|
||||
|
||||
local getCastBar = function (unitId)
|
||||
local plateFrame = C_NamePlate.GetNamePlateForUnit (unitId)
|
||||
if (not plateFrame) then
|
||||
return
|
||||
end
|
||||
|
||||
local castBar = plateFrame.unitFrame and plateFrame.unitFrame.castBar
|
||||
if (not castBar) then
|
||||
return
|
||||
end
|
||||
|
||||
return castBar
|
||||
end
|
||||
|
||||
local triggerCastEvent = function (castBar, event, unitId, ...)
|
||||
if (castBar and castBar.OnEvent) then
|
||||
castBar.OnEvent (castBar, event, unitId)
|
||||
end
|
||||
end
|
||||
|
||||
local funcCast = function (event, unitId, ...)
|
||||
local castBar = getCastBar (unitId)
|
||||
if (castBar) then
|
||||
triggerCastEvent (castBar, event, unitId)
|
||||
end
|
||||
end
|
||||
|
||||
fCast.UNIT_SPELLCAST_START = function (self, event, unitId, ...)
|
||||
triggerCastEvent (getCastBar (unitId), event, unitId)
|
||||
end
|
||||
|
||||
fCast.UNIT_SPELLCAST_STOP = function (self, event, unitId, ...)
|
||||
triggerCastEvent (getCastBar (unitId), event, unitId)
|
||||
end
|
||||
|
||||
fCast.UNIT_SPELLCAST_DELAYED = function (self, event, unitId, ...)
|
||||
triggerCastEvent (getCastBar (unitId), event, unitId)
|
||||
end
|
||||
|
||||
fCast.UNIT_SPELLCAST_FAILED = function (self, event, unitId, ...)
|
||||
triggerCastEvent (getCastBar (unitId), event, unitId)
|
||||
end
|
||||
|
||||
fCast.UNIT_SPELLCAST_INTERRUPTED = function (self, event, unitId, ...)
|
||||
triggerCastEvent (getCastBar (unitId), event, unitId)
|
||||
end
|
||||
|
||||
fCast.UNIT_SPELLCAST_CHANNEL_START = function (self, event, unitId, ...)
|
||||
triggerCastEvent (getCastBar (unitId), event, unitId)
|
||||
end
|
||||
|
||||
fCast.UNIT_SPELLCAST_CHANNEL_UPDATE = function (self, event, unitId, ...)
|
||||
triggerCastEvent (getCastBar (unitId), event, unitId)
|
||||
end
|
||||
|
||||
fCast.UNIT_SPELLCAST_CHANNEL_STOP = function (self, event, unitId, ...)
|
||||
triggerCastEvent (getCastBar (unitId), event, unitId)
|
||||
end
|
||||
|
||||
if LibCC then
|
||||
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_START", funcCast)
|
||||
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_DELAYED", funcCast) -- only for player
|
||||
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_STOP", funcCast)
|
||||
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_FAILED", funcCast)
|
||||
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_INTERRUPTED", funcCast)
|
||||
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_CHANNEL_START", funcCast)
|
||||
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_CHANNEL_UPDATE", funcCast) -- only for player
|
||||
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_CHANNEL_STOP", funcCast)
|
||||
|
||||
UnitCastingInfo = function(unit)
|
||||
return LibCC:UnitCastingInfo (unit)
|
||||
end
|
||||
|
||||
UnitChannelInfo = function(unit)
|
||||
return LibCC:UnitChannelInfo (unit)
|
||||
end
|
||||
end
|
||||
end -- end classic era
|
||||
|
||||
-- ~castbar
|
||||
|
||||
function DF:CreateCastBar (parent, name, settingsOverride)
|
||||
|
||||
Reference in New Issue
Block a user