Skip to content

Commit

Permalink
Added support for items with suffixes, starting to add Throne items
Browse files Browse the repository at this point in the history
  • Loading branch information
snowflame0 committed Oct 19, 2024
1 parent aedac0e commit 6925b2c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.
3 changes: 2 additions & 1 deletion AtlasLootClassic/Button/Button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
petID = 123,
questID = 123,
mountID = 123,
suffixID = 123,
}
]]

Expand Down Expand Up @@ -720,7 +721,7 @@ function Proto:SetContentTable(tab, formatTab, setOnlySec)
end
end
if not found and button_types[formatType] and button_types[formatType].GetStringContent then
self:SetType(formatType, button_types[formatType].GetStringContent(curContent))
self:SetType(formatType, button_types[formatType].GetStringContent(curContent))
end
elseif button_types[curContent] then
self.__atlaslootinfo[formatType] = nil
Expand Down
23 changes: 19 additions & 4 deletions AtlasLootClassic/Button/Item_type.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ local tonumber = _G.tonumber
local assert = _G.assert
local next, wipe, tab_remove = _G.next, _G.wipe, _G.table.remove
local format, split, sfind, slower = _G.string.format, _G.string.split, _G.string.find, _G.string.lower
local str_match = string.match

-- WoW
local GetItemInfo, IsEquippableItem, GetItemInfoInstant = _G.GetItemInfo, _G.IsEquippableItem, _G.GetItemInfoInstant
local LOOT_BORDER_BY_QUALITY = _G["LOOT_BORDER_BY_QUALITY"]

--[[
-- Items with suffixes format "i<itemID>suf<suffixID" e.g. "i68132suf-131"
SuffixID will often be negative
]]

-- AL
local GetAlTooltip = AtlasLoot.Tooltip.GetTooltip
local GetItemDescInfo = AtlasLoot.ItemInfo.GetDescription
Expand Down Expand Up @@ -90,8 +96,9 @@ function Item.OnSet(button, second)
if not button then return end
if second and button.__atlaslootinfo.secType then
if type(button.__atlaslootinfo.secType[2]) == "table" then
button.secButton.ItemID = button.__atlaslootinfo.secType[2].itemID or tonumber(tab_remove(button.__atlaslootinfo.secType[2], 1))
button.secButton.ItemString = button.__atlaslootinfo.secType[2].itemString or GetItemString(button.secButton.ItemID)
button.secButton.ItemID = button.__atlaslootinfo.secType[2][1] or tonumber(tab_remove(button.__atlaslootinfo.secType[2], 1))
button.secButton.SuffixID = button.__atlaslootinfo.secType[2].SuffixID or button.__atlaslootinfo.secType[2][2] or 0
button.secButton.ItemString = button.__atlaslootinfo.secType[2].itemString or GetItemString(button.secButton.ItemID, false, button.secButton.SuffixID)
else
button.secButton.ItemID = button.__atlaslootinfo.secType[2]
if button.__atlaslootinfo.preSet and button.__atlaslootinfo.preSet.Item and ( button.__atlaslootinfo.preSet.Item.item2bonus or button.__atlaslootinfo.ItemDifficulty ) then
Expand All @@ -105,7 +112,8 @@ function Item.OnSet(button, second)
else
if type(button.__atlaslootinfo.type[2]) == "table" then
button.ItemID = button.__atlaslootinfo.type[2].itemID or tonumber(tab_remove(button.__atlaslootinfo.type[2], 1))
button.ItemString = button.__atlaslootinfo.type[2].itemString or GetItemString(button.ItemID)
button.SuffixID = button.__atlaslootinfo.type[2].SuffixID or button.__atlaslootinfo.secType[2][2] or 0
button.ItemString = button.__atlaslootinfo.type[2].itemString or GetItemString(button.ItemID, false, button.SuffixID)
else
button.ItemID = button.__atlaslootinfo.type[2]
if button.__atlaslootinfo.preSet and button.__atlaslootinfo.preSet.Item and ( button.__atlaslootinfo.preSet.Item.item1bonus or button.__atlaslootinfo.ItemDifficulty ) then
Expand Down Expand Up @@ -271,12 +279,14 @@ function Item.OnClear(button)
button.SetData = nil
button.RawName = nil
button.ItemLvl = nil
button.SuffixID = nil
button.secButton.ItemID = nil
button.secButton.Droprate = nil
button.secButton.ItemString = nil
button.secButton.SetData = nil
button.secButton.RawName = nil
button.secButton.ItemLvl = nil
button.secButton.SuffixID = nil
button.secButton.pvp:Hide()

