Skip to content

Commit

Permalink
Merge branch 'release/3.14.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
evil-morfar committed Oct 9, 2024
2 parents 74082e9 + 80121ee commit 208f77a
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 100 deletions.
64 changes: 3 additions & 61 deletions .specs/Integration/VotingFrame/ReannounceOrRequestRoll.spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,6 @@ describe("#VotingFrame #ReannounceOrRequestRoll", function()
end
end)

it("ReannounceOrRequestRoll should use old system if council has pre v3.13.0", function()
addon.db.global.verTestCandidates = {
[(GetRaidRosterInfo(2))] = { "3.12.0", nil, time(), },
}
Council:Add(Player:Get((GetRaidRosterInfo(2))))
local responseWaitSpy = spy.new()
addon.Require "Services.Comms":Subscribe(addon.PREFIXES.MAIN, "ResponseWait", responseWaitSpy)
local changeResponseSpy = spy.new()
addon.Require "Services.Comms":Subscribe(addon.PREFIXES.MAIN, "change_response", changeResponseSpy)

WoWAPI_FireUpdate(GetTime() + 20)
VotingFrame:ReannounceOrRequestRoll(true, 1, false, false, false)
WoWAPI_FireUpdate(GetTime() + 30)

assert.spy(responseWaitSpy).was.called(0)
assert.spy(changeResponseSpy).was.called(GetNumGroupMembers())
end)

