Skip to content

Commit

Permalink
Allow the report rolls/reserves button to whisper ungrouped targets
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonomit committed Nov 7, 2024
1 parent d5fa724 commit 2d6d100
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions LootReserve.lua
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ function LootReserve:FixText(text)
return text:gsub("\1", " ");
end

function LootReserve:SendChatMessage(text, channel, target)
function LootReserve:SendChatMessage(text, channel, target, skipOnlineCheck)
if channel == "RAID_WARNING" and not (UnitIsGroupLeader("player") or UnitIsGroupAssistant("player")) then
channel = "RAID";
end
Expand All @@ -426,7 +426,7 @@ function LootReserve:SendChatMessage(text, channel, target)
if channel == "PARTY" and not IsInGroup() then
channel, target = "WHISPER", LootReserve:Me();
end
if target and not LootReserve:IsPlayerOnline(target) then return; end
if target and not LootReserve:IsPlayerOnline(target) and not skipOnlineCheck then return; end
local function Send(text)
if #text > 0 then
text = self:FixText(text);
Expand Down
15 changes: 8 additions & 7 deletions Windows/ServerWindow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -981,10 +981,11 @@
disabled = not condition,
func = function(info)
local frame = self:GetParent():GetParent();
if not frame.Roll then return; end
if not frame.Roll then LootReserve:debug("test") return; end
local recipient = UnitIsPlayer("target") and UnitIsConnected("target") and UnitNameUnmodified("target");
if info.arg1 == "WHISPER" and not recipient then
LootReserve:PrintError("Target is not a valid player to whisper.")
LootReserve:PrintError("Target is not a valid player to whisper.");
LootReserve:debug("test2")
return;
end

Expand All @@ -1006,22 +1007,22 @@
frame.Link,
frame.Roll.Phases and format(" for %s", frame.Roll.Phases[1] or "") or "",
frame.Historical and format(" on %s", (frame.ItemFrame.Misc:GetText() or ""):gsub("%s%s", " at ")) or ""
), info.arg1, recipient);
), info.arg1, recipient, true);
local i = 1;
for player, roll, rollNumber in LootReserve.Server:GetOrderedPlayerRolls(frame.Roll.Players) do
if roll > LootReserve.Constants.RollType.NotRolled and (not self.Lines or self.Lines == 0 or self.Lines >= i) then
if frame.Roll.Tiered then
roll = LootReserve.Server:ConvertFromTieredRoll(roll) .. "/" .. math.floor(roll);
end
LootReserve:SendChatMessage(format(" %s %s %s", roll, frame.Roll.RaidRoll and "=" or "by", player), info.arg1, recipient);
LootReserve:SendChatMessage(format(" %s %s %s", roll, frame.Roll.RaidRoll and "=" or "by", player), info.arg1, recipient, true);
i = i + 1;
end
end
if i == 1 then
if frame.Roll.Winners then
LootReserve:SendChatMessage(format(" %s by %s", frame.Roll.Disenchant and "Disenchanted" or "Reserved", frame.Roll.Winners[1]), info.arg1, recipient);
LootReserve:SendChatMessage(format(" %s by %s", frame.Roll.Disenchant and "Disenchanted" or "Reserved", frame.Roll.Winners[1]), info.arg1, recipient, true);
else
LootReserve:SendChatMessage(" No Rolls", info.arg1, recipient);
LootReserve:SendChatMessage(" No Rolls", info.arg1, recipient, true);
end
end
end,
Expand Down Expand Up @@ -1102,7 +1103,7 @@
end

local reservesText = LootReserve:GetReservesData(LootReserve.Server.CurrentSession.ItemReserves[frame.Item:GetID()].Players);
LootReserve:SendChatMessage(format("Reserves for %s: %s", frame.Link, reservesText), info.arg1, recipient);
LootReserve:SendChatMessage(format("Reserves for %s: %s", frame.Link, reservesText), info.arg1, recipient, true);
end,
};
end
Expand Down

0 comments on commit 2d6d100

Please sign in to comment.