Added ignore npc table
- Can be added anywhere using /run Details.npcid_ignored[npcid] = true - Framework and Localization update.
This commit is contained in:
+87
-1
@@ -1,5 +1,5 @@
|
||||
|
||||
local dversion = 178
|
||||
local dversion = 179
|
||||
|
||||
local major, minor = "DetailsFramework-1.0", dversion
|
||||
local DF, oldminor = LibStub:NewLibrary (major, minor)
|
||||
@@ -3781,3 +3781,89 @@ function DF:IsUnitTapDenied (unitId)
|
||||
end
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> pool
|
||||
|
||||
do
|
||||
local get = function(self)
|
||||
local object = tremove(self.notUse, #self.notUse)
|
||||
if (object) then
|
||||
tinsert(self.inUse, object)
|
||||
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)
|
||||
return object, true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local release = function(self, object)
|
||||
for i = #self.inUse, 1, -1 do
|
||||
if (self.inUse[i] == object) then
|
||||
tremove(self.inUse, i)
|
||||
tinsert(self.notUse, object)
|
||||
break
|
||||
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
|
||||
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
|
||||
|
||||
--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
|
||||
|
||||
--return the amount of objects
|
||||
local getamount = function(self)
|
||||
return #self.notUse + #self.inUse
|
||||
end
|
||||
|
||||
local poolMixin = {
|
||||
Get = get,
|
||||
Acquire = get,
|
||||
Release = release,
|
||||
Reset = reset,
|
||||
ReleaseAll = reset,
|
||||
Hide = hide,
|
||||
Show = show,
|
||||
GetAmount = getamount,
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
|
||||
+31
-1
@@ -22,6 +22,7 @@
|
||||
local _GetTime = GetTime
|
||||
local _select = select
|
||||
local _UnitBuff = UnitBuff
|
||||
local _tonumber = tonumber
|
||||
|
||||
local _CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo
|
||||
|
||||
@@ -97,6 +98,8 @@
|
||||
local bitfield_swap_cache = {}
|
||||
--> damage and heal last events
|
||||
local last_events_cache = {} --> initialize table (placeholder)
|
||||
--> npcId cache
|
||||
local npcid_cache = {}
|
||||
--> pets
|
||||
local container_pets = {} --> initialize table (placeholder)
|
||||
--> ignore deaths
|
||||
@@ -197,6 +200,9 @@
|
||||
|
||||
--expose the override spells table to external scripts
|
||||
_detalhes.OverridedSpellIds = override_spellId
|
||||
|
||||
--> list of ignored npcs by the user
|
||||
local ignored_npcids = {}
|
||||
|
||||
--> ignore soul link (damage from the warlock on his pet - current to demonology only)
|
||||
local SPELLID_WARLOCK_SOULLINK = 108446
|
||||
@@ -536,6 +542,26 @@
|
||||
alvo_flags = 0xa48
|
||||
end
|
||||
|
||||
--> npcId check for ignored npcs
|
||||
--target
|
||||
local npcId = npcid_cache[alvo_serial]
|
||||
if (not npcId) then
|
||||
npcId = _tonumber(_select (6, _strsplit ("-", alvo_serial)) or 0)
|
||||
npcid_cache[alvo_serial] = npcId
|
||||
end
|
||||
if (ignored_npcids[npcId]) then
|
||||
return
|
||||
end
|
||||
--source
|
||||
npcId = npcid_cache[who_serial]
|
||||
if (not npcId) then
|
||||
npcId = _tonumber(_select (6, _strsplit ("-", who_serial)) or 0)
|
||||
npcid_cache[who_serial] = npcId
|
||||
end
|
||||
if (ignored_npcids[npcId]) then
|
||||
return
|
||||
end
|
||||
|
||||
--> avoid doing spellID checks on each iteration
|
||||
if (special_damage_spells [spellid]) then
|
||||
--> stagger
|
||||
@@ -5135,6 +5161,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
||||
_table_wipe (misc_cache)
|
||||
_table_wipe (misc_cache_pets)
|
||||
_table_wipe (misc_cache_petsOwners)
|
||||
_table_wipe (npcid_cache)
|
||||
|
||||
_table_wipe (ignore_death)
|
||||
|
||||
@@ -5300,7 +5327,10 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
||||
--_recording_took_damage = _detalhes.RecordRealTimeTookDamage
|
||||
_recording_ability_with_buffs = _detalhes.RecordPlayerAbilityWithBuffs
|
||||
_in_combat = _detalhes.in_combat
|
||||
|
||||
|
||||
--> grab the ignored npcid directly from the user profile
|
||||
ignored_npcids = _detalhes.npcid_ignored
|
||||
|
||||
if (_in_combat) then
|
||||
if (not _auto_regen_thread or _auto_regen_thread._cancelled) then
|
||||
_auto_regen_thread = C_Timer.NewTicker (AUTO_REGEN_PRECISION / 10, regen_power_overflow_check)
|
||||
|
||||
@@ -1393,6 +1393,9 @@ local default_global_data = {
|
||||
|
||||
--> raid information - can be accessed by plugins and third party mods
|
||||
raid_data = {},
|
||||
|
||||
--> store all npcids blacklisted by the user
|
||||
npcid_ignored = {},
|
||||
}
|
||||
|
||||
_detalhes.default_global_data = default_global_data
|
||||
|
||||
Reference in New Issue
Block a user