it("should change for everyone when both name- and sessionpred is true", function()
local receivedSpy = spy.new()
addon.Require "Services.Comms":Subscribe(addon.PREFIXES.MAIN, "ResponseWait", receivedSpy)
Expand Down Expand Up @@ -176,51 +158,11 @@ describe("#VotingFrame #ReannounceOrRequestRoll", function()

assert.spy(receivedSpy).was.called(1)
-- Now rolls should be reset:
for ses, data in ipairs(VotingFrame:GetLootTable()) do
for _, v in pairs(data.candidates) do
assert.Nil(v.roll)
end
end
end)

it("should use old system if council has pre v3.13.0", function()
addon.db.global.verTestCandidates = {
[(GetRaidRosterInfo(2))] = { "3.12.0", nil, time(), },
}
Council:Add(Player:Get((GetRaidRosterInfo(2))))
local receivedSpy = spy.new()
addon.Require "Services.Comms":Subscribe(addon.PREFIXES.MAIN, "reset_rolls", receivedSpy)
local rollsSpy = spy.new()
addon.Require "Services.Comms":Subscribe(addon.PREFIXES.MAIN, "rolls", rollsSpy)

WoWAPI_FireUpdate(GetTime())
VotingFrame:DoRandomRolls(1)
WoWAPI_FireUpdate()

-- Everyone should have a roll in session 1:
for ses, data in ipairs(VotingFrame:GetLootTable()) do
for name, v in pairs(data.candidates) do
if ses == 1 then
if name ~= addon.player.name then -- We might have timedout our roll
assert.are_not.equal("", v.roll)
assert.is.Number(v.roll)
end
else
assert.Nil(v.roll)
end
end
end
-- announceInChat just to have that called once
VotingFrame:ReannounceOrRequestRoll(true, 1, true, false, true)
WoWAPI_FireUpdate()

assert.spy(receivedSpy).was.called(0)
assert.spy(rollsSpy).was.called(1)
-- Now rolls should be reset:
for ses, data in ipairs(VotingFrame:GetLootTable()) do
for _, v in pairs(data.candidates) do
if ses == 1 then
assert.are.equal("", v.roll)
-- We might have autopassed
if name == addon.player.name and v.roll == "-" then
assert.equal("-", v.roll)
else
assert.Nil(v.roll)
end
Expand Down
2 changes: 1 addition & 1 deletion Core/Defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ addon.responses = {
-- Option table defaults
addon.defaults = {
global = {
logMaxEntries = 2000,
logMaxEntries = 4000,
log = {}, -- debug log
verTestCandidates = {}, -- Stores received verTests
errors = {},
Expand Down
2 changes: 0 additions & 2 deletions Modules/History/lootHistory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1411,15 +1411,13 @@ function LootHistory.RightClickMenu(menu, level)

info = MSA_DropDownMenu_CreateInfo()
for k,responses in pairs(db.responses) do
addon.Log:D("db.responses:", k)
if k ~= "default" and k ~= "*" then
info.text = addon.OPT_MORE_BUTTONS_VALUES[k] or _G.UNKNOWN
info.isTitle = true
info.disabled = true
info.notCheckable = true
MSA_DropDownMenu_AddButton(info, level)
for i, v in ipairs(responses) do --luacheck: ignore
addon.Log:D("responses:", i)
info.text = v.text
info.colorCode = "|cff"..addon.Utils:RGBToHex(unpack(v.color))
info.isTitle = false
Expand Down
1 change: 1 addition & 0 deletions Modules/lootFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ function LootFrame:OnRoll(entry, button)
self.EntryManager:Trash(entry)
self:Update()
else
addon.Log:D("LootFrame:OnRoll", button)
if button == "ROLL" then
-- Need to do system roll and wait for its result.
local entryInQueue = {sessions=item.sessions, entry=entry}
Expand Down
47 changes: 28 additions & 19 deletions Modules/votingFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
offline_timer T - ML sends offline timer.
response T - Candidate sends a response.
reset_rolls T - ML resets rolls.
re_roll T - Candidate sends reroll info. Only used here to reset rolls.
rrolls T - **DEPRECATED** Replaced with 'srolls'. ML sends random rolls info for a single session.
srolls T - ML sends random rolls info for one or more sessions.
roll T - Candidate sends roll info (interactive random roll).
Expand Down Expand Up @@ -173,6 +174,13 @@ function RCVotingFrame:RegisterComms ()
addon.Log:W("Non-ML", sender, "sent reset_rolls!")
end
end,
re_roll = function (data, sender)
if addon:IsMasterLooter(sender) then
self:OnReRollReceived(unpack(data))
else
addon.Log:W("Non-ML", sender, "sent re_roll!")
end
end,
-- Deprecated, replaced with 'rrolls'. Kept for backwards compatibility.
rolls = function (data, sender)
if addon:IsMasterLooter(sender) then
Expand Down Expand Up @@ -624,7 +632,7 @@ end

---@param data integer[] Array of session to reset all rolls on.
function RCVotingFrame:OnResetRollsReceived(data)
for _,session in ipairs(data) do
for _, session in ipairs(data) do
lootTable[session].hasRolls = false
for name in pairs(lootTable[session].candidates) do
self:SetCandidateData(session, name, "roll", nil)
Expand All @@ -633,6 +641,19 @@ function RCVotingFrame:OnResetRollsReceived(data)
self:Update()
end

---@param candidates string[] List of transmittable player GUIDs of candidates that should reroll.
---@param lt LootTable
function RCVotingFrame:OnReRollReceived(candidates, lt)
for _, data in pairs(lt) do
if data.isRoll then
for _, guid in ipairs(candidates) do
local name = Player:Get(guid).name
self:SetCandidateData(data.session, name, "roll", nil)
end
end
end
end

--- @deprecated
function RCVotingFrame:OnRollsReceived (session, table)
for name, roll in pairs(table) do
Expand Down Expand Up @@ -1787,66 +1808,53 @@ function RCVotingFrame:ReannounceOrRequestRoll(namePred, sesPred, isRoll, noAuto
local changeResponseData = TempTable:Acquire()
local rollsData = TempTable:Acquire()
local councilInGroup = Council:GetCouncilInGroup()
local hasVersion3_13_0 = addon.Utils:PlayersHasVersion(councilInGroup, "3.13.0")
TempTable:Release(councilInGroup)

for k,v in ipairs(lootTable) do
local rolls = {}
if sesPred == true or (type(sesPred)=="number" and addon:ItemIsItem(lootTable[k].link, lootTable[sesPred].link)) or (type(sesPred)=="function" and sesPred(k)) then
tinsert(rerollTable, RCVotingFrame:GetRerollData(k, isRoll, noAutopass))

for name, _ in pairs(v.candidates) do
if namePred == true or (type(namePred)=="string" and name == namePred) or (type(namePred)=="function" and namePred(name)) then
if not isRoll then
if not hasVersion3_13_0 then
addon:Send("group", "change_response", k, name, "WAIT")
end
if not changeResponseData[name] then
changeResponseData[name] = {}
end
tinsert(changeResponseData[name], k)
end
rolls[name] = ""
end
end
if isRoll then
if not hasVersion3_13_0 then
addon:Send("group", "rolls", k, rolls)
end
tinsert(rollsData, k)
end
end
end

if not isRoll and hasVersion3_13_0 then
if not isRoll then
local changeResponseDataForTransmit = TempTable:Acquire()
for name,v in pairs(changeResponseData) do
changeResponseDataForTransmit[Player:Get(name):GetForTransmit()] = table.concat(v, ",")
end
addon:Send("group", "ResponseWait", changeResponseDataForTransmit)
TempTable:Release(changeResponseDataForTransmit)
elseif isRoll and hasVersion3_13_0 then
addon:Send("group", "reset_rolls", rollsData)
end
TempTable:Release(changeResponseData)
TempTable:Release(rollsData)

if #rerollTable > 0 then
if announceInChat then
addon:GetActiveModule("masterlooter"):AnnounceItems(rerollTable, isRoll)
addon:GetActiveModule("masterlooter"):AnnounceItems(rerollTable)
end


if namePred == true then
if isRoll then
addon:Send("group", "reset_rolls", rollsData)
end
addon:Send("group", "reroll", rerollTable)
else
local candidates = TempTable:Acquire()
for name in pairs(lootTable[session].candidates) do
if (type(namePred)=="string" and name == namePred) or (type(namePred)=="function" and namePred(name)) then
tinsert(candidates, Player:Get(name):GetForTransmit())
if not addon.Utils:PlayerHasVersion(name, "3.13.0") then
addon:Send(Player:Get(name), "reroll", rerollTable)
end
end
end
if #candidates > 0 then
Expand All @@ -1859,6 +1867,7 @@ function RCVotingFrame:ReannounceOrRequestRoll(namePred, sesPred, isRoll, noAuto
end

TempTable:Release(rerollTable)
TempTable:Release(rollsData)
end

----------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions RCLootCouncil.toc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Author: Potdisc
## Interface: 110002
## Notes: Interface for running a Loot Council v3.14.0
## Notes: Interface for running a Loot Council v3.14.1
## Title: RCLootCouncil
## Version: 3.14.0
## Version: 3.14.1
## SavedVariables: RCLootCouncilDB, RCLootCouncilLootDB
## OptionalDeps: LibStub, CallbackHandler-1.0, Ace3, lib-st, LibWindow-1.1, LibDialog-1.0
## X-Curse-Project-ID: 39928
Expand Down
18 changes: 9 additions & 9 deletions Utils/TrinketData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1930,14 +1930,14 @@ _G.RCTrinketSpecs = {
[219915] = "0241000100024", -- Foul Behemoth's Chelicera, Tank
[212454] = "5134773647743", -- Mad Queen's Mandate, Damage
[212449] = "0124002607443", -- Sikran's Endless Arsenal, Damage, Melee
[212453] = "0000000700067", -- Skyterror's Corrosive Organ, Strength
[212453] = "0000000600043", -- Skyterror's Corrosive Organ, Damage, Strength
[212450] = "0241000100024", -- Swarmlord's Authority, Tank
[221023] = "73F7777777777", -- Treacherous Transmitter, All Classes
[212456] = "0365002007700", -- Void Reaper's Contract, Agility
[212456] = "0124002007700", -- Void Reaper's Contract, Damage, Agility
[219917] = "2082004030010", -- Creeping Coagulum, Healer
[212452] = "2082004030010", -- Gruesome Syringe, Healer
[220305] = "73F7777777777", -- Ovinax's Mercurial Egg, All Classes
[220202] = "5010771040000", -- Spymaster's Web, Damage, Intellect
[220305] = "73F7777777777", -- Ovi'nax's Mercurial Egg, All Classes
[220202] = "7092775070010", -- Spymaster's Web, Intellect
-- Nerub-ar Palace Heroic (id: 1273).
-- Nerub-ar Palace Mythic (id: 1273).
-- Nerub-ar Palace Looking For Raid (id: 1273).
Expand All @@ -1961,11 +1961,11 @@ _G.RCTrinketSpecs = {
-- Siege of Boralus Mythic Keystone (id: 1023).
-- Siege of Boralus Mythic (id: 1023).
-- Grim Batol Normal (id: 71).
[56463] = "2082004030010", -- Corrupted Egg Shell, Healer
[56462] = "7092775070010", -- Gale of Shadows, Intellect
[56458] = "0000000700067", -- Mark of Khardros, Strength
[56440] = "0365002007700", -- Skardyn's Grace, Agility
[56449] = "0201000100024", -- Throngus's Finger, Tank, Parry
[133305] = "2082004030010", -- Corrupted Egg Shell, Healer
[133304] = "7092775070010", -- Gale of Shadows, Intellect
[133300] = "0000000600043", -- Mark of Khardros, Damage, Strength
[133282] = "0124002007700", -- Skardyn's Grace, Damage, Agility
[133291] = "0201000100024", -- Throngus's Finger, Tank, Parry
-- Grim Batol Heroic (id: 71).
-- Grim Batol Mythic Keystone (id: 71).
-- Grim Batol Mythic (id: 71).
Expand Down
14 changes: 14 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# 3.14.1

## Changes

### Rolls

Requesting rolls now only resets the roll for the people requested.

Auto passing when requesting rolls will now show a '-' in the roll column, like when passing the roll.

## Bugfixes

- *Fixed wrong specs autopassing a few trinkets.*

# 3.14.0

## Changes
Expand Down
9 changes: 3 additions & 6 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,6 @@ function RCLootCouncil:OnEnable()
if self:VersionCompare(self.db.global.version, self.version) then self.db.global.oldVersion = self.db.global.version end
self.db.global.version = self.version

self.db.global.logMaxEntries = self.defaults.global.logMaxEntries -- reset it now for zzz

if self.tVersion then
self.db.global.logMaxEntries = 4000 -- bump it for test version
end
if self.db.global.tVersion and self.debug then -- recently ran a test version, so reset debugLog
self.db.global.log = {}
end
Expand Down Expand Up @@ -1140,7 +1135,7 @@ end
-- Autopass response is sent if the session has been autopassed. No other response is sent.
-- @param skip Only sends lootAcks on sessions > skip or 0
function RCLootCouncil:SendLootAck(table, skip)
local toSend = {gear1 = {}, gear2 = {}, diff = {}, response = {}}
local toSend = {gear1 = {}, gear2 = {}, diff = {}, response = {}, roll = {}}
local hasData = false
for k, v in pairs(table) do
local session = v.session or k
Expand All @@ -1152,8 +1147,10 @@ function RCLootCouncil:SendLootAck(table, skip)
toSend.gear2[session] = g2 and ItemUtils:GetItemStringClean(g2) or nil
toSend.diff[session] = diff
toSend.response[session] = v.autopass
toSend.roll[session] = v.isRoll and "-" or nil
end
end
if not next(toSend.roll) then toSend.roll = nil end
if hasData then self:Send("group", "lootAck", playersData.specID, playersData.ilvl, toSend) end
end

Expand Down

0 comments on commit 208f77a

Please sign in to comment.