Skip to content

Commit

Permalink
Prepared Gargul for some of Cata's potential namespace changes
Browse files Browse the repository at this point in the history
  • Loading branch information
papa-smurf committed Mar 9, 2024
1 parent e9c1d35 commit df8c74d
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Classes/DroppedLootLedger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ function DroppedLootLedger:lootOpened()
return;
end

local itemID = GetItemInfoInstant(itemLink);
local itemID = GL:getItemInfoInstant(itemLink);
if (not itemID) then
return;
end
Expand Down
4 changes: 2 additions & 2 deletions Classes/GDKP/Auction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ function Auction:sanitize(Instance)
end

--[[ Make sure the item ID is valid ]]
SanitizedAuction.itemID = GetItemInfoInstant(Instance.itemID);
SanitizedAuction.itemID = GL:getItemInfoInstant(Instance.itemID);
if (not tonumber(SanitizedAuction.itemID)) then
GL:xd("Auction:sanitize step 4 failed, contact support!");
return false;
Expand Down Expand Up @@ -1199,7 +1199,7 @@ function Auction:announceStart(itemLink, minimumBid, minimumIncrement, duration,
end

local itemID = GL:getItemIDFromLink(itemLink) or 0;
if (itemID < 1 or not GetItemInfoInstant(itemID)) then
if (itemID < 1 or not GL:getItemInfoInstant(itemID)) then
self.waitingForStart = false;
GL:warning("Invalid item provided for GDKP auction start!");
return false;
Expand Down
2 changes: 1 addition & 1 deletion Classes/GDKP/Auctioneer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function Auctioneer:addToQueue(itemLink, identifier, open)

-- Make sure the item actually exists
local itemID = GL:getItemIDFromLink(itemLink);
if (not itemID or not GetItemInfoInstant(itemID)) then
if (not itemID or not GL:getItemInfoInstant(itemID)) then
return;
end

Expand Down
2 changes: 1 addition & 1 deletion Classes/GDKP/GDKP.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function GDKP:importPerItemSettings(data)
local minimum = tonumber(defaultMinimum);
local increment = tonumber(defaultIncrement);

if (not itemID or not GetItemInfoInstant(itemID)) then
if (not itemID or not GL:getItemInfoInstant(itemID)) then
if (itemID) then
GL:error("Unknown item ID: " .. tostring(itemID));
return;
Expand Down
2 changes: 1 addition & 1 deletion Classes/GDKP/MultiAuction/Auctioneer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function Auctioneer:fillFromInventory(minimumQuality, includeBOEs, includeAwarde
end

-- Exclude projectiles (bullets and arrows)
local classID = select(12, GetItemInfo(itemID));
local classID = select(12, GL:getItemInfo(itemID));
if (classID == Enum.ItemClass.Projectile) then
return;
end
Expand Down
8 changes: 4 additions & 4 deletions Classes/GDKP/MultiAuction/Client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,13 @@ end
---@return void
function Client:autobid(auctionID, amount, onConfirm)
if (Auctioneer:auctionStartedByMe(auctionID)) then
Auctioneer:processBid({
Auctioneer:processBid{
Sender = {
fqn = GL.User.fqn,
isSelf = true,
},
content = GL:implode({ auctionID, amount, 1, }, "|"),
});
};

return onConfirm and onConfirm(true) or nil;
end
Expand Down Expand Up @@ -232,13 +232,13 @@ end
function Client:bid(auctionID, amount, onConfirm)

if (Auctioneer:auctionStartedByMe(auctionID)) then
Auctioneer:processBid({
Auctioneer:processBid{
Sender = {
fqn = GL.User.fqn,
isSelf = true,
},
content = GL:implode({ auctionID, amount, }, "|"),
});
};

return onConfirm and onConfirm(true) or nil;
end
Expand Down
30 changes: 28 additions & 2 deletions Classes/Helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ end
--- Courtesy of Lantis and the team over at Classic Loot Manager: https://github.com/ClassicLootManager/ClassicLootManager
function GL.LibStItemCellUpdate (rowFrame, frame, data, cols, row, realrow, column, fShow, table, ...)
local itemId = data[realrow].cols[column].value;
local _, _, _, _, icon = GetItemInfoInstant(itemId or 0);
local _, _, _, _, icon = GL:getItemInfoInstant(itemId or 0);
if icon then
frame:SetNormalTexture(icon);
frame:Show();
Expand Down Expand Up @@ -1401,7 +1401,7 @@ function GL:normalizeItem(ItemMixin)

-- Keep in mind that this data all refers to the base version of the item since we're using an ID
local itemName, itemLink, itemQuality, itemLevel, _, _, _, _, itemEquipLoc,
itemTexture, _, classID, subclassID, bindType, _, _, _ = GetItemInfo(itemID);
itemTexture, _, classID, subclassID, bindType, _, _, _ = GL:getItemInfo(itemID);

if (not itemLink) then
return false;
Expand Down Expand Up @@ -1876,6 +1876,32 @@ function GL:getItemGUIDByBagAndSlot(bag, slot)
return C_Item.GetItemGUID(Location);
end

---@return nil|any
function GL:getItemInfo(...)
if (GetItemInfo) then
return GetItemInfo(...);
end

if (C_Item and C_Item.GetItemInfo) then
return C_Item.GetItemInfo(...);
end

return nil;
end

---@return nil|any
function GL:getItemInfoInstant(...)
if (GetItemInfoInstant) then
return GetItemInfoInstant(...);
end

if (C_Item and C_Item.GetItemInfoInstant) then
return C_Item.GetItemInfoInstant(...);
end

return nil;
end

---@param bagID number
---@param slot number
---@return any
Expand Down
2 changes: 1 addition & 1 deletion Classes/MasterLooterUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ function MasterLooterUI:update()
end

-- The item's icon is in the 10th position
local icon = select(10, GetItemInfo(itemLink));
local icon = select(10, GL:getItemInfo(itemLink));

if (icon) then
GL.Interface:get(self, "Table.Players"):ClearSelection();
Expand Down
2 changes: 1 addition & 1 deletion Classes/PackMule.lua
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ function PackMule:lootReady()
return;
end

local itemID = GetItemInfoInstant(itemLink);
local itemID = GL:getItemInfoInstant(itemLink);
if (not itemID) then -- Should not be possible, but better safe than lua error
return;
end
Expand Down
2 changes: 1 addition & 1 deletion Data/Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ GL.Data.Constants = {
adjustMutatorIdentifier = "+___adjust___+",
adjustPercentageMutatorIdentifier = "+__%adjust%__+",
baseMutatorIdentifier = "+___base___+",
potIncreaseItemID = GetItemInfoInstant(45978) or 21100, -- Classic era doesn't have a solid gold coin, yikes!
potIncreaseItemID = GL.isEra and 21100 or 45978, -- Classic era doesn't have a solid gold coin, yikes!
},

GroupLootActions = {
Expand Down
2 changes: 1 addition & 1 deletion Interface/Award/Award.lua
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ function Award:update()
end

-- The item's icon is in the 10th position
local icon = select(10, GetItemInfo(itemLink));
local icon = select(10, GL:getItemInfo(itemLink));

if (icon) then
GL.Interface:get(self, "Table.Players"):ClearSelection();
Expand Down
3 changes: 1 addition & 2 deletions Interface/GroupVersionCheck.lua
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ function GroupVersionCheck:build()
local Items = CreateFrame("Frame", nil, PlayerHolder);
Items:SetAllPoints(PlayerHolder);

--[[ ADD AN ITEM TO THE QUEUE WINDOW ]]
local rowHeight = 20;
Window.addPlayer = function (_, Player)
---@type Frame
Expand Down Expand Up @@ -333,7 +332,7 @@ function GroupVersionCheck:refresh()
local player = C_FriendList.GetIgnoreName(i);

if (player and GL.User:unitInGroup(player)) then
tinsert(self.Results.Ignored, GL:nameFormat{ name = player, forceRealm = true, func = strlower });
tinsert(self.Results.Ignored, GL:nameFormat{ name = player, forceRealm = true, func = strlower, });
end
end
end
Expand Down

0 comments on commit df8c74d

Please sign in to comment.