Skip to content

Commit 5339c97

Browse files
committed
tradeskill: native single-column link viewer layout on stock 1.12.1
The link viewer mirrored Turtle's HD 768x512 two-column TradeSkillFrame, whose TW-TradeSkill art doesn't exist in the base 1.12.1 client — an earlier stretch fallback smeared the vanilla art's internal borders. Split every layout value that differs by client into an LO table gated on TURTLE_WOW_VERSION. On stock clients the viewer now mirrors the native Blizzard_TradeSkillUI geometry: 384x512, single column (list on top, detail below), built from the vanilla ClassTrainer + UI-TradeSkill quadrant art at native size, 8 visible rows, and the Exit button placed exactly where the base TradeSkillCancelButton sits. Turtle keeps its 768-wide two-column layout unchanged.
1 parent 7406ac5 commit 5339c97

1 file changed

Lines changed: 60 additions & 24 deletions

File tree

AddOns/!!!ClassicAPI/Util/TradeSkillLink.lua

Lines changed: 60 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,51 @@
1111
-- knows (with an "X of Y" summary of the whole skill line), regardless of what
1212
-- the reader can craft themselves.
1313

14-
-- Frame geometry mirrors the real TradeSkillFrame (Blizzard_TradeSkillUI):
15-
-- 768x512, TW-TradeSkill quadrant art, 19 rows of 16px, list at (37,-98).
16-
local FRAME_W, FRAME_H = 768, 512;
17-
local NUM_ROWS = 19;
14+
-- Frame geometry mirrors the real TradeSkillFrame. Turtle ships an HD
15+
-- 768x512 two-column frame (TW-TradeSkill art); stock 1.12.1 only has the
16+
-- vanilla 384x512 single-column art, so on that client we fall back to the
17+
-- native Blizzard_TradeSkillUI geometry (list on top, detail below) rather
18+
-- than stretch the wide art. LO holds every layout value that differs.
19+
local TURTLE = (TURTLE_WOW_VERSION ~= nil);
20+
local FRAME_W = TURTLE and 768 or 384;
21+
local FRAME_H = 512;
22+
local NUM_ROWS = TURTLE and 19 or 8;
1823
local ROW_HEIGHT = 16;
1924

