Skip to content

Commit

Permalink
Invasion status updates will now first check if notifying guild membe…
Browse files Browse the repository at this point in the history
…rs are inside an instance before determining if they're eligible to notify the guild
  • Loading branch information
okdecm committed Dec 14, 2020
1 parent 2aa19c7 commit e414911
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions InvasionDetector.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function InvasionDetector:CheckForInvasions()
InvasionDetectorDB.Invasions[invasionName].Despawned = nil;

-- Try and notify in the guild chat
Utility:TryNotifyGuild(InvasionDetector.HasAddon, "[Invasion Detector] Invasion up! Spotted in " .. invasionName);
InvasionDetector:TryNotifyGuild("[Invasion Detector] Invasion up! Spotted in " .. invasionName);
end

-- Store the time we saw it
Expand Down Expand Up @@ -139,7 +139,7 @@ function InvasionDetector:CheckForInvasions()
invasionInfo.Despawned = checkTime;

-- Try and notify in the guild chat
Utility:TryNotifyGuild(InvasionDetector.HasAddon, "[Invasion Detector] Invasion has ended in " .. invasionName);
InvasionDetector:TryNotifyGuild("[Invasion Detector] Invasion has ended in " .. invasionName);
end
end
end
Expand Down Expand Up @@ -330,7 +330,7 @@ function InvasionDetector:OutputTimers(chatType)

for _, message in ipairs(messages) do
if(chatType == "guild") then
Utility:TryNotifyGuild(InvasionDetector.HasAddon, "[Invasion Detector] " .. message, "GUILD");
InvasionDetector:TryNotifyGuild("[Invasion Detector] " .. message);
elseif(chatType == "party") then
SendChatMessage("[Invasion Detector] " .. message, "PARTY");
else
Expand All @@ -339,6 +339,16 @@ function InvasionDetector:OutputTimers(chatType)
end
end

function InvasionDetector:TryNotifyGuild(message)
Utility:TryNotifyGuild(
InvasionDetector.HasAddon,
message,
function(rosterIndex)
return Utility:IsGuildMemberInInstance(rosterIndex);
end
);
end

local frame = CreateFrame("Frame", "InvasionDetectorFrame");

frame:RegisterEvent("ADDON_LOADED");
Expand Down

0 comments on commit e414911

Please sign in to comment.