Skip to content

Commit

Permalink
Fix ML reload
Browse files Browse the repository at this point in the history
  • Loading branch information
evil-morfar committed Sep 12, 2024
1 parent 5325f47 commit 012ede1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Changes

## Bugfixes

- *Addon should now always properly initialize when reloading as the ML.*

# 3.13.2

## Changes
Expand Down
6 changes: 5 additions & 1 deletion core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1511,6 +1511,9 @@ function RCLootCouncil:OnEvent(event, ...)
if not self.masterLooter and self.db.global.cache.masterLooter then
self.masterLooter = Player:Get(self.db.global.cache.masterLooter)
self.isMasterLooter = self.masterLooter == self.player
if self.isMasterLooter then
self:CallModule("masterlooter")
end
end
self.Log:d("ML, Cached:", self.masterLooter, self.db.global.cache.masterLooter)

Expand All @@ -1522,14 +1525,15 @@ function RCLootCouncil:OnEvent(event, ...)
self:OnCouncilReceived(self.masterLooter, self.db.global.cache.council)
end

-- Restore ML priveliges
-- Restore handleLoot
if self.db.global.cache.handleLoot and self.isMasterLooter then
self.Log:D("Cached handleLoot:", self.db.global.cache.handleLoot)
self:StartHandleLoot()
end

-- If we still haven't set masterLooter, try delaying a bit.
-- but we don't have to wait if we got it from cache.
-- ? REVIEW: This might not be needed anymore.
self:ScheduleTimer(function()
if not self.isMasterLooter and self.masterLooter and self.masterLooter ~= "" then
self:Send("group", "pI", self:GetPlayerInfo()) -- Also send out info, just in case
Expand Down
7 changes: 7 additions & 0 deletions ml_core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ function RCLootCouncilML:AddItem(item, bagged, slotIndex, owner, entry, boss)
self.Log:d("AddItem", item, bagged, slotIndex, owner, entry, boss)
if type(item) == "string" and item:find("|Hcurrency") then return end -- Ignore "Currency" item links

-- Not having the lootTable is a sure sign that the module isn't enabled.
if not self.lootTable then
if not self:IsEnabled() and addon.isMasterLooter then
ErrorHandler:ThrowSilentError("ML module not enabled @AddItem")
addon:StartHandleLoot()
end
end
if not entry then
entry = {}
self.lootTable[#self.lootTable + 1] = entry
Expand Down

0 comments on commit 012ede1

Please sign in to comment.