Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi-instance mods (for M+ affixes) #1202

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Core/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ do
m.displayName = moduleName
end

if zoneId > 0 then
if type(zoneId) == 'table' or zoneId > 0 then
m.instanceId = zoneId
else
m.mapId = -zoneId
Expand Down Expand Up @@ -654,7 +654,11 @@ do
core:SendMessage("BigWigs_BossModuleRegistered", module.moduleName, module)

local id = module.instanceId or -(module.mapId)
if not enablezones[id] then
if type(id) == 'table' then
for _, eachId in ipairs(id) do
enablezones[eachId] = true
end
elseif not enablezones[id] then
enablezones[id] = true
end
end
Expand Down
14 changes: 13 additions & 1 deletion Loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ do
[2291] = lw_s, -- De Other Side
[2293] = lw_s, -- Theater of Pain
[2441] = lw_s, -- Tazavesh, the Veiled Market
["Affixes"] = lw_s, -- Affixes
}

public.zoneTblWorld = {
Expand Down Expand Up @@ -657,6 +658,11 @@ do

if not menus[id] then menus[id] = true end
end
elseif type(rawMenu) == "string" then
if not loadOnZone[rawMenu] then loadOnZone[rawMenu] = {} end
loadOnZone[rawMenu][#loadOnZone[rawMenu] + 1] = addon

if not menus[rawMenu] then menus[rawMenu] = true end
else
local name = GetAddOnInfo(addon)
sysprint(("The extra menu ID %q from the addon %q was not parsable."):format(tostring(rawMenu), name))
Expand Down Expand Up @@ -1488,7 +1494,13 @@ function mod:BigWigs_BossModuleRegistered(_, _, module)
enableZones[id] = "world"
worldBosses[module.worldBoss] = id
else
enableZones[module.instanceId] = true
if type(module.instanceId) == 'table' then
for _, eachId in ipairs(module.instanceId) do
enableZones[eachId] = true
end
else
enableZones[module.instanceId] = true
end
end

local id = module.otherMenu or module.instanceId or -(module.mapId)
Expand Down
9 changes: 7 additions & 2 deletions Options/Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ local function populateToggleOptions(widget, module)
local id = module.instanceId

local sDB = BigWigsStatsDB
if module.journalId and id and id > 0 and BigWigs:GetPlugin("Statistics").db.profile.enabled and sDB and sDB[id] and sDB[id][module.journalId] then
if module.journalId and id and type(id) ~= "table" and id > 0 and BigWigs:GetPlugin("Statistics").db.profile.enabled and sDB and sDB[id] and sDB[id][module.journalId] then
sDB = sDB[id][module.journalId]

if next(sDB) then -- Create statistics table
Expand Down Expand Up @@ -1214,8 +1214,11 @@ do
local function onTreeGroupSelected(widget, event, value)
widget:ReleaseChildren()
local zoneId = value:match("\001(-?%d+)$")
local stringZoneId = value:match("\001(-?[a-z_A-Z]+)$")
if zoneId then
onZoneShow(widget, tonumber(zoneId))
elseif stringZoneId then
onZoneShow(widget, stringZoneId)
elseif value:match("^BigWigs_") and value ~= "BigWigs_Shadowlands" and GetAddOnEnableState(playerName, value) == 0 then
local missing = AceGUI:Create("Label")
missing:SetText(L.missingAddOn:format(value))
Expand Down Expand Up @@ -1283,7 +1286,9 @@ do
local zoneToId, alphabeticalZoneList = {}, {}
for k in next, loader:GetZoneMenus() do
local zone
if k < 0 then
if type(k) == "string" then
zone = k
elseif k < 0 then
local tbl = GetMapInfo(-k)
if tbl then
zone = tbl.name
Expand Down
2 changes: 1 addition & 1 deletion Plugins/Statistics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ do
function plugin:BigWigs_OnBossEngage(event, module, diff)
local id = module.instanceId

if module.journalId and id and id > 0 and not module.worldBoss then -- Raid restricted for now
if module.journalId and id and type(id) ~= "table" and id > 0 and not module.worldBoss then -- Raid restricted for now
activeDurations[module.journalId] = GetTime()

if diff and difficultyTable[diff] then
Expand Down