Better way to track set bonus
Nils89 opened this issue ยท 1 comments
Hi,
this could Maybe a besster way to detect if a set with Bonus is equipped and does not Need any local strings set names:
local itemSets = {
["StormrageRaiment"] = {
[16899] = true,
[16900] = true,
[16901] = true,
[16902] = true,
[16903] = true,
[16904] = true,
[16897] = true,
[16898] = true
},
["VestmentsOfTranscendence"] = {
[16919] = true,
[16920] = true,
[16921] = true,
[16922] = true,
[16923] = true,
[16924] = true,
[16925] = true,
[16926] = true
},
["Zul_DRUID"] = {
[19613] = true,
[19955] = true,
[19840] = true,
[19839] = true,
[19838] = true
},
["Zul_SHAMAN"] = {
[19609] = true,
[19956] = true,
[19830] = true,
[19829] = true,
[19828] = true
},
["Zul_PALADIN"] = {
[19952] = true,
[19588] = true,
[19827] = true,
[19826] = true,
[19825] = true
}
}
local function IsSetBonusActive(setname, bonusLevel)
local set = itemSets[setname]
if not set then return false end
local pieces_equipped = 0
for slot = 1, 17 do
local itemID = GetInventoryItemID("player", slot)
if set[itemID] then pieces_equipped = pieces_equipped + 1 end
end
return (pieces_equipped >= bonusLevel)
end
And here you can check it:
local function _HasSetBonusModifierMP5()
if classId == ClassIndex.PRIEST then
return IsSetBonusActive("VestmentsOfTranscendence", 3)
elseif classId == ClassIndex.DRUID then
return IsSetBonusActive("StormrageRaiment", 3)
end
return false
end
local function MP5FromItems()
local mp5 = 0
local classname = select(2, UnitClass("Player"))
for i = 1, 18 do
local itemLink = GetInventoryItemLink("player", i)
if itemLink then
local stats = GetItemStats(itemLink)
if stats then
local statMP5 = stats["ITEM_MOD_POWER_REGEN0_SHORT"]
if statMP5 then
mp5 = mp5 + statMP5 + 1
end
end
end
end
-- check if Zul Gurub Set Bonus is active
if classId == ClassIndex.DRUID or classId == ClassIndex.PALADIN or classId == ClassIndex.SHAMAN then
if IsSetBonusActive("Zul_" .. classname, 2) then
mp5 = mp5 + 4
end
end
return mp5
end
Hey @Nils89 thanks for pointing that out ๐ No idea why I didn't think about it myself ๐ค I will add those changes soon to improve ECS