Skip to content

Commit

Permalink
Restore classic era and SoM functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonomit committed Jan 31, 2023
1 parent 48e043f commit e81f6b8
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 16 deletions.
52 changes: 49 additions & 3 deletions LootReserve.lua
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,52 @@ function LootReserve:RegisterEvent(...)
end
end

function LootReserve:SetResizeBounds(frame, minWidth, minHeight, maxWidth, maxHeight)
if frame.SetResizeBounds then
frame:SetResizeBounds(minWidth, minHeight, maxWidth, maxHeight);
else
if minWidth or minHeight then
frame:SetMinResize(minWidth, minHeight);
end
if maxWidth or maxHeight then
frame:SetMaxResize(maxWidth, maxHeight);
end
end
end

function LootReserve:GetContainerItemInfo(bag, slot)
local containerInfo;
if C_Container then
containerInfo = C_Container.GetContainerItemInfo(bag, slot);
else
local icon, itemCount, locked, quality, readable, lootable, itemLink, isFiltered, noValue, itemID, isBound = GetContainerItemInfo(bag, slot);
if itemLink then
containerInfo = {
iconFileID = icon,
stackCount = itemCount,
isLocked = locked,
quality = quality,
isReadable = readable,
hasLoot = lootable,
hyperlink = itemLink,
isFiltered = isFiltered,
hasNoValue = noValue,
itemID = itemID,
isBound = isBound,
};
end
end
return containerInfo;
end

function LootReserve:GetContainerNumSlots(bag)
return C_Container and C_Container.GetContainerNumSlots(bag) or GetContainerNumSlots(bag);
end

function LootReserve:PickupContainerItem(bag, slot)
return C_Container and C_Container.PickupContainerItem(bag, slot) or PickupContainerItem(bag, slot);
end

function LootReserve:OpenMenu(menu, menuContainer, anchor)
if L_UIDROPDOWNMENU_OPEN_MENU == menuContainer then
CloseMenus();
Expand Down Expand Up @@ -667,7 +713,7 @@ function LootReserve:IsTradeableItem(bag, slot)
end