itemIsOnEnter = nil
Expand Down Expand Up @@ -382,7 +392,12 @@ function Item.Refresh(button)
end

function Item.GetStringContent(str)
if tonumber(str) then
if tonumber(str_match(str, "suf(%-?%d+)")) then
return {
tonumber(str_match(str, "(%d+)")),
tonumber(str_match(str, "suf(%-?%d+)")), -- suffix item
}
elseif tonumber(str) then
return tonumber(str)
else
return {
Expand Down
11 changes: 6 additions & 5 deletions AtlasLootClassic/Core/ItemString.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ AtlasLoot.ItemString = ItemString
-- lua
local format = string.format

local ITEM_FORMAT_STRING = "item:%d:0:0:0:0:0:0:0:0:0:0:0:0"
local ITEM_FORMAT_STRING = "item:%d:0:0:0:0:0:%d:0:0:0:0:0:0"
local ITEM_HEIRLOOM_FORMAT_STRING = "item:%d:0:0:0:0:0:0:0:%d"


function ItemString.Create(itemID, isHeirloom)
function ItemString.Create(itemID, isHeirloom, suffixID)
suffixID = tonumber(suffixID) or 0
--DevTools_Dump(format(ITEM_FORMAT_STRING, itemID, suffixID))
if isHeirloom then
return format( ITEM_HEIRLOOM_FORMAT_STRING,
itemID, -- itemID
UnitLevel("player") -- playerLvl
)
else
return format( ITEM_FORMAT_STRING,
itemID -- itemID
itemID, -- itemID
suffixID -- suffixID
)
end
end


2 changes: 1 addition & 1 deletion AtlasLootClassic/Core/Tooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ local PLAYER_GUID_REGISTER = {
["Player-4811-036A6EAE"] = format("|T135349:0|t "..COLOR, "AtlasLoot Friend"), -- Ref / Sinon
["Player-4453-045E4E4D"] = format("|T135349:0|t "..COLOR, "AtlasLoot Friend"), -- Max
["Player-4440-0376FFAC"] = format("|T135349:0|t "..COLOR, "AtlasLoot Friend"), -- Balendil / Nekarra
["Player-4395-02368B3D"] = format("|T135349:0|t "..COLOR, "AtlasLoot Friend"), -- Snowflame
["Player-4395-02368B3D"] = format("|T523897:0|t "..COLOR, "AtlasLoot Author"), -- Snowflame
}

local function AddText(self)
Expand Down
2 changes: 1 addition & 1 deletion AtlasLootClassic/Data/Token.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ if AtlasLoot:GameVersion_GE(AtlasLoot.CATA_VERSION_NUM) then
[71086] = 71141, -- Dragonwrath, Tarecgosa's Rest
[69848] = 71141, -- Heart of Flame
--- Items with suffixes from Throne
[68132] = {"i68132:0:0:0:0:0:-129","i68132:0:0:0:0:0:-128","i68132:0:0:0:0:0:-127"},
[68132] = {"i68132suf-131","i68132suf-129","i68132suf-114","i68132suf-130","i68132suf-138","i68132suf-132",type=2},
--- ## Baradin Hold
--- Argaloth
-- Non-ClassSet-Items
Expand Down

0 comments on commit 6925b2c

Please sign in to comment.