Skip to content

Commit

Permalink
Added button group for catalyst items (Closes #257)
Browse files Browse the repository at this point in the history
  • Loading branch information
evil-morfar committed Sep 24, 2024
1 parent 7dc8968 commit bb7385b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
23 changes: 18 additions & 5 deletions Core/Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ addon.OPT_MORE_BUTTONS_VALUES = {
MOUNTS = _G.MOUNTS,
BAGSLOT = _G.BAGSLOT,
RECIPE = _G.AUCTION_CATEGORY_RECIPES,
CATALYST = L.Catalyst_Items, -- items that can be converted to tier through catalyst
}

--- Inventory types that can be converted to tier
addon.CATALYST_ITEMS = {
INVTYPE_HEAD = true,
INVTYPE_SHOULDER = true,
INVTYPE_CHEST = true,
INVTYPE_ROBE = true, -- same as chest
INVTYPE_HAND = true,
INVTYPE_LEGS = true,
}

--[[
Expand Down Expand Up @@ -104,11 +115,9 @@ addon.CLASS_TO_ATLAS = {
}

--- Functions used for generating response codes
-- Functions are run numerically, and the first to return non-nil is used, i.e. order matters!
-- To add a new a button group, simply add it to the options menu (easily done by adding an entry to OPT_MORE_BUTTONS_VALUES), and add a function here to determine if that group should be used for the item.
-- Each function receives the following parameters:
-- item, db (addon:Getdb()), itemID, itemEquipLoc,itemClassID, itemSubClassID
---@type (fun(item: Item, db: RCLootCouncil.db, itemID: integer, itemEquipLoc: string, itemClassID: Enum.ItemClass): string|nil) []
--- Functions are run numerically, and the first to return non-nil is used, i.e. order matters!
--- To add a new a button group, simply add it to the options menu (easily done by adding an entry to OPT_MORE_BUTTONS_VALUES), and add a function here to determine if that group should be used for the item.
---@type (fun(item: string|integer, db: RCLootCouncil.db, itemID: integer, itemEquipLoc: string, itemClassID: Enum.ItemClass, itemSubClassID: Enum.ItemMiscellaneousSubclass): string?) []
addon.RESPONSE_CODE_GENERATORS = {
-- Chest/Robe
function(_, db, _, equipLoc)
Expand Down Expand Up @@ -171,6 +180,10 @@ addon.RESPONSE_CODE_GENERATORS = {
return "RECIPE"
end
end,
-- Catalyst
function(_, db, _, itemEquipLoc)
return db.enabledButtons.CATALYST and addon.CATALYST_ITEMS[itemEquipLoc] and "CATALYST" or nil
end,
}

--- @alias VersionCodes
Expand Down
1 change: 1 addition & 0 deletions Locale/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ L["Candidate removed"] = true
L["Candidates that can't use the item"] = true
L["Cannot autoaward:"] = true
L["Cannot give 'item' to 'player' due to Blizzard limitations. Gave it to you for distribution."] = "Cannot give %s to %s due to Blizzard limitations. Gave it to you for distribution."
L.Catalyst_Items = "Catalyst Items"
L["Change Award"] = true
L["Change Response"] = true
L["Changing loot threshold to enable Auto Awarding"] = true
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Changes

### Buttons and Responses

Added button group for Catalyst items. (#257)

### Options and Commands

Added option to not store personal loot in the history.
Expand Down
6 changes: 3 additions & 3 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -953,9 +953,9 @@ end

--- Generates a "type code" used to determine which set of buttons to use for the item.
--- The returned code can be used directly in `mldb.responses[code]` and `mldb.buttons[code]`.
--- @see Constants.lua#RESPONSE_CODE_GENERATORS.
--- @param item Item @Any valid input for C_Item.GetItemInfoInstant
--- @return typecode
--- <br>See [Constants.lua](lua://RCLootCouncil.RESPONSE_CODE_GENERATORS)
--- @param item string|integer Any valid input for [`C_Item.GetItemInfoInstant`](lua://C_Item.GetItemInfoInstant).
--- @return string #The typecode for the item.
function RCLootCouncil:GetTypeCodeForItem(item)
local itemID, _, _, itemEquipLoc, _, itemClassID, itemSubClassID = C_Item.GetItemInfoInstant(item)
if not itemID then return "default" end -- We can't handle uncached items!
Expand Down

0 comments on commit bb7385b

Please sign in to comment.