Skip to content

Commit

Permalink
Fix issues #181, #182
Browse files Browse the repository at this point in the history
  • Loading branch information
b-morgan committed Aug 24, 2024
1 parent 5d26cef commit 4bfc3f2
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 30 deletions.
9 changes: 9 additions & 0 deletions SkilletNewsData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ local isCata = WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC

Skillet.NewsName = "Skillet-Classic News"
Skillet.NewsData = {
{ version = "1.96",
data = {
{ name = "Fixes",
data = {
{ header = "Display required level", body = "Fixes for issues #181, #182" },
},
},
},
},
{ version = "1.95",
data = {
{ name = "Fixes",
Expand Down
32 changes: 14 additions & 18 deletions UI/MainFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -675,16 +675,14 @@ function Skillet:TradeButton_OnEnter(button)
local rank, maxRank = data.rank, data.maxRank
GameTooltip:AddLine("["..tostring(rank).."/"..tostring(maxRank).."]",0,1,0)
if tradeID == self.currentTrade then
local link
if GetTradeSkillListLink then
local link = GetTradeSkillListLink()
if link then
GameTooltip:AddLine(L["shift-click to link"])
elseif C_TradeSkillUI then
link = C_TradeSkillUI.GetTradeSkillListLink()
if link then
GameTooltip:AddLine(L["shift-click to link"])
end
end
link = GetTradeSkillListLink()
elseif C_TradeSkillUI.GetTradeSkillListLink then
link = C_TradeSkillUI.GetTradeSkillListLink()
end
if link then
GameTooltip:AddLine(L["shift-click to link"])
end
end
local buttonIcon = _G[button:GetName().."Icon"]
Expand Down Expand Up @@ -722,16 +720,14 @@ function Skillet:TradeButton_OnClick(this,button)
if button == "LeftButton" then
if player == self.currentPlayer and self.currentTrade then
if self.currentTrade == tradeID and IsShiftKeyDown() then
local link
if GetTradeSkillListLink then
local link = GetTradeSkillListLink()
if link then
ChatEdit_InsertLink(link)
elseif C_TradeSkillUI then
link = C_TradeSkillUI.GetTradeSkillListLink()
if link then
ChatEdit_InsertLink(link)
end
end
link = GetTradeSkillListLink()
elseif C_TradeSkillUI.GetTradeSkillListLink then
link = C_TradeSkillUI.GetTradeSkillListLink()
end
if link then
ChatEdit_InsertLink(link)
end
elseif self.currentTrade ~= tradeID then
if self.skillIsCraft[self.currentTrade] ~= self.skillIsCraft[tradeID] then
Expand Down
32 changes: 20 additions & 12 deletions UI/Sorting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,29 @@ local function sort_recipe_by_skill_level(tradeskill, a, b)
end

local function sort_recipe_by_item_level(tradeskill, a, b)
local left_r, left, right_r, right, _
while a.subGroup and #a.subGroup.entries>0 do
a = a.subGroup.entries[1]
end
while b.subGroup and #b.subGroup.entries>0 do
b = b.subGroup.entries[1]
end
local left_r = Skillet:GetRecipe(a.recipeID)
local right_r = Skillet:GetRecipe(b.recipeID)
local left = Skillet:GetLevelRequiredToUse(left_r.itemID)
local right = Skillet:GetLevelRequiredToUse(right_r.itemID)
left_r = Skillet:GetRecipe(a.recipeID)
right_r = Skillet:GetRecipe(b.recipeID)
left = Skillet:GetLevelRequiredToUse(left_r.itemID)
right = Skillet:GetLevelRequiredToUse(right_r.itemID)
if not left then left = 0 end
if not right then right = 0 end
if left == right then
--
-- Same level, try iLevel next
--
local left = select(4,GetItemInfo(left_r.itemID)) or 0
local right = select(4,GetItemInfo(right_r.itemID)) or 0
if left_r.itemID then
left = select(4,GetItemInfo(left_r.itemID)) or 0
end
if right_r.itemID then
right = select(4,GetItemInfo(right_r.itemID)) or 0
end
if left == right then
--
-- Same level, sort by difficulty
Expand All @@ -106,18 +111,21 @@ local function sort_recipe_by_item_level(tradeskill, a, b)
end

local function sort_recipe_by_item_quality(tradeskill, a, b)
local left_r, left, right_r, right
while a.subGroup and #a.subGroup.entries>0 do
a = a.subGroup.entries[1]
end
while b.subGroup and #b.subGroup.entries>0 do
b = b.subGroup.entries[1]
end
local left_r = Skillet:GetRecipe(a.recipeID)
local right_r = Skillet:GetRecipe(b.recipeID)
local _,_, left = GetItemInfo(left_r.itemID)
local _,_, right = GetItemInfo(right_r.itemID)
if not left then left = 0 end
if not right then right = 0 end
left_r = Skillet:GetRecipe(a.recipeID)
right_r = Skillet:GetRecipe(b.recipeID)
if left_r.itemID then
left = select(3,GetItemInfo(left_r.itemID)) or 0
end
if right_r.itemID then
right = select(3,GetItemInfo(right_r.itemID)) or 0
end
if left == right then
--
-- Same level, sort by level required to use
Expand Down

0 comments on commit 4bfc3f2

Please sign in to comment.