25+
local LO = TURTLE and {
26+
hit = { 2, 82, 2, 73 },
27+
quads = {
28+
{ "Interface\\TradeSkillFrame\\TW-TradeSkill-TopLeft", 512, 256, "TOPLEFT" },
29+
{ "Interface\\TradeSkillFrame\\TW-TradeSkill-TopRight", 256, 256, "TOPRIGHT" },
30+
{ "Interface\\TradeSkillFrame\\TW-TradeSkill-BotLeft2", 512, 256, "BOTTOMLEFT" },
31+
{ "Interface\\TradeSkillFrame\\TW-TradeSkill-BotRight2", 256, 256, "BOTTOMRIGHT" },
32+
},
33+
close = { -77, -8 },
34+
bar = { 596, 15, 76, -44 },
35+
barBdr = { 604, 22 },
36+
summary = { "TOPRIGHT", -110, -70 },
37+
drop = { 40, -60 },
38+
scroll = { 296, 330, 37, -98 },
39+
detail = { 379, -113 },
40+
exit = { "CENTER", "BOTTOMRIGHT", -128, 92 },
41+
} or {
42+
hit = { 0, 34, 0, 75 },
43+
quads = {
44+
{ "Interface\\ClassTrainerFrame\\UI-ClassTrainer-TopLeft", 256, 256, "TOPLEFT" },
45+
{ "Interface\\ClassTrainerFrame\\UI-ClassTrainer-TopRight", 128, 256, "TOPRIGHT" },
46+
{ "Interface\\TradeSkillFrame\\UI-TradeSkill-BotLeft", 256, 256, "BOTTOMLEFT" },
47+
{ "Interface\\ClassTrainerFrame\\UI-ClassTrainer-BotRight", 128, 256, "BOTTOMRIGHT" },
48+
},
49+
close = { -29, -8 },
50+
bar = { 268, 15, 73, -37 },
51+
barBdr = { 278, 22 },
52+
summary = { "TOPRIGHT", -40, -58 },
53+
drop = { 12, -62 },
54+
scroll = { 296, 130, 21, -96 },
55+
detail = { 28, -237 },
56+
exit = { "CENTER", "TOPLEFT", 305, -422 },
57+
};
58+
2059
local PROFESSION_ICONS = {
2160
[171] = "Trade_Alchemy",
2261
[164] = "Trade_BlackSmithing",
@@ -32,7 +71,7 @@ local PROFESSION_ICONS = {
3271
[356] = "Trade_Fishing",
3372
};
3473

35-
if TURTLE_WOW_VERSION then
74+
if TURTLE then
3675
PROFESSION_ICONS[142] = "Trade_Survival"
3776
PROFESSION_ICONS[755] = "INV_Misc_Gem_01" -- Jewelcrafting
3877
end
@@ -188,7 +227,7 @@ local function CreateFrame_TradeSkillLink()
188227
f:SetPoint("CENTER", 0, 0);
189228
f:SetMovable(true);
190229
f:EnableMouse(true);
191-
f:SetHitRectInsets(2, 82, 2, 73);
230+
f:SetHitRectInsets(LO.hit[1], LO.hit[2], LO.hit[3], LO.hit[4]);
192231
f:RegisterForDrag("LeftButton");
193232
f:SetScript("OnDragStart", function() this:StartMoving(); end);
194233
f:SetScript("OnDragStop", function() this:StopMovingOrSizing(); end);
@@ -200,33 +239,30 @@ local function CreateFrame_TradeSkillLink()
200239
portrait:SetPoint("TOPLEFT", 7, -6);
201240
f.portrait = portrait;
202241

203-
local function Quad(file, w, h, point)
242+
for i = 1, table.getn(LO.quads) do
243+
local q = LO.quads[i];
204244
local tx = f:CreateTexture(nil, "BORDER");
205-
tx:SetTexture("Interface\\TradeSkillFrame\\" .. file);
206-
tx:SetSize(w, h);
207-
tx:SetPoint(point);
245+
tx:SetTexture(q[1]);
246+
tx:SetSize(q[2], q[3]);
247+
tx:SetPoint(q[4]);
208248
end
209-
Quad("TW-TradeSkill-TopLeft", 512, 256, "TOPLEFT");
210-
Quad("TW-TradeSkill-TopRight", 256, 256, "TOPRIGHT");
211-
Quad("TW-TradeSkill-BotLeft2", 512, 256, "BOTTOMLEFT");
212-
Quad("TW-TradeSkill-BotRight2", 256, 256, "BOTTOMRIGHT");
213249

214250
local title = f:CreateFontString(nil, "OVERLAY", "GameFontNormal");
215251
title:SetPoint("TOP", 0, -18);
216252
f.title = title;
217253

218254
local close = CreateFrame("Button", nil, f, "UIPanelCloseButton");
219-
close:SetPoint("TOPRIGHT", -77, -8);
255+
close:SetPoint("TOPRIGHT", LO.close[1], LO.close[2]);
220256

221257
local exit = CreateFrame("Button", nil, f, "UIPanelButtonTemplate");
222258
exit:SetSize(80, 22);
223-
exit:SetPoint("CENTER", f, "BOTTOMRIGHT", -128, 92);
259+
exit:SetPoint(LO.exit[1], f, LO.exit[2], LO.exit[3], LO.exit[4]);
224260
exit:SetText(EXIT or "Exit");
225261
exit:SetScript("OnClick", function() f:Hide(); end);
226262

227263
local bar = CreateFrame("StatusBar", nil, f);
228-
bar:SetSize(596, 15);
229-
bar:SetPoint("TOPLEFT", 76, -44);
264+
bar:SetSize(LO.bar[1], LO.bar[2]);
265+
bar:SetPoint("TOPLEFT", LO.bar[3], LO.bar[4]);
230266
bar:SetStatusBarTexture("Interface\\PaperDollInfoFrame\\UI-Character-Skills-Bar");
231267
bar:SetStatusBarColor(0.0, 0.0, 1.0, 0.5);
232268
bar:SetMinMaxValues(0, 1);
@@ -236,7 +272,7 @@ local function CreateFrame_TradeSkillLink()
236272
barBg:SetVertexColor(0.0, 0.0, 0.75, 0.5);
237273
-- Border: tooltip edge around the bar (TradeSkillRankFrameBorder).
238274
local border = CreateFrame("Frame", nil, bar);
239-
border:SetSize(604, 22);
275+
border:SetSize(LO.barBdr[1], LO.barBdr[2]);
240276
border:SetPoint("LEFT", -5, 1);
241277
border:SetBackdrop({
242278
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 16,
@@ -253,19 +289,19 @@ local function CreateFrame_TradeSkillLink()
253289
f.barRank = barRank;
254290

255291
local summary = f:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall");
256-
summary:SetPoint("TOPRIGHT", -110, -70);
292+
summary:SetPoint(LO.summary[1], LO.summary[2], LO.summary[3]);
257293
f.summary = summary;
258294

259295
local dropdown = CreateFrame("Frame", "ClassicAPITradeSkillLinkSubClass", f,
260296
"UIDropDownMenuTemplate");
261-
dropdown:SetPoint("TOPLEFT", 40, -60);
297+
dropdown:SetPoint("TOPLEFT", LO.drop[1], LO.drop[2]);
262298
f.dropdown = dropdown;
263299
f.subclassFilter = nil; -- nil = all subclasses
264300

265301
local scroll = CreateFrame("ScrollFrame", "ClassicAPITradeSkillLinkScroll",
266302
f, "FauxScrollFrameTemplate");
267-
scroll:SetSize(296, 330);
268-
scroll:SetPoint("TOPLEFT", 37, -98);
303+
scroll:SetSize(LO.scroll[1], LO.scroll[2]);
304+
scroll:SetPoint("TOPLEFT", LO.scroll[3], LO.scroll[4]);
269305
scroll:SetScript("OnVerticalScroll", function()
270306
FauxScrollFrame_OnVerticalScroll(ROW_HEIGHT, function() f:Refresh(); end)
271307
end)
@@ -313,7 +349,7 @@ local function CreateFrame_TradeSkillLink()
313349

314350
local prodIcon = CreateFrame("Button", nil, f);
315351
prodIcon:SetSize(37, 37); -- TradeSkillSkillIcon is 37x37
316-
prodIcon:SetPoint("TOPLEFT", 379, -113);
352+
prodIcon:SetPoint("TOPLEFT", LO.detail[1], LO.detail[2]);
317353
prodIcon:SetNormalTexture("Interface\\Icons\\INV_Misc_QuestionMark");
318354
local hdrLeft = prodIcon:CreateTexture(nil, "BACKGROUND");
319355
hdrLeft:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-DetailHeaderLeft");

0 commit comments

Comments
 (0)