Lib OpenRaid and Details! Framework updates

This commit is contained in:
Tercio Jose
2022-12-11 14:09:44 -03:00
parent ebade8e159
commit 641e5cf0dc
6 changed files with 92 additions and 54 deletions
+5 -2
View File
@@ -15,7 +15,7 @@ local max = math.max
--api locals
local PixelUtil = PixelUtil or DFPixelUtil
local version = 8
local version = 9
local CONST_MENU_TYPE_MAINMENU = "main"
local CONST_MENU_TYPE_SUBMENU = "sub"
@@ -3217,6 +3217,8 @@ function DF:CreateCoolTip()
end
local wait = 0.2
local delayToHide = 0.11
local delayToHideDefault = 0.11
local InjectOnUpdateEnter = function(self, deltaTime)
elapsedTime = elapsedTime + deltaTime
if (elapsedTime > wait) then
@@ -3227,7 +3229,7 @@ function DF:CreateCoolTip()
local InjectOnUpdateLeave = function(self, deltaTime)
elapsedTime = elapsedTime + deltaTime
if (elapsedTime > 0.2) then
if (elapsedTime > delayToHide) then
if (not gameCooltip.mouseOver and not gameCooltip.buttonOver and self == gameCooltip.Host) then
gameCooltip:ShowMe(false)
end
@@ -3240,6 +3242,7 @@ function DF:CreateCoolTip()
if (gameCooltip.active) then
elapsedTime = 0
delayToHide = self.CoolTip.HideSpeed or delayToHideDefault
self:SetScript("OnUpdate", InjectOnUpdateLeave)
else
self:SetScript("OnUpdate", nil)
+1 -1
View File
@@ -1,6 +1,6 @@
local dversion = 402
local dversion = 403
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
+54 -46
View File
@@ -429,6 +429,7 @@ function openRaidLib.GetFoodTierFromAura(auraInfo)
return nil
end
--called from AddUnitGearList() on LibOpenRaid file
function openRaidLib.GearManager.BuildEquipmentItemLinks(equippedGearList)
equippedGearList = equippedGearList or {} --nil table for older versions
@@ -441,64 +442,71 @@ function openRaidLib.GearManager.BuildEquipmentItemLinks(equippedGearList)
local itemLevel = equipmentTable[3]
local partialItemLink = equipmentTable[4]
--get the itemId from the partial link to query the itemName with GetItemInfo
local itemId = partialItemLink:match("^%:(%d+)%:")
itemId = tonumber(itemId)
local itemName, _, itemQuality = GetItemInfo(itemId)
if (partialItemLink and type(partialItemLink) == "string") then
--get the itemId from the partial link to query the itemName with GetItemInfo
local itemId = partialItemLink:match("^%:(%d+)%:")
itemId = tonumber(itemId)
--build the full item link
local itemLink = "|cFFEEEEEE|Hitem" .. partialItemLink .. "|h[" .. itemName .. "]|r"
if (itemId) then
local itemName = GetItemInfo(itemId)
if (itemName) then
--build the full item link
local itemLink = "|cFFEEEEEE|Hitem" .. partialItemLink .. "|h[" .. itemName .. "]|r"
--use GetItemInfo again with the now completed itemLink to query the item color
local _, _, itemQuality = GetItemInfo(itemLink)
local qualityColor = ITEM_QUALITY_COLORS[itemQuality]
--use GetItemInfo again with the now completed itemLink to query the item color
local _, _, itemQuality = GetItemInfo(itemLink)
itemQuality = itemQuality or 1
local qualityColor = ITEM_QUALITY_COLORS[itemQuality]
--replace the item color
--local r, g, b, hex = GetItemQualityColor(qualityColor)
itemLink = itemLink:gsub("FFEEEEEE", qualityColor.color:GenerateHexColor())
--replace the item color
--local r, g, b, hex = GetItemQualityColor(qualityColor)
itemLink = itemLink:gsub("FFEEEEEE", qualityColor.color:GenerateHexColor())
wipe(equipmentTable)
wipe(equipmentTable)
equipmentTable.slotId = slotId
equipmentTable.gemSlots = numGemSlots
equipmentTable.itemLevel = itemLevel
equipmentTable.itemLink = itemLink
equipmentTable.itemQuality = itemQuality
equipmentTable.itemId = itemId
equipmentTable.itemName = itemName
equipmentTable.slotId = slotId
equipmentTable.gemSlots = numGemSlots
equipmentTable.itemLevel = itemLevel
equipmentTable.itemLink = itemLink
equipmentTable.itemQuality = itemQuality
equipmentTable.itemId = itemId
equipmentTable.itemName = itemName
local _, _, enchantId, gemId1, gemId2, gemId3, gemId4, suffixId, uniqueId, levelOfTheItem, specId, upgradeInfo, instanceDifficultyId, numBonusIds, restLink = strsplit(":", itemLink)
local _, _, enchantId, gemId1, gemId2, gemId3, gemId4, suffixId, uniqueId, levelOfTheItem, specId, upgradeInfo, instanceDifficultyId, numBonusIds, restLink = strsplit(":", itemLink)
local enchantAttribute = LIB_OPEN_RAID_ENCHANT_SLOTS[slotId]
local nEnchantId = 0
if (enchantAttribute) then --this slot can receive an enchat
if (enchantId and enchantId ~= "") then
enchantId = tonumber(enchantId)
nEnchantId = enchantId
end
local enchantAttribute = LIB_OPEN_RAID_ENCHANT_SLOTS[slotId]
local nEnchantId = 0
if (enchantAttribute) then --this slot can receive an enchat
if (enchantId and enchantId ~= "") then
enchantId = tonumber(enchantId)
nEnchantId = enchantId
end
--6400 and above is dragonflight enchantId number space
if (nEnchantId < 6300 and not LIB_OPEN_RAID_DEATHKNIGHT_RUNEFORGING_ENCHANT_IDS[nEnchantId]) then
nEnchantId = 0
end
end
equipmentTable.enchantId = nEnchantId
--6400 and above is dragonflight enchantId number space
if (nEnchantId < 6300 and not LIB_OPEN_RAID_DEATHKNIGHT_RUNEFORGING_ENCHANT_IDS[nEnchantId]) then
nEnchantId = 0
end
end
equipmentTable.enchantId = nEnchantId
local nGemId = 0
local gemsIds = {gemId1, gemId2, gemId3, gemId4}
local nGemId = 0
local gemsIds = {gemId1, gemId2, gemId3, gemId4}
--check if the item has a socket
if (numGemSlots) then
--check if the socket is empty
for gemSlotId = 1, numGemSlots do
local gemId = tonumber(gemsIds[gemSlotId])
if (gemId and gemId >= 180000) then
nGemId = gemId
break
--check if the item has a socket
if (numGemSlots) then
--check if the socket is empty
for gemSlotId = 1, numGemSlots do
local gemId = tonumber(gemsIds[gemSlotId])
if (gemId and gemId >= 180000) then
nGemId = gemId
break
end
end
end
equipmentTable.gemId = nGemId
end
end
end
equipmentTable.gemId = nGemId
end
end
+12 -2
View File
@@ -20,6 +20,10 @@ local CONST_BTALENT_VERSION_COVENANTS = 9
local CONST_SPELLBOOK_CLASSSPELLS_TABID = 2
local CONST_SPELLBOOK_GENERAL_TABID = 1
local GetItemInfo = GetItemInfo
local GetItemStats = GetItemStats
local GetInventoryItemLink = GetInventoryItemLink
local isTimewalkWoW = function()
local _, _, _, buildInfo = GetBuildInfo()
if (buildInfo < 40000) then
@@ -390,9 +394,15 @@ function openRaidLib.GearManager.BuildPlayerEquipmentList()
local itemID, enchantID, gemID1, gemID2, gemID3, gemID4, suffixID, uniqueID, linkLevel, specializationID, modifiersMask, itemContext = select(2, strsplit(":", itemLink))
itemID = tonumber(itemID)
local effectiveILvl, isPreview, baseILvl = GetDetailedItemLevelInfo(itemLink)
if (not effectiveILvl) then
openRaidLib.mainControl.scheduleUpdatePlayerData()
effectiveILvl = 0
openRaidLib.__errors[#openRaidLib.__errors+1] = "Fail to get Item Level: " .. (itemID or "invalid itemID") .. " " .. (itemLink and itemLink:gsub("|H", "") or "invalid itemLink")
end
GetItemStats(itemLink, itemStatsTable)
local gemSlotsAvailable = itemStatsTable and itemStatsTable.EMPTY_SOCKET_PRISMATIC or 0
local _, _, _, itemLevel = GetItemInfo(itemLink)
local noPrefixItemLink = itemLink : gsub("^|c%x%x%x%x%x%x%x%x|Hitem", "")
local linkTable = {strsplit(":", noPrefixItemLink)}
@@ -405,7 +415,7 @@ function openRaidLib.GearManager.BuildPlayerEquipmentList()
local newItemLink = table.concat(linkTable, ":")
newItemLink = newItemLink
equipmentList[#equipmentList+1] = {equipmentSlotId, gemSlotsAvailable, itemLevel, newItemLink}
equipmentList[#equipmentList+1] = {equipmentSlotId, gemSlotsAvailable, effectiveILvl, newItemLink}
if (equipmentSlotId == 2) then
debug = {itemLink:gsub("|H", ""), newItemLink}
+7 -3
View File
@@ -88,6 +88,8 @@ local unpack = table.unpack or _G.unpack
LIB_OPEN_RAID_CAN_LOAD = true
openRaidLib.__errors = {} --/dump LibStub:GetLibrary("LibOpenRaid-1.0").__errors
--default values
openRaidLib.inGroup = false
openRaidLib.UnitIDCache = {}
@@ -1013,9 +1015,11 @@ end
local playerFullInfo = openRaidLib.UnitInfoManager.GetPlayerFullInfo()
openRaidLib.UnitInfoManager.AddUnitInfo(unitName, unpack(playerFullInfo))
--gear info
local playerGearInfo = openRaidLib.GearManager.GetPlayerFullGearInfo()
openRaidLib.GearManager.AddUnitGearList(unitName, unpack(playerGearInfo))
--gear info
--C_Timer.After(2, function()
local playerGearInfo = openRaidLib.GearManager.GetPlayerFullGearInfo()
openRaidLib.GearManager.AddUnitGearList(unitName, unpack(playerGearInfo))
--end)
--cooldowns
openRaidLib.CooldownManager.UpdatePlayerCooldownsLocally()
+13
View File
@@ -79,6 +79,19 @@ playerGear = {
.noGems = {socketId}
.noEnchants = {socketId}
.weaponEnchant = number (oils)
.equippedGear = {
{
.slotId = number
.gemSlots = number
.itemLevel = number
.itemLink = string
.itemQuality = number
.itemId = number
.itemName = string
.enchantId = number
.gemId = number
}
}
}