/
get = "GetResetInNewParty", |
set = "SetResetInNewParty", |
}, |
resetInNewInstance = { |
name = L["Reset in Instance"], |
desc = L["Clear the item list when entering an instance"], |
type = "select", |
values = { |
always = "Always", |
ask = "Ask", |
never = "Never", |
}, |
style = "dropdown", |
order = 101, |
get = "GetResetInNewInstance", |
set = "SetResetInNewInstance", |
}, |
displayIcons = { |
name = L["Graphical Display"], |
showGroupOnly = true, |
autoPopUp = true, |
resetInNewParty = "ask", |
resetInNewInstance = "ask", |
} |
} |
-- For tracking grouped status |
local IS_IN_PARTY = nil |
-- For tracking ghost status |
local WAS_GHOST = nil |
-- Utility functions |
local function sanitizePattern(pattern) |
pattern = string.gsub(pattern, "%(", "%%(") |
self:RegisterEvent("CHAT_MSG_LOOT") |
self:RegisterEvent("PLAYER_REGEN_DISABLED") |
self:RegisterEvent("PLAYER_REGEN_ENABLED") |
self:RegisterEvent("PLAYER_ALIVE") |
self:ScheduleRepeatingTimer("ExpireItems", 10) |
end |
end |
local inInstance, instanceType = IsInInstance() |
if inInstance and (instanceType == "party" or instanceType == "raid") then |
-- Don't ask when making a graveyard run |
if not WAS_GHOST then |
if self.db.profile.resetInNewInstance == "always" and (#items ~= 0) then |
self:ClearItems() |
elseif self.db.profile.resetInNewInstance == "ask" and (#items ~= 0) then |
confirmResetDialog() |
end |
else |
WAS_GHOST = false |
end |
end |
self:SetShowLootSpam() |
end |
self:RefreshTooltip() |
end |
function NeedyGreedy:PLAYER_ALIVE() |
if not WAS_GHOST and UnitIsDeadOrGhost("player") then |
WAS_GHOST = true |
elseif WAS_GHOST then |
WAS_GHOST = false |
end |
end |
-- Chat scanning and loot recording |
function NeedyGreedy:START_LOOT_ROLL(event, rollid) |
local texture, name, count, quality = GetLootRollItemInfo(rollid) |
self.db.profile.resetInNewParty = resetInNewParty |
end |
function NeedyGreedy:GetResetInNewInstance(info) |
return self.db.profile.resetInNewInstance |
end |
function NeedyGreedy:SetResetInNewInstance(info, resetInNewInstance) |
self.db.profile.resetInNewInstance = resetInNewInstance |
end |
-- QTip Frames |
local LibQTip = LibStub('LibQTip-1.0') |
local COL_MIN_WIDTH = 60 |
L["Clear the item list when joining a new group"] = true |
L["Do you wish to reset NeedyGreedy?"] = true |
L["All items have been cleared."] = true |
L["Reset in Instance"] = true |
L["Clear the item list when entering an instance"] = true |
end |