Skip to content

Commit

Permalink
1.5.0 (Pre)
Browse files Browse the repository at this point in the history
- Backpack Item Tracker: For Baganator users, this widget's position is now handled by Baganator.
  • Loading branch information
Peterodox committed Dec 9, 2024
1 parent d8b55e9 commit e027fa4
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 81 deletions.
3 changes: 2 additions & 1 deletion ControlCenter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ local CATEGORY_ORDER = {

[1] = "General",
[2] = "NPC Interaction",
[3] = "Class",
[3] = "Tooltip",
[4] = "Class",

--Patch Feature uses the tocVersion and #00
[10020000] = "Dragonflight",
Expand Down
8 changes: 5 additions & 3 deletions Locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ L["Module Category General"] = "General";
--- order: 2
L["Module Category NPC Interaction"] = "NPC Interaction";
--- order: 3
L["Module Category Tooltip"] = "Tooltip"; --Additional Info on Tooltips
--- order: 4
L["Module Category Class"] = "Class"; --Player Class (rogue, paladin...)

L["Module Category Dragonflight"] = EXPANSION_NAME9 or "Dragonflight"; --Merge Expansion Feature (Dreamseeds, AzerothianArchives) Modules into this
Expand Down Expand Up @@ -161,17 +163,17 @@ L["Seed Color Uncommon"] = ICON_TAG_RAID_TARGET_TRIANGLE3 or "Green";


--Tooltip Chest Keys
L["ModuleName TooltipChestKeys"] = "Tooltip: Chest Keys";
L["ModuleName TooltipChestKeys"] = "Chest Keys";
L["ModuleDescription TooltipChestKeys"] = "Show info on the key required to open the current chest or door.";


--Tooltip Reputation Tokens
L["ModuleName TooltipRepTokens"] = "Tooltip: Reputation Tokens";
L["ModuleName TooltipRepTokens"] = "Reputation Tokens";
L["ModuleDescription TooltipRepTokens"] = "Show the faction info if the item can be used to increase reputation.";


--Tooltip Mount Recolor
L["ModuleName TooltipSnapdragonTreats"] = "Tooltip: Snapdragon Treats";
L["ModuleName TooltipSnapdragonTreats"] = "Snapdragon Treats";
L["ModuleDescription TooltipSnapdragonTreats"] = "Add additional info to Snapdragon Treats.";
L["Color Applied"] = "This is the currently applied color.";

Expand Down
2 changes: 2 additions & 0 deletions Locales/ruRU.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ L["Module Category General"] = "Общие";
--- order: 2
L["Module Category NPC Interaction"] = "Взаимодействие с НПС";
--- order: 3
--L["Module Category Tooltip"] = "Tooltip"; --Additional Info on Tooltips
--- order: 4
L["Module Category Class"] = "Класс"; --Player Class (rogue, paladin...)

L["Module Category Dragonflight"] = EXPANSION_NAME9 or "Dragonflight"; --Merge Expansion Feature (Dreamseeds, AzerothianArchives) Modules into this
Expand Down
12 changes: 10 additions & 2 deletions Locales/zhCN.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ L["Module Category General"] = "常规";
--- order: 2
L["Module Category NPC Interaction"] = "NPC 交互";
--- order: 3
L["Module Category Tooltip"] = "鼠标提示"; --Additional Info on Tooltips
--- order: 4
L["Module Category Class"] = "职业"; --Player Class (rogue, paladin...)

L["Module Category Dragonflight"] = "巨龙时代";
Expand Down Expand Up @@ -161,15 +163,21 @@ L["Seed Color Uncommon"] = "绿色";


--Tooltip Chest Keys
L["ModuleName TooltipChestKeys"] = "鼠标提示:宝箱钥匙";
L["ModuleName TooltipChestKeys"] = "宝箱钥匙";
L["ModuleDescription TooltipChestKeys"] = "显示打开某些宝箱所需的钥匙信息。";


--Tooltip Reputation Tokens
L["ModuleName TooltipRepTokens"] = "鼠标提示:声望兑换物";
L["ModuleName TooltipRepTokens"] = "声望兑换物";
L["ModuleDescription TooltipRepTokens"] = "如果当前物品可以被直接使用来提升某一阵营的声望,显示此声望信息";


--Tooltip Mount Recolor
L["ModuleName TooltipSnapdragonTreats"] = "毒鳍龙";
L["ModuleDescription TooltipSnapdragonTreats"] = "在毒鳍龙鼠标提示上显示额外信息。";
L["Color Applied"] = "你正在使用这个配色。";


--Merchant UI Price
L["ModuleName MerchantPrice"] = "商品价格";
L["ModuleDescription MerchantPrice"] = "改变商人界面的默认行为:\n\n- 只把数量不足的货币变灰。\n\n- 在钱币方框内显示当前页面所需的所有货币。";
Expand Down
136 changes: 64 additions & 72 deletions Modules/BackpackItemTracker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1014,12 +1014,12 @@ local function SettingsFrame_ToggleUIAtCursorPosition()
end
end

do
--Tray Button: [itemCount][itemIcon]
do --Tray Button: [itemCount][itemIcon]
TrackerFrame.TrayButtons = {};

local ICON_SIZE = 12;
local TEXT_ICON_GAP = 2;
local FONT_OBJECT = "GameFontHighlightSmall";

local TrayButtonMixin = {};

Expand All @@ -1029,7 +1029,7 @@ do
self.Icon:SetPoint("RIGHT", self, "RIGHT", 0, 0);
self.Icon:SetTexCoord(0.0625, 0.9375, 0.0625, 0.9375);

self.Count = self:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall");
self.Count = self:CreateFontString(nil, "ARTWORK", FONT_OBJECT);
self.Count:SetJustifyH("RIGHT");
self.Count:SetPoint("RIGHT", self.Icon, "LEFT", -TEXT_ICON_GAP, 0);

Expand Down Expand Up @@ -1289,6 +1289,14 @@ do
self:UpdateTray(true);
end
end

function TrackerFrame:SetTrayButtonFont(fontObject)
FONT_OBJECT = fontObject;
for _, button in pairs(self.TrayButtons) do
button.Count:SetFontObject(fontObject);
button.Count:SetJustifyH("RIGHT");
end
end
end

do
Expand Down Expand Up @@ -1871,7 +1879,7 @@ function TrackerFrame:UpdateTray(manual)
if manual and not wasTracked[itemID] then
API.UIFrameFadeIn(button, 0.5);
end

if resetPoint then
button:SetHeight(TRAY_BUTTON_HEIGHT);
button:ClearAllPoints();
Expand Down Expand Up @@ -1910,7 +1918,7 @@ function TrackerFrame:UpdateTray(manual)
fullWidth = TRAY_FRAME_MAX_WDITH;
end

self:SetWidth(fullWidth);
self:SetFrameWidth(fullWidth);
self.Border:SetWidth(math.max(fullWidth, RECEPTOR_MIN_WIDTH));
end

Expand All @@ -1925,6 +1933,10 @@ function TrackerFrame:UpdateTray(manual)
self:UpdateBackgroundVisibility();
end

function TrackerFrame:SetFrameWidth(width)
self:SetWidth(width);
end

function TrackerFrame:CalculateHeight()
if self.effectiveHeight then
return self.effectiveHeight + 3;
Expand Down Expand Up @@ -2273,76 +2285,64 @@ function TrackerFrame:ParentTo_LiteBag()
end

function TrackerFrame:ParentTo_Baganator()
local backpackView1 = Baganator_SingleViewBackpackViewFrame;
local backpackView2 = Baganator_CategoryViewBackpackViewFrame;
if not (Baganator and Baganator.API) then return end;

local parent = backpackView1;
local RegisterRegion = Baganator.API.RegisterRegion;
local RequestLayoutUpdate = Baganator.API.RequestLayoutUpdate;

if not parent then return end;
if not RegisterRegion then return end;

self.isBlizzardBag = false;
self:SetShowBackground(true);
self:SetParent(parent);
self:SetShowBackground(false);
self:SetScript("OnShow", TrackerFrame_Update_OnShow);
self:Show();
self:SetClampedToScreen(false);
self:ClearAllPoints();
self.Border:ClearAllPoints();
self.Border:SetPoint("LEFT", self, "LEFT", BORDER_SHRINK, 0);

local isSingleView = true;
local anchorTo = backpackView1;

local function Callback_AllocateBags()
if isSingleView and anchorTo.lastBagDetails then
local numButtons = anchorTo.lastBagDetails.special and #anchorTo.lastBagDetails.special or 0;
local fromOffset = 0;
local iconButtonWidth = 32;
local buttonSpacing = 5;
local offset = (numButtons) * (iconButtonWidth + buttonSpacing) + fromOffset;
if anchorTo.BagLive then
self:ClearAllPoints();
self:SetPoint("LEFT", anchorTo.BagLive, "LEFT", offset, 0);
self:SetPoint("BOTTOM", anchorTo, "BOTTOM", 0, 9);
end
end
end
local RegionDummy = CreateFrame("Frame");
RegionDummy:SetSize(16, 12);
self:SetParent(RegionDummy);
self:SetPoint("LEFT", RegionDummy, "LEFT", 0, -1);

self:SetTrayButtonFont("GameFontHighlight");

--Supporting Category Group View
local label = "Plumber";
local id = "plumber";
local viewType = "backpack";
local position = "bottom_left";
local region = RegionDummy;
RegisterRegion(label, id, viewType, position, region);

if backpackView1 and backpackView1:GetScript("OnShow") ~= nil then
backpackView1:HookScript("OnShow", function()
if not isSingleView then
isSingleView = true;
self:ClearAllPoints();
self.Border:ClearAllPoints();
self:SetParent(backpackView1);
Callback_AllocateBags();
end
end);
end

if backpackView2 and backpackView2:GetScript("OnShow") ~= nil then
backpackView2:HookScript("OnShow", function()
if isSingleView then
isSingleView = false;
self:ClearAllPoints();
self.Border:ClearAllPoints();
self:SetParent(backpackView2);
self:SetPoint("LEFT", backpackView2, "BOTTOMLEFT", 17, 17);
self.Border:SetPoint("LEFT", self, "LEFT", BORDER_SHRINK, 0);
end
end);
if RequestLayoutUpdate then
--Our frame can still overlap with money frame if the user tracks a lot of stuff
function TrackerFrame:SetFrameWidth(width)
TrackerFrame:SetWidth(width);
RegionDummy:SetWidth(width);
RequestLayoutUpdate();
end
end

if Baganator.CallbackRegistry then
local currentText;

if anchorTo then
if anchorTo.AllocateBags then
hooksecurefunc(backpackView1, "AllocateBags", Callback_AllocateBags)
function TrackerFrame:SearchItemByID(itemID)
if itemID then
local itemName = C_Item.GetItemNameByID(itemID);
if currentText and currentText ~= "" and string.find(string.lower(itemName), string.lower(currentText)) then
Baganator.CallbackRegistry:TriggerEvent("SearchTextChanged", "");
else
if itemName and itemName ~= "" then
Baganator.CallbackRegistry:TriggerEvent("SearchTextChanged", string.lower(itemName));
end
end
end
end
self:SetPoint("LEFT", anchorTo, "BOTTOMLEFT", 54, 17);
self.Border:SetPoint("LEFT", self, "LEFT", BORDER_SHRINK, 0);
else
self:Hide();

Baganator.CallbackRegistry:RegisterCallback("SearchTextChanged", function(_, text)
currentText = text;
end)
end
end

Expand All @@ -2361,7 +2361,6 @@ function TrackerFrame:ParentTo_BetterBags()
RepositionUtil.parent = parent;
self:ClearAllPoints();
self.Border:ClearAllPoints();

self.Border:SetPoint("LEFT", self, "LEFT", BORDER_SHRINK, 0);

local anchorOutside = true;
Expand Down Expand Up @@ -2396,10 +2395,8 @@ local GetAddOnSearchBox = {
return box
end,

Baganator = function()
local bagFarme = Baganator_SingleViewBackpackViewFrame;
return bagFarme and bagFarme.SearchBox
end,
Nop = function()
end
};


Expand Down Expand Up @@ -2453,14 +2450,9 @@ local function AnchorToCompatibleAddOn()
--This addon is using stock searchbox
end
elseif IsAddOnLoaded("Baganator") then
--Baganator is being actively developed
--Available space (width) is affected by Bag Columns, we ignore it for now
local bagFrame = Baganator_SingleViewBackpackViewFrame;
if bagFrame then
TrackerFrame.UpdateAnchor = DoesNothing;
TrackerFrame:ParentTo_Baganator();
GetSearchBox = GetAddOnSearchBox.Baganator;
end
TrackerFrame.UpdateAnchor = DoesNothing;
TrackerFrame:ParentTo_Baganator();
GetSearchBox = GetAddOnSearchBox.Nop;
elseif IsAddOnLoaded("BetterBags") then --New Adibags(Still WIP)
local bagFrame = BetterBagsBagBackpack; --WTF is this name
if bagFrame then
Expand Down
2 changes: 1 addition & 1 deletion Modules/GameTooltip_Key.lua
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ do
dbKey = "TooltipChestKeys",
description = addon.L["ModuleDescription TooltipChestKeys"],
toggleFunc = EnableModule,
categoryID = 1,
categoryID = 3,
uiOrder = 1110,
moduleAddedTime = 1718500000,
};
Expand Down
2 changes: 1 addition & 1 deletion Modules/GameTooltip_MountRecolor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ do
dbKey = ItemSubModule:GetDBKey(),
description = addon.L["ModuleDescription TooltipSnapdragonTreats"],
toggleFunc = EnableModule,
categoryID = 1,
categoryID = 3,
uiOrder = 1150,
moduleAddedTime = 1726674500,
};
Expand Down
2 changes: 1 addition & 1 deletion Modules/GameTooltip_ReputationItem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ do
dbKey = ItemSubModule:GetDBKey(),
description = addon.L["ModuleDescription TooltipRepTokens"],
toggleFunc = EnableModule,
categoryID = 1,
categoryID = 3,
uiOrder = 1111,
moduleAddedTime = 1726674500,
};
Expand Down

0 comments on commit e027fa4

Please sign in to comment.