Search added to options panel

This commit is contained in:
Tercio Jose
2021-10-07 21:49:15 -03:00
parent 1c20f166cb
commit 9e25e245d4
9 changed files with 173 additions and 49 deletions
+32 -18
View File
@@ -1,6 +1,6 @@
local dversion = 275
local dversion = 277
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
@@ -4280,27 +4280,32 @@ end
-----------------------------------------------------------------------------------------------------------------------------------------------------------
--> pool
do
do
local get = function(self)
local object = tremove(self.notUse, #self.notUse)
if (object) then
tinsert(self.inUse, object)
if (self.onAcquire) then
local result, errortext = pcall(self.onAcquire, object)
end
return object, false
else
--need to create the new object
local newObject = self.newObjectFunc(self, unpack(self.payload))
if (newObject) then
tinsert(self.inUse, newObject)
if (self.onAcquire) then
local result, errortext = pcall(self.onAcquire, object)
end
return newObject, true
end
end
end
local get_all_inuse = function(self)
return self.inUse;
end
local release = function(self, object)
for i = #self.inUse, 1, -1 do
if (self.inUse[i] == object) then
@@ -4308,35 +4313,39 @@ do
tinsert(self.notUse, object)
break
end
end
end
end
local reset = function(self)
for i = #self.inUse, 1, -1 do
local object = tremove(self.inUse, i)
tinsert(self.notUse, object)
end
if (self.onReset) then
local result, errortext = pcall(self.onReset, object)
end
end
end
--only hide objects in use, do not disable them
local hide = function(self)
for i = #self.inUse, 1, -1 do
self.inUse[i]:Hide()
end
end
end
--only show objects in use, do not enable them
local show = function(self)
for i = #self.inUse, 1, -1 do
self.inUse[i]:Show()
end
end
end
end
--return the amount of objects
local getamount = function(self)
return #self.notUse + #self.inUse, #self.notUse, #self.inUse
end
local poolMixin = {
Get = get,
GetAllInUse = get_all_inuse,
@@ -4347,25 +4356,30 @@ do
Hide = hide,
Show = show,
GetAmount = getamount,
SetOnReset = function(self, func)
self.onReset = func
end,
SetOnAcquire = function(self, func)
self.onAcquire = func
end,
}
function DF:CreatePool(func, ...)
local t = {}
DetailsFramework:Mixin(t, poolMixin)
t.inUse = {}
t.notUse = {}
t.newObjectFunc = func
t.payload = {...}
return t
end
--alias
function DF:CreateObjectPool(func, ...)
return DF:CreatePool(func, ...)
end
end
+100 -7
View File
@@ -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)
+13 -4
View File
@@ -6,8 +6,8 @@
local version, build, date, tocversion = GetBuildInfo()
_detalhes.build_counter = 8812
_detalhes.alpha_build_counter = 8812 --if this is higher than the regular counter, use it instead
_detalhes.build_counter = 8888
_detalhes.alpha_build_counter = 8888 --if this is higher than the regular counter, use it instead
_detalhes.bcc_counter = 28
_detalhes.dont_open_news = true
_detalhes.game_version = version
@@ -33,6 +33,15 @@ do
local Loc = _G.LibStub("AceLocale-3.0"):GetLocale( "Details" )
local news = {
{"v9.1.0.8888.145", "October 7th, 2021"},
"Search has been added into the options panel",
"Improvements on overkill amount of damage",
"Fonts 'Oswald' and 'NuevaStd' enabled again.",
"Added critical hits to Death Log (by C. Raethke)",
"Added settings to change the color on death log, they are within the class colors panel.",
"Don't show TaintWarning frame if MiniMapBattlefieldFrame is hidden (by Flamanis).",
{"v9.1.0.8812.145", "September 5th, 2021"},
"Fonts 'Oswald' and 'NuevaStd' disabled due to some erros on the client side.",
"Death Knight adds now include the icon of the spell whose summoned them.",
@@ -755,8 +764,8 @@ do
SharedMedia:Register ("border", "Details BarBorder 3", [[Interface\AddOns\Details\images\border_3]])
SharedMedia:Register ("border", "1 Pixel", [[Interface\Buttons\WHITE8X8]])
--misc fonts
--SharedMedia:Register ("font", "Oswald", [[Interface\Addons\Details\fonts\Oswald-Regular.otf]]) --blizz deativated support to .OTF font? (04-Set-2021)
--SharedMedia:Register ("font", "Nueva Std Cond", [[Interface\Addons\Details\fonts\NuevaStd-Cond.otf]])
SharedMedia:Register ("font", "Oswald", [[Interface\Addons\Details\fonts\Oswald-Regular.ttf]])
SharedMedia:Register ("font", "Nueva Std Cond", [[Interface\Addons\Details\fonts\NuevaStd-Cond.ttf]])
SharedMedia:Register ("font", "Accidental Presidency", [[Interface\Addons\Details\fonts\Accidental Presidency.ttf]])
SharedMedia:Register ("font", "TrashHand", [[Interface\Addons\Details\fonts\TrashHand.TTF]])
SharedMedia:Register ("font", "Harry P", [[Interface\Addons\Details\fonts\HARRYP__.TTF]])
+22 -20
View File
@@ -153,27 +153,22 @@
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
local container_misc = _detalhes.container_type.CONTAINER_MISC_CLASS
local duel_candidates = _detalhes.duel_candidates
local _token_ids = _detalhes.TokenID
local OBJECT_TYPE_ENEMY = 0x00000040
local OBJECT_TYPE_PLAYER = 0x00000400
local OBJECT_TYPE_PETS = 0x00003000
local AFFILIATION_GROUP = 0x00000007
local REACTION_FRIENDLY = 0x00000010
local REACTION_MINE = 0x00000001
local REACTION_FRIENDLY = 0x00000010
local ENVIRONMENTAL_FALLING_NAME = Loc ["STRING_ENVIRONMENTAL_FALLING"]
local ENVIRONMENTAL_DROWNING_NAME = Loc ["STRING_ENVIRONMENTAL_DROWNING"]
local ENVIRONMENTAL_FATIGUE_NAME = Loc ["STRING_ENVIRONMENTAL_FATIGUE"]
local ENVIRONMENTAL_FIRE_NAME = Loc ["STRING_ENVIRONMENTAL_FIRE"]
local ENVIRONMENTAL_LAVA_NAME = Loc ["STRING_ENVIRONMENTAL_LAVA"]
local ENVIRONMENTAL_SLIME_NAME = Loc ["STRING_ENVIRONMENTAL_SLIME"]
local RAID_TARGET_FLAGS = {
[128] = true, --0x80 skull
[64] = true, --0x40 cross
@@ -184,7 +179,7 @@
[2] = true, --0x2 circle
[1] = true, --0x1 star
}
--> spellIds override
local override_spellId
@@ -254,12 +249,11 @@
end
end
--tbc prayer of mending cache
--tbc spell caches
local TBC_PrayerOfMendingCache = {}
--tbc earth shield cache
local TBC_EarthShieldCache = {}
--tbc life bloom cache
local TBC_LifeBloomLatestHeal
local TBC_JudgementOfLightCache = {}
--expose the override spells table to external scripts
_detalhes.OverridedSpellIds = override_spellId
@@ -668,7 +662,7 @@
damageTable = {total = 0, spells = {}}
npcDamage[who_serial] = damageTable
end
damageTable.total = damageTable.total + amount
damageTable.spells[spellid] = (damageTable.spells[spellid] or 0) + amount
@@ -905,9 +899,10 @@
if (_is_in_instance) then
if (overkill and overkill > 0) then
overkill = overkill + 1
--if enabled it'll cut the amount of overkill from the last hit (which killed the actor)
--when disabled it'll show the total damage done for the latest hit
--amount = amount - overkill
amount = amount - overkill
end
end
@@ -1102,14 +1097,13 @@
if (is_friendly_fire and spellid ~= SPELLID_KYRIAN_DRUID_TANK) then --kyrian spell remove on 10.0
if (este_jogador.grupo) then --> se tiver ele no adiciona o evento l em cima
local t = last_events_cache [alvo_name]
local t = last_events_cache[alvo_name]
if (not t) then
t = _current_combat:CreateLastEventsTable (alvo_name)
t = _current_combat:CreateLastEventsTable(alvo_name)
end
local i = t.n
local this_event = t [i]
this_event [1] = true --> true if this is a damage || false for healing
@@ -1989,8 +1983,6 @@
if (is_using_spellId_override) then
spellid = override_spellId [spellid] or spellid
end
--sanguine ichor mythic dungeon affix (heal enemies)
if (spellid == SPELLID_SANGUINE_HEAL) then
@@ -2031,6 +2023,13 @@
elseif (spellid == SPELLID_DRUID_LIFEBLOOM_HEAL) then
TBC_LifeBloomLatestHeal = cura_efetiva
return
elseif (spellid == 27163) then --Judgement of Light (paladin)
local sourceData = TBC_JudgementOfLightCache[who_name]
if (sourceData) then
who_serial, who_name, who_flags = unpack(sourceData)
TBC_JudgementOfLightCache[who_name] = nil
end
end
end
@@ -2338,6 +2337,9 @@
elseif (spellid == SPELLID_PRIEST_POM_BUFF) then
TBC_PrayerOfMendingCache [alvo_name] = {who_serial, who_name, who_flags}
elseif (spellid == 27163) then --Judgement Of Light
TBC_JudgementOfLightCache[alvo_name] = {who_serial, who_name, who_flags}
end
end
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+6
View File
@@ -11,6 +11,12 @@ function Details:DumpTable (t)
return Details:Dump (t)
end
function Details:DumpInline(t)
for key, value in pairs(t) do
print(key, value)
end
end
function Details:Dump (t)
if (not DetailsDumpFrame) then
DetailsDumpFrame = DetailsFramework:CreateSimplePanel (_G.UIParent)