-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3cb7af0
Showing
11 changed files
with
598 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--EZTrade.lua | ||
|
||
local addonName, EZT = ... | ||
|
||
---@class f:Frame | ||
local f = CreateFrame("Frame") | ||
|
||
local function isRelevantLoot(classID) | ||
if (classID == 2 and EZTradeDB.trackWeapons) then | ||
return true | ||
elseif (classID == 4 and EZTradeDB.trackArmors) then | ||
return true | ||
elseif (classID == 9 and EZTradeDB.trackRecipe) then | ||
return true | ||
elseif (classID == 17 and EZTradeDB.trackPets) then | ||
return true | ||
--elseif (classID == 0 or classID == 15) then -- Temporary | ||
-- return true | ||
else | ||
return false | ||
end | ||
end | ||
|
||
local function isMyLoot(lootText, localizedLootString) | ||
if (string.sub(lootText, 1, #localizedLootString) == localizedLootString) then | ||
return true | ||
else | ||
return false | ||
end | ||
end | ||
|
||
function f:TRADE_SHOW() | ||
EZT.OnTrade() | ||
end | ||
|
||
function f:TRADE_CLOSED() | ||
EZT.OffTrade() | ||
end | ||
|
||
function f:ADDON_LOADED(addon) | ||
if addon == "EZTrade" then | ||
EZTradeDB = EZTradeDB or CopyTable(EZT.addonDefaults) | ||
EZT.InitOptions() | ||
EZT.debugPrint(addonName .. " v" .. EZT.addon.version .. " is loaded.") | ||
|
||
if EZTradeDB.debug then | ||
EZT.setUpDebugFrame() | ||
end | ||
end | ||
end | ||
|
||
function f:CHAT_MSG_LOOT(lootText) | ||
local localizedLootString = LOOT_ITEM_SELF:gsub("%%s", ""):gsub("%.$", "") | ||
|
||
local itemLinkTmp = string.match(lootText, "|c.-|h|r") | ||
--local itemId = GetItemInfoFromHyperlink(itemLinkTmp) | ||
|
||
if (itemLinkTmp) then | ||
local itemName, itemLink, itemQuality, itemLevel, itemMinLevel, itemType, | ||
itemSubType, itemStackCount, itemEquipLoc, itemTexture, sellPrice, classID, | ||
subclassID, bindType, expansionID, setID, isCraftingReagent = C_Item.GetItemInfo(itemLinkTmp) | ||
|
||
EZT.debugPrint(itemLink .. classID) | ||
|
||
if (isMyLoot(lootText, localizedLootString)) then -- Only add "my" loot to the list. | ||
---@diagnostic disable-next-line: undefined-field | ||
if (isRelevantLoot(classID)) then -- Only add relevant loot | ||
EZT.AddLoot(itemLinkTmp) | ||
--EZT.RedrawLootList() | ||
end | ||
end | ||
end | ||
end | ||
|
||
f:SetScript("OnEvent", function(self, event, ...) | ||
self[event](self, ...) | ||
end) | ||
|
||
f:RegisterEvent("ADDON_LOADED") | ||
f:RegisterEvent("CHAT_MSG_LOOT") | ||
f:RegisterEvent("TRADE_SHOW") | ||
f:RegisterEvent("TRADE_CLOSED") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## Interface: 100206 | ||
## Name: EZTrade | ||
## Title: |cff45D388EZTrade|r | ||
## Notes: EZ trade items you recently looted | ||
## Author: Pinta365@Github | ||
## Version: 0.0.1 | ||
## SavedVariables: EZTradeDB | ||
## IconTexture: Interface\AddOns\EZTrade\Textures\pinta | ||
|
||
src\Config.lua | ||
src\Utilities.lua | ||
src\SlashCommand.lua | ||
src\OptionsPanel.lua | ||
src\DebugPanel.lua | ||
src\TradePanel.lua | ||
EZTrade.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## EZTrade | ||
|
||
Your bags are a chaotic mess of reagents, grey vendor trash, and that epic trinket you just won. Your friends are green with envy, but you can't even find the darn thing to trade it to them. **EZTrade** to the rescue! | ||
|
||
![Image of the trade panel](https://cdn.pinta.land/ezt/ezt1.png) | ||
|
||
### Features | ||
|
||
* **Convenient Loot List:** Displays recent loot next to your trade frame for easy access. | ||
* **Item Icons:** Visually identify your loot with item icons and full name if expanded. | ||
* **Right-Click Actions:** Trade directly from the loot list via right click. | ||
* **Tooltip Integration:** Hover over items for detailed tooltips. | ||
|
||
### Slash Commands | ||
|
||
EZTrade comes with handy slash commands to streamline your experience: | ||
|
||
* `/ezt`, `/eztrade`: Opens the EZTrade options panel. | ||
* `/ezt help`: Displays help message. | ||
* `/ezt reset`: Resets addon settings to their defaults and reloads the UI. | ||
|
||
### Troubleshooting | ||
|
||
If you encounter any issues: | ||
|
||
* **Try `/ezt reset`:** This will reset EZTrade's settings to defaults, which may resolve common problems especially over version upgrades. | ||
* **Reach out for Support:** If the issue persists, please open an issue on the [GitHub repository](https://github.com/Pinta365/EZTrade/issues) or reach out on [Discord](https://discord.gg/e7wuPgnSYC). |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--Config.lua | ||
|
||
local _, EZT = ... | ||
|
||
--Addon information parsed from TOC | ||
EZT.addon = { | ||
title = C_AddOns.GetAddOnMetadata("EZTrade", "Title"), | ||
version = C_AddOns.GetAddOnMetadata("EZTrade", "Version") | ||
} | ||
|
||
--Default configuration | ||
EZT.addonDefaults = { | ||
debug = false, | ||
trackWeapons = true, | ||
trackArmors = true, | ||
trackRecipe = true, | ||
trackPets = true | ||
} | ||
|
||
--Helper color codes | ||
EZT.colors = { | ||
PRIMARY = "ff45D388", | ||
WHITE = "ffFFFFFF", | ||
YELLOW = "ffFFFF00", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--DebugPanel.lua | ||
|
||
local addonName, EZT = ... | ||
|
||
|
||
|
||
EZT.setUpDebugFrame = function() | ||
---@class EZTDebugFrame: Frame | ||
local EZTDebugFrame = CreateFrame("Frame", "EZTradeFrame", UIParent, "BasicFrameTemplateWithInset") | ||
EZTDebugFrame:SetSize(250, 350) | ||
EZTDebugFrame:SetPoint("CENTER", -150, 250) | ||
EZTDebugFrame:Show() | ||
|
||
EZT.makeFrameMovable(EZTDebugFrame) | ||
|
||
-- DEBUG BUTTONS | ||
-- DEBUG BUTTONS | ||
|
||
local dbx = 10 | ||
local dby = 10 | ||
local button1 = CreateFrame("Button", "Pattern: Toxic Thorn Footwraps", EZTDebugFrame, "UIPanelButtonTemplate") | ||
button1:SetPoint("TOPLEFT", 25 + dbx, -(25 + dby)) | ||
---@diagnostic disable-next-line: undefined-field | ||
button1.Text:SetText("Pattern: Toxic Thorn Footwraps") | ||
button1:SetWidth(200) | ||
EZT.setOrHookHandler(button1, "OnClick", function(self) | ||
EZT.AddLoot("|cffa335ee|Hitem:193869::::::::4:1448:::::::::|h[Pattern: Toxic Thorn Footwraps]|h|r") | ||
--EZT.RedrawLootList() | ||
end) | ||
|
||
local button2 = CreateFrame("Button", "Dathea's Cyclonic Cage", EZTDebugFrame, "UIPanelButtonTemplate") | ||
button2:SetPoint("TOPLEFT", 25 + dbx, -(50 + dby)) | ||
---@diagnostic disable-next-line: undefined-field | ||
button2.Text:SetText("Dathea's Cyclonic Cage") | ||
button2:SetWidth(200) | ||
EZT.setOrHookHandler(button2, "OnClick", function(self) | ||
EZT.AddLoot("|cffa335ee|Hitem:195494::::::::4:1448:::::::::|h[Dathea's Cyclonic Cage]|h|r") | ||
--EZT.RedrawLootList() | ||
end) | ||
|
||
local button3 = CreateFrame("Button", "Sargha's Smasher", EZTDebugFrame, "UIPanelButtonTemplate") | ||
button3:SetPoint("TOPLEFT", 25 + dbx, -(75 + dby)) | ||
---@diagnostic disable-next-line: undefined-field | ||
button3.Text:SetText("Sargha's Smasher") | ||
button3:SetWidth(200) | ||
EZT.setOrHookHandler(button3, "OnClick", function(self) | ||
EZT.AddLoot("|cff0070dd|Hitem:193779::::::::4:1448:::::::::|h[Sargha's Smasher]|h|r") | ||
--EZT.RedrawLootList() | ||
end) | ||
|
||
local button4 = CreateFrame("Button", "Eye of Allseeing", EZTDebugFrame, "UIPanelButtonTemplate") | ||
button4:SetPoint("TOPLEFT", 25 + dbx, -(100 + dby)) | ||
---@diagnostic disable-next-line: undefined-field | ||
button4.Text:SetText("Eye of Allseeing") | ||
button4:SetWidth(200) | ||
EZT.setOrHookHandler(button4, "OnClick", function(self) | ||
EZT.AddLoot("|cff1eff00|Hitem:186554::::::::4:1448:::::::::|h[Eye of Allseeing]|h|r") | ||
--EZT.RedrawLootList() | ||
end) | ||
|
||
local button5 = CreateFrame("Button", "Redraw", EZTDebugFrame, "UIPanelButtonTemplate") | ||
button5:SetPoint("TOPLEFT", 25 + dbx, -(125 + dby)) | ||
---@diagnostic disable-next-line: undefined-field | ||
button5.Text:SetText("Redraw") | ||
button5:SetWidth(200) | ||
EZT.setOrHookHandler(button5, "OnClick", function(self) | ||
EZT.RedrawLootList() | ||
end) | ||
|
||
|
||
-- DEBUG BUTTONS | ||
-- DEBUG BUTTONS | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
--OptionsPanel.lua | ||
---@diagnostic disable: undefined-doc-name | ||
|
||
local addonName, EZT = ... | ||
|
||
---Helper function to create option check button. | ||
---@param parent optionsPanel | ||
---@param displayText string Text associated to options item | ||
---@param name string name of item | ||
---@param x number x position | ||
---@param y number y position | ||
---@return CheckButton|InterfaceOptionsCheckButtonTemplate | ||
local function createOptionCheckButton(parent, displayText, name, x, y) | ||
local checkbutton = CreateFrame("CheckButton", name, parent, "InterfaceOptionsCheckButtonTemplate") | ||
checkbutton:SetPoint("TOPLEFT", x, y) | ||
---@diagnostic disable-next-line: undefined-field | ||
checkbutton.Text:SetText(displayText) | ||
return checkbutton | ||
end | ||
|
||
---Helper function to create option button. | ||
---@param parent optionsPanel | ||
---@param displayText string Text associated to options item | ||
---@param name string name of item | ||
---@param x number x position | ||
---@param y number y position | ||
---@param w number width of button | ||
---@param h number height of button | ||
---@return Button|UIPanelButtonTemplate | ||
local function createOptionButton(parent, displayText, name, x, y, w, h) | ||
local button = CreateFrame("Button", name, parent, "UIPanelButtonTemplate") | ||
button:SetPoint("TOPLEFT", x, y) | ||
button:SetWidth(w) | ||
button:SetHeight(h) | ||
---@diagnostic disable-next-line: undefined-field | ||
button.Text:SetText(displayText) | ||
return button | ||
end | ||
|
||
---Create the options panel | ||
EZT.InitOptions = function() | ||
---@class optionsPanel : Frame | ||
local optionsPanel = CreateFrame("Frame", "AddonOptionsPanel", InterfaceOptionsFramePanelContainer) | ||
optionsPanel.name = addonName | ||
|
||
-- Create a toggle for the "Debug" option. | ||
local debugCheckbox = createOptionCheckButton(optionsPanel, "Debug mode (developer mode)", "ToggleDebugCheckbox", 16, -16) | ||
EZT.setOrHookHandler(debugCheckbox, "OnClick", function(self) | ||
EZTradeDB.debug = self:GetChecked() | ||
end) | ||
debugCheckbox:SetChecked(EZTradeDB.debug) | ||
|
||
-- Loot options | ||
|
||
optionsPanel.lootHeader = optionsPanel:CreateFontString(nil, "OVERLAY", "GameFontHighlightMedium") | ||
optionsPanel.lootHeader:SetPoint("TOPLEFT", 16, -100) | ||
optionsPanel.lootHeader:SetText("Loot tracking") | ||
|
||
local trackWeapons = createOptionCheckButton(optionsPanel, "Track weapons", "trackWeaponsButton", 16, -120) | ||
EZT.setOrHookHandler(trackWeapons, "OnClick", function(self) | ||
EZTradeDB.trackWeapons = self:GetChecked() | ||
end) | ||
trackWeapons:SetChecked(EZTradeDB.trackWeapons) | ||
|
||
local trackArmors = createOptionCheckButton(optionsPanel, "Track armors", "trackArmorsButton", 16, -140) | ||
EZT.setOrHookHandler(trackArmors, "OnClick", function(self) | ||
EZTradeDB.trackArmors = self:GetChecked() | ||
end) | ||
trackArmors:SetChecked(EZTradeDB.trackArmors) | ||
|
||
local trackRecipe = createOptionCheckButton(optionsPanel, "Track recipies", "trackRecipeButton", 16, -160) | ||
EZT.setOrHookHandler(trackRecipe, "OnClick", function(self) | ||
EZTradeDB.trackRecipe = self:GetChecked() | ||
end) | ||
trackRecipe:SetChecked(EZTradeDB.trackRecipe) | ||
|
||
local trackPets = createOptionCheckButton(optionsPanel, "Track battle pets", "trackPetsButton", 16, -180) | ||
EZT.setOrHookHandler(trackPets, "OnClick", function(self) | ||
EZTradeDB.trackPets = self:GetChecked() | ||
end) | ||
trackPets:SetChecked(EZTradeDB.trackPets) | ||
|
||
-- Button for resetting to default settings. | ||
local resetButton = createOptionButton(optionsPanel, "Reset settings", "resetButton", 16, -48, 100, 25) | ||
EZT.setOrHookHandler(resetButton, "OnClick", function() | ||
EZTradeDB = CopyTable(EZT.addonDefaults) | ||
debugCheckbox:SetChecked(EZTradeDB.debug) | ||
trackWeapons:SetChecked(EZTradeDB.trackWeapons) | ||
trackArmors:SetChecked(EZTradeDB.trackArmors) | ||
trackRecipe:SetChecked(EZTradeDB.trackRecipe) | ||
trackPets:SetChecked(EZTradeDB.trackPets) | ||
end) | ||
|
||
optionsPanel.versionInfo = optionsPanel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") | ||
optionsPanel.versionInfo:SetPoint("BOTTOMRIGHT", optionsPanel, -10, 10) | ||
optionsPanel.versionInfo:SetText(addonName .. " v" .. EZT.addon.version) | ||
--Add panel to interface | ||
InterfaceOptions_AddCategory(optionsPanel) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--SlashCommand.lua | ||
|
||
local addonName, EZT = ... | ||
|
||
SLASH_EZTrade_CMD1 = '/ezt' | ||
SLASH_EZTrade_CMD2 = '/eztrade' | ||
|
||
---@param args string arguments following the slash command | ||
SlashCmdList["EZTrade_CMD"] = function(args) | ||
local lowercaseArgs = string.lower(args) | ||
|
||
if lowercaseArgs == "help" or lowercaseArgs == "info" or lowercaseArgs == "?" then | ||
print(WrapTextInColorCode("-------------------------------------------------", EZT.colors["YELLOW"])) | ||
print(EZT.addon.title .. " v" .. EZT.addon.version) | ||
print(WrapTextInColorCode("-------------------------------------------------", EZT.colors["YELLOW"])) | ||
|
||
print("Usage:") | ||
print(" " .. WrapTextInColorCode("/ezt", EZT.colors["YELLOW"]) .. " - Show options panel") | ||
print(" " .. WrapTextInColorCode("/ezt help", EZT.colors["YELLOW"]) .. " - Show this help info") | ||
print(" " .. WrapTextInColorCode("/ezt reset", EZT.colors["YELLOW"]) .. " - Reset to default settings and reload UI") | ||
print(WrapTextInColorCode("-------------------------------------------------", EZT.colors["YELLOW"])) | ||
elseif lowercaseArgs == "reset" then | ||
--Reset to default settings. | ||
EZTradeDB = CopyTable(EZT.addonDefaults) | ||
ReloadUI() | ||
else | ||
InterfaceOptionsFrame_OpenToCategory("EZTrade") | ||
end | ||
end |
Oops, something went wrong.