Skip to content

Commit

Permalink
Further refinement
Browse files Browse the repository at this point in the history
  • Loading branch information
evil-morfar committed Sep 4, 2024
1 parent 3bdcf6d commit 6c56d1a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
9 changes: 5 additions & 4 deletions .specs/Classes/Utils/GroupLoot.spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -185,24 +185,25 @@ describe("#GroupLoot", function()
assert.equal(expected, GroupLoot:GetStatus())
end)

it("should return '111101111' when we should pass", function()
it("should return '11?101111' when we should pass", function()
addon.mldb = { autoGroupLoot = true, }
addon.handleLoot = true
addon.masterLooter = addon.player
addon.isInGuildGroup = true
assert.is.True(GroupLoot:ShouldPassOnLoot())
assert.is.False(GroupLoot:ShouldRollOnLoot())
assert.is.Equal(0x1ef, GroupLoot:GetStatus())
assert.is.Equal(0x1af, bit.band(GroupLoot:GetStatus(), 0x1af))
assert.is.Equal(0, bit.band(GroupLoot:GetStatus(), 0x10))
end)
it("should return '111111111' when we should roll", function()
it("should return '11?111111' when we should roll", function()
addon.mldb = { autoGroupLoot = true, }
addon.handleLoot = true
addon.masterLooter = addon.player
addon.isMasterLooter = true
addon.isInGuildGroup = true
assert.is.False(GroupLoot:ShouldPassOnLoot())
assert.is.True(GroupLoot:ShouldRollOnLoot())
assert.is.Equal(0x1ff, GroupLoot:GetStatus())
assert.is.Equal(0x1bf, bit.band(GroupLoot:GetStatus(), 0x1bf))
end)
end)

Expand Down
7 changes: 4 additions & 3 deletions Classes/Utils/GroupLoot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,15 @@ function GroupLoot:ShouldPassOnLoot()
return addon.mldb and addon.mldb.autoGroupLoot and addon.handleLoot and
addon.masterLooter and not addon.isMasterLooter and GetNumGroupMembers() > 1
and (db.autoGroupLootGuildGroupOnly and addon.isInGuildGroup or not db.autoGroupLootGuildGroupOnly)

-- return self:GetStatus() == 0x1ef -- 111101111
-- local status = self:GetStatus()
-- Bit 7 can be whatever, bit 5 must be 0, rest must be 1
-- return bit.band(status, 0x1af) == 0x1af and bit.band(status, 0x10) == 0-- 1.1010.1111 & 0.0001.0000
end

function GroupLoot:ShouldRollOnLoot()
return addon.mldb and addon.mldb.autoGroupLoot and addon.handleLoot and
addon.masterLooter and addon.isMasterLooter and GetNumGroupMembers() > 1
-- return bit.band(self:GetStatus(), 0x13f) == 0x13f -- 100111111
-- return bit.band(self:GetStatus(), 0x1bf) == 0x1bf -- 1.1011.1111
-- TODO Consider if we do care about the guild group thing as ML.
end

Expand Down
6 changes: 3 additions & 3 deletions Modules/versionCheck.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function RCVersionCheck:OnInitialize()
sort = ST.SORT_DSC,
sortnext = 2
},
{ name = "", width = 60} -- GroupLoot Status
{ name = "", width = 20} -- GroupLoot Status
}
self:InitCoreVersionComms()
self.subscriptions = {}
Expand Down Expand Up @@ -556,8 +556,8 @@ function RCVersionCheck.SetCellGroupLootStatus(rowFrame, frame, data, cols, row,
local status = data[realrow].cols[column].args[1]
local binary = addon.Utils:Int2Bin(status)
data[realrow].cols[column].value = status and binary or ""
frame.text:SetText(status)
frame:SetScript("OnEnter", function()
frame.text:SetText(status or "?")
frame:SetScript("OnEnter", function()
if status then
local description = GroupLoot:StatusToDescription(status)
addon:CreateTooltip("Status", binary, status, string.format("%x", status), unpack(description))
Expand Down

0 comments on commit 6c56d1a

Please sign in to comment.