Open Raid Library update
This commit is contained in:
@@ -335,7 +335,7 @@ function openRaidLib.GearManager.GetPlayerWeaponEnchant()
|
||||
elseif(LIB_OPEN_RAID_WEAPON_ENCHANT_IDS[offHandEnchantId]) then
|
||||
weaponEnchant = 1
|
||||
end
|
||||
return weaponEnchant
|
||||
return weaponEnchant, mainHandEnchantId or 0, offHandEnchantId or 0
|
||||
end
|
||||
|
||||
function openRaidLib.GearManager.GetPlayerGemsAndEnchantInfo()
|
||||
|
||||
@@ -64,7 +64,7 @@ if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE and not isExpansion_Dragonflight()) t
|
||||
end
|
||||
|
||||
local major = "LibOpenRaid-1.0"
|
||||
local CONST_LIB_VERSION = 96
|
||||
local CONST_LIB_VERSION = 97
|
||||
|
||||
if (not LIB_OPEN_RAID_MAX_VERSION) then
|
||||
LIB_OPEN_RAID_MAX_VERSION = CONST_LIB_VERSION
|
||||
@@ -1588,7 +1588,7 @@ openRaidLib.internalCallback.RegisterCallback("onLeaveCombat", openRaidLib.UnitI
|
||||
local specMainAttribute = openRaidLib.specAttribute[playerClass][specId] --1 int, 2 dex, 3 str
|
||||
|
||||
if (not specId or not specMainAttribute) then
|
||||
return {0, 0, 0, {}, {}, {}}
|
||||
return {0, 0, 0, {}, {}, {}, 0, 0}
|
||||
end
|
||||
|
||||
--item level
|
||||
@@ -1598,7 +1598,7 @@ openRaidLib.internalCallback.RegisterCallback("onLeaveCombat", openRaidLib.UnitI
|
||||
local gearDurability = openRaidLib.GearManager.GetPlayerGearDurability()
|
||||
|
||||
--get weapon enchant
|
||||
local weaponEnchant = openRaidLib.GearManager.GetPlayerWeaponEnchant()
|
||||
local weaponEnchant, mainHandEnchantId, offHandEnchantId = openRaidLib.GearManager.GetPlayerWeaponEnchant()
|
||||
|
||||
--enchants and gems
|
||||
local slotsWithoutGems, slotsWithoutEnchant = openRaidLib.GearManager.GetPlayerGemsAndEnchantInfo()
|
||||
@@ -1614,12 +1614,14 @@ openRaidLib.internalCallback.RegisterCallback("onLeaveCombat", openRaidLib.UnitI
|
||||
playerGearInfo[#playerGearInfo+1] = slotsWithoutEnchant --[4] - undefined
|
||||
playerGearInfo[#playerGearInfo+1] = slotsWithoutGems --[5] - undefined
|
||||
playerGearInfo[#playerGearInfo+1] = equippedGearList --[6] - undefined
|
||||
playerGearInfo[#playerGearInfo+1] = mainHandEnchantId --[7]
|
||||
playerGearInfo[#playerGearInfo+1] = offHandEnchantId --[8]
|
||||
|
||||
return playerGearInfo
|
||||
end
|
||||
|
||||
--when received the gear update from another player, store it and trigger a callback
|
||||
function openRaidLib.GearManager.AddUnitGearList(unitName, itemLevel, durability, weaponEnchant, noEnchantTable, noGemsTable, equippedGearList)
|
||||
function openRaidLib.GearManager.AddUnitGearList(unitName, itemLevel, durability, weaponEnchant, noEnchantTable, noGemsTable, equippedGearList, mainHandEnchantId, offHandEnchantId)
|
||||
local unitGearInfo = openRaidLib.GearManager.GetUnitGear(unitName, true)
|
||||
|
||||
unitGearInfo.ilevel = itemLevel
|
||||
@@ -1627,6 +1629,8 @@ openRaidLib.internalCallback.RegisterCallback("onLeaveCombat", openRaidLib.UnitI
|
||||
unitGearInfo.weaponEnchant = weaponEnchant
|
||||
unitGearInfo.noGems = noGemsTable
|
||||
unitGearInfo.noEnchants = noEnchantTable
|
||||
unitGearInfo.mainHandEnchantId = mainHandEnchantId
|
||||
unitGearInfo.offHandEnchantId = offHandEnchantId
|
||||
|
||||
--parse and replace the 'equippedGearList'
|
||||
openRaidLib.GearManager.BuildEquipmentItemLinks(equippedGearList)
|
||||
@@ -1649,7 +1653,12 @@ openRaidLib.internalCallback.RegisterCallback("onLeaveCombat", openRaidLib.UnitI
|
||||
local noGemsTableSize = data[noGemsTableIndex]
|
||||
|
||||
local equippedGearListIndex = tonumber(noEnchantTableSize + noGemsTableSize + 6) --6 is the same has the 5 but +1 index for the gems table size
|
||||
--local equippedGearListSize = data[noGemsTableIndex]
|
||||
local equippedGearListSize = data[equippedGearListIndex]
|
||||
|
||||
local mainHandEnchantIdIndex = tonumber(noEnchantTableSize + noGemsTableSize + equippedGearListSize + 7)
|
||||
local mainHandEnchantId = tonumber(data[mainHandEnchantIdIndex])
|
||||
local offHandEnchantIdIndex = tonumber(mainHandEnchantIdIndex + 1)
|
||||
local offHandEnchantId = tonumber(data[offHandEnchantIdIndex])
|
||||
|
||||
--unpack the enchant data as a ipairs table
|
||||
local noEnchantTableUnpacked = openRaidLib.UnpackTable(data, 4, false, false, noEnchantTableSize)
|
||||
@@ -1659,20 +1668,22 @@ openRaidLib.internalCallback.RegisterCallback("onLeaveCombat", openRaidLib.UnitI
|
||||
local equippedGearListUnpacked = equippedGearListIndex and openRaidLib.UnpackTable(data, equippedGearListIndex, false, true, 4) or {}
|
||||
|
||||
--add to the list of gear information
|
||||
openRaidLib.GearManager.AddUnitGearList(unitName, itemLevel, durability, weaponEnchant, noEnchantTableUnpacked, noGemsTableUnpacked, equippedGearListUnpacked)
|
||||
openRaidLib.GearManager.AddUnitGearList(unitName, itemLevel, durability, weaponEnchant, noEnchantTableUnpacked, noGemsTableUnpacked, equippedGearListUnpacked, mainHandEnchantId, offHandEnchantId)
|
||||
end
|
||||
openRaidLib.commHandler.RegisterComm(CONST_COMM_GEARINFO_FULL_PREFIX, openRaidLib.GearManager.OnReceiveGearFullInfo)
|
||||
|
||||
--todo: on changing an item in the inventory, send an update only for the slot that got changed
|
||||
|
||||
function openRaidLib.GearManager.SendAllGearInfo()
|
||||
--get gear information, gear info has 6 indexes:
|
||||
--get gear information, gear info has 8 indexes:
|
||||
--[1] int item level
|
||||
--[2] int durability
|
||||
--[3] int weapon enchant
|
||||
--[4] table with integers of equipSlot without enchant
|
||||
--[5] table with integers of equipSlot which has a gem slot but the slot is empty
|
||||
--[6] table with all gear from the player
|
||||
--[7] int mainHandEnchantId
|
||||
--[8] int offHandEnchantId
|
||||
|
||||
local dataToSend = "" .. CONST_COMM_GEARINFO_FULL_PREFIX .. ","
|
||||
local playerGearInfo = openRaidLib.GearManager.GetPlayerFullGearInfo()
|
||||
@@ -1685,7 +1696,9 @@ openRaidLib.internalCallback.RegisterCallback("onLeaveCombat", openRaidLib.UnitI
|
||||
dataToSend = dataToSend .. playerGearInfo[3] .. "," --weapon enchant
|
||||
dataToSend = dataToSend .. openRaidLib.PackTable(playerGearInfo[4]) .. "," --slots without enchant
|
||||
dataToSend = dataToSend .. openRaidLib.PackTable(playerGearInfo[5]) .. "," -- slots with empty gem sockets
|
||||
dataToSend = dataToSend .. openRaidLib.PackTableAndSubTables(playerGearInfo[6]) --full equipped equipment
|
||||
dataToSend = dataToSend .. openRaidLib.PackTableAndSubTables(playerGearInfo[6]) .. "," --full equipped equipment
|
||||
dataToSend = dataToSend .. playerGearInfo[7] .. "," -- mainHandEnchantID
|
||||
dataToSend = dataToSend .. playerGearInfo[8] -- offHandEnchantID
|
||||
|
||||
--send the data
|
||||
openRaidLib.commHandler.SendCommData(dataToSend)
|
||||
|
||||
@@ -121,6 +121,7 @@ do
|
||||
[INVSLOT_MAINHAND] = true,
|
||||
[INVSLOT_FEET] = true,
|
||||
[INVSLOT_WRIST] = true,
|
||||
[INVSLOT_LEGS] = true,
|
||||
[INVSLOT_HAND] = true,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user