Pet container rewritten
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
---@field reverse fun(tbl:table) : table reverse the order of an array
|
||||
---@field append fun(tbl1:table, tbl2:table) : table append the array of table2 to table1
|
||||
---@field duplicate fun(tblReceiving:table, tblGiving:table) : table copy the values from table2 to table1 overwriting existing values, ignores __index and __newindex, keys pointing to a UIObject are preserved
|
||||
---@field countkeys fun(tbl:table) : number count the keys of a table
|
||||
---@field copy fun(tblReceiving:table, tblGiving:table) : table copy the values from table2 to table1 overwriting existing values, ignores __index and __newindex, threat UIObjects as regular tables
|
||||
---@field deploy fun(tblReceiving:table, tblGiving:table) : table copy keys/values that does exist on tblGiving but not in tblReceiving
|
||||
---@field copytocompress fun(tblReceiving:table, tblGiving:table) : table copy the values from table2 to table1 overwriting existing values, ignores __index, functions and tables with a 'GetObjectType' key
|
||||
|
||||
@@ -543,6 +543,17 @@ function DF.table.setfrompath(t, path, value)
|
||||
return false
|
||||
end
|
||||
|
||||
---return the amount of keys in a table
|
||||
---@param t table
|
||||
---@return number
|
||||
function DF.table.countkeys(t)
|
||||
local count = 0
|
||||
for _ in pairs(t) do
|
||||
count = count + 1
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
---find the value inside the table, and it it's not found, add it
|
||||
---@param t table
|
||||
---@param index integer|any
|
||||
|
||||
@@ -311,6 +311,58 @@ local getSpellListAsHashTableFromSpellBook = function()
|
||||
end
|
||||
end
|
||||
|
||||
--get class shared spells from the spell book
|
||||
local tabName, tabTexture, offset, numSpells, isGuild, offspecId = GetSpellTabInfo(CONST_SPELLBOOK_CLASSSPELLS_TABID)
|
||||
offset = offset + 1
|
||||
local tabEnd = offset + numSpells
|
||||
for entryOffset = offset, tabEnd - 1 do
|
||||
local spellType, spellId = GetSpellBookItemInfo(entryOffset, spellBookPlayerEnum)
|
||||
if (spellId) then
|
||||
if (spellType == "SPELL") then
|
||||
spellId = GetOverrideSpell(spellId)
|
||||
local spellName = GetSpellInfo(spellId)
|
||||
local bIsPassive = IsPassiveSpell(spellId, spellBookPlayerEnum)
|
||||
|
||||
if LIB_OPEN_RAID_MULTI_OVERRIDE_SPELLS[spellId] then
|
||||
for _, overrideSpellId in pairs(LIB_OPEN_RAID_MULTI_OVERRIDE_SPELLS[spellId]) do
|
||||
completeListOfSpells[overrideSpellId] = true
|
||||
end
|
||||
elseif (spellName and not bIsPassive) then
|
||||
completeListOfSpells[spellId] = true
|
||||
|
||||
else
|
||||
if (not spellName) then
|
||||
--print("no spellname")
|
||||
--print(GetSpellInfo(spellId))
|
||||
elseif (bIsPassive) then
|
||||
--print("is passive")
|
||||
--print(GetSpellInfo(spellId))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local getNumPetSpells = function()
|
||||
--'HasPetSpells' contradicts the name and return the amount of pet spells available instead of a boolean
|
||||
return HasPetSpells()
|
||||
end
|
||||
|
||||
--get pet spells from the pet spellbook
|
||||
local numPetSpells = getNumPetSpells()
|
||||
if (numPetSpells) then
|
||||
for i = 1, numPetSpells do
|
||||
local spellName, _, unmaskedSpellId = GetSpellBookItemName(i, spellBookPetEnum)
|
||||
if (unmaskedSpellId) then
|
||||
unmaskedSpellId = GetOverrideSpell(unmaskedSpellId)
|
||||
local bIsPassive = IsPassiveSpell(unmaskedSpellId, spellBookPetEnum)
|
||||
if (spellName and not bIsPassive) then
|
||||
completeListOfSpells[unmaskedSpellId] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return completeListOfSpells
|
||||
end
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ LIB_OPEN_RAID_CAN_LOAD = false
|
||||
|
||||
local major = "LibOpenRaid-1.0"
|
||||
|
||||
local CONST_LIB_VERSION = 127
|
||||
local CONST_LIB_VERSION = 128
|
||||
|
||||
if (LIB_OPEN_RAID_MAX_VERSION) then
|
||||
if (CONST_LIB_VERSION <= LIB_OPEN_RAID_MAX_VERSION) then
|
||||
|
||||
Reference in New Issue
Block a user