local function CacheBagSlot(self, bag, slot, i)
local containerInfo = C_Container.GetContainerItemInfo(bag, slot);
local containerInfo = LootReserve:GetContainerItemInfo(bag, slot);
if containerInfo then
if i then
table.insert(self.BagCache, i, {bag = bag, slot = slot, item = self.ItemCache:Item(containerInfo.hyperlink), quantity = containerInfo.stackCount, locked = containerInfo.isLocked});
Expand Down Expand Up @@ -700,7 +746,7 @@ local function CheckBagCache(self)
if not self.BagCache then
self.BagCache = { };
for bag = 0, NUM_BAG_SLOTS do
for slot = 1, C_Container.GetContainerNumSlots(bag) do
for slot = 1, LootReserve:GetContainerNumSlots(bag) do
CacheBagSlot(self, bag, slot);
end
end
Expand Down Expand Up @@ -815,7 +861,7 @@ end
function LootReserve:PutItemInTrade(bag, slot)
for i = 1, 6 do
if not GetTradePlayerItemInfo(i) then
C_Container.PickupContainerItem(bag, slot);
self:PickupContainerItem(bag, slot);
ClickTradeButton(i);
return true;
end
Expand Down
2 changes: 1 addition & 1 deletion Windows/ClientWindow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ function LootReserve.Client:OnWindowLoad(window)
self.Window.TopLeftCorner:SetSize(32, 32); -- Blizzard UI bug?
self.Window.TitleText:SetPoint("TOP", self.Window, "TOP", 0, -4);
self.Window.TitleText:SetText("LootReserve");
self.Window:SetResizeBounds(550, 250);
LootReserve:SetResizeBounds(self.Window, 550, 250);
self:UpdateCategories();
self:UpdateReserveStatus();
LootReserve:RegisterUpdate(function(elapsed)
Expand Down
2 changes: 1 addition & 1 deletion Windows/RollRequestWindow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ local function RollRequested(self, sender, item, players, custom, duration, maxD
frame.DurationFrame:SetHeight(math.max(durationHeight, 0.00001));

frame:SetHeight(90 + durationHeight);
frame:SetResizeBounds(300, 90 + durationHeight, 1000, 90 + durationHeight);
LootReserve:SetResizeBounds(frame, 300, 90 + durationHeight, 1000, 90 + durationHeight);

frame:Show();

Expand Down
2 changes: 1 addition & 1 deletion Windows/ServerExportWindow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ function LootReserve.Server.Export:OnWindowLoad(window)
self.Window = window;
self.Window.TopLeftCorner:SetSize(32, 32); -- Blizzard UI bug?
self.Window.TitleText:SetText("LootReserve Host - Export");
self.Window:SetResizeBounds(300, 130);
LootReserve:SetResizeBounds(self.Window, 300, 130);
end
4 changes: 2 additions & 2 deletions Windows/ServerImportWindow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function LootReserve.Server.Import:UpdateReservesList()
if not self.Window:IsShown() then return; end

self.Window.Header.Name:SetWidth(LootReserve:IsCrossRealm() and 300 or 200);
self.Window:SetResizeBounds(LootReserve:IsCrossRealm() and 490 or 390, 440);
LootReserve:SetResizeBounds(self.Window, LootReserve:IsCrossRealm() and 490 or 390, 440);

local list = self.Window.Scroll.Container;
list.Frames = list.Frames or { };
Expand Down Expand Up @@ -705,7 +705,7 @@ function LootReserve.Server.Import:OnWindowLoad(window)
self.Window = window;
self.Window.TopLeftCorner:SetSize(32, 32); -- Blizzard UI bug?
self.Window.TitleText:SetText("LootReserve Host - Import");
self.Window:SetResizeBounds(LootReserve:IsCrossRealm() and 490 or 390, 460);
LootReserve:SetResizeBounds(self.Window, LootReserve:IsCrossRealm() and 490 or 390, 460);
self.Window.InputOptions.Input.MatchPlayerNames:SetChecked(self.MatchPlayerNames);
self:InputUpdated();
end
2 changes: 1 addition & 1 deletion Windows/ServerLootEditWindow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,6 @@ function LootReserve.Server.LootEdit:OnWindowLoad(window)
self.Window = window;
self.Window.TopLeftCorner:SetSize(32, 32); -- Blizzard UI bug?
self.Window.TitleText:SetText("LootReserve Host - Loot List Edit");
self.Window:SetResizeBounds(550, 250);
LootReserve:SetResizeBounds(self.Window, 550, 250);
self:UpdateCategories();
end
4 changes: 2 additions & 2 deletions Windows/ServerMembersEditWindow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function LootReserve.Server.MembersEdit:UpdateMembersList()
if not self.Window:IsShown() then return; end

self.Window.Header.Name:SetWidth(LootReserve:IsCrossRealm() and 300 or 200);
self.Window:SetResizeBounds(LootReserve:IsCrossRealm() and 650 or 550, 150);
LootReserve:SetResizeBounds(self.Window, LootReserve:IsCrossRealm() and 650 or 550, 150);

local list = self.Window.Scroll.Container;
list.Frames = list.Frames or { };
Expand Down Expand Up @@ -173,6 +173,6 @@ function LootReserve.Server.MembersEdit:OnWindowLoad(window)
self.Window = window;
self.Window.TopLeftCorner:SetSize(32, 32); -- Blizzard UI bug?
self.Window.TitleText:SetText("LootReserve Host - Players");
self.Window:SetResizeBounds(LootReserve:IsCrossRealm() and 650 or 550, 150);
LootReserve:SetResizeBounds(self.Window, LootReserve:IsCrossRealm() and 650 or 550, 150);
self:UpdateMembersList();
end
2 changes: 1 addition & 1 deletion Windows/ServerWindow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ function LootReserve.Server:OnWindowLoad(window)
self.Window.TopLeftCorner:SetSize(32, 32); -- Blizzard UI bug?
self.Window.TitleText:SetPoint("TOP", self.Window, "TOP", 0, -4);
self.Window.TitleText:SetText("LootReserve Host");
self.Window:SetResizeBounds(230, 365);
LootReserve:SetResizeBounds(self.Window, 230, 365);
self.Window.PanelSession.LabelDuration:SetPoint("RIGHT", self.Window.PanelSession.DropDownDuration.Text, "LEFT", -16, 0);
self.Window.PanelSession.DropDownDuration:SetPoint("CENTER", self.Window.PanelSession.Duration, "CENTER", (6 + self.Window.PanelSession.LabelDuration:GetStringWidth()) / 2, 0);
PanelTemplates_SetNumTabs(self.Window, 3);
Expand Down
8 changes: 4 additions & 4 deletions Windows/ServerWindow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@
end
end
elseif CheckInteractDistance(unit, 2) then
C_Container.PickupContainerItem(bag, slot);
LootReserve:PickupContainerItem(bag, slot);
DropItemOnUnit(unit);
C_Timer.After(1, function() ClearCursor(); end);
elseif LootReserve:CanUseDBMLocator(unit) then
Expand Down Expand Up @@ -1117,7 +1117,7 @@
end
local bag, slot = LootReserve:GetBagSlot(item);
if bag and slot then
C_Container.PickupContainerItem(bag, slot);
LootReserve:PickupContainerItem(bag, slot);
ClickTradeButton(i);
i = i + 1;
end
Expand Down Expand Up @@ -1608,12 +1608,12 @@
end
local bagMenus = { };
for bag = 0, 4 do
local slots = C_Container.GetContainerNumSlots(bag);
local slots = LootReserve:GetContainerNumSlots(bag);
if slots > 0 then
local bagMenu = { };
table.insert(bagMenus, bagMenu);
for slot = 1, slots do
local containerInfo = C_Container.GetContainerItemInfo(bag, slot);
local containerInfo = LootReserve:GetContainerItemInfo(bag, slot);
if containerInfo and (not C_Item.IsBound(ItemLocation:CreateFromBagAndSlot(bag, slot)) or LootReserve:IsItemSoulboundTradeable(bag, slot)) then
table.insert(bagMenu, MakeItem(containerInfo.stackCount, LootReserve.ItemCache:Item(containerInfo.hyperlink), containerInfo.iconFileID));
end
Expand Down

0 comments on commit e81f6b8

Please sign in to comment.