@@ -2,40 +2,69 @@ local E, L, V, P, G = unpack(ElvUI)
2
2
local S = E :GetModule (' Skins' )
3
3
4
4
local _G = _G
5
- local pairs , ipairs = pairs , ipairs
5
+ local pairs , format = pairs , format
6
6
local unpack , next = unpack , next
7
- local hooksecurefunc = hooksecurefunc
8
- local CreateColor = CreateColor
9
-
10
- local FLYOUT_LOCATIONS = {
11
- [0xFFFFFFFF ] = ' PLACEINBAGS' ,
12
- [0xFFFFFFFE ] = ' IGNORESLOT' ,
13
- [0xFFFFFFFD ] = ' UNIGNORESLOT'
14
- }
15
7
16
- local showInsetBackdrop = {
17
- ReputationFrame = true ,
18
- TokenFrame = true
19
- }
8
+ local hooksecurefunc = hooksecurefunc
9
+ local UnitResistance = UnitResistance
10
+ local GetItemQualityColor = GetItemQualityColor
11
+ local GetInventoryItemQuality = GetInventoryItemQuality
12
+ local HasPetUI = HasPetUI
13
+ local GetCVar = GetCVar
14
+
15
+ local PAPERDOLLFRAME_TOOLTIP_FORMAT = PAPERDOLLFRAME_TOOLTIP_FORMAT
16
+ local HIGHLIGHT_FONT_COLOR_CODE = HIGHLIGHT_FONT_COLOR_CODE
17
+ local FONT_COLOR_CODE_CLOSE = FONT_COLOR_CODE_CLOSE
18
+ local STAT_FORMAT = STAT_FORMAT
19
+ local HONOR_CURRENCY = HONOR_CURRENCY
20
+
21
+ local spellSchoolIcon = [[ Interface\PaperDollInfoFrame\SpellSchoolIcon]]
22
+
23
+ local function EquipmentManagerPane_Update (frame )
24
+ for _ , child in next , { frame .ScrollTarget :GetChildren () } do
25
+ if child .icon and not child .isSkinned then
26
+ child .BgTop :SetTexture (E .ClearTexture )
27
+ child .BgMiddle :SetTexture (E .ClearTexture )
28
+ child .BgBottom :SetTexture (E .ClearTexture )
29
+ S :HandleIcon (child .icon )
30
+ child .HighlightBar :SetColorTexture (1 , 1 , 1 , .25 )
31
+ child .HighlightBar :SetDrawLayer (' BACKGROUND' )
32
+ child .SelectedBar :SetColorTexture (0.8 , 0.8 , 0.8 , .25 )
33
+ child .SelectedBar :SetDrawLayer (' BACKGROUND' )
34
+
35
+ child .isSkinned = true
36
+ end
37
+ end
38
+ end
20
39
21
- local function EquipmentDisplayButton (button )
22
- if not button .isHooked then
23
- button :SetNormalTexture (E .ClearTexture )
24
- button :SetPushedTexture (E .ClearTexture )
25
- button :SetTemplate ()
26
- button :StyleButton ()
40
+ local function TitleManagerPane_Update (frame )
41
+ for _ , child in next , { frame .ScrollTarget :GetChildren () } do
42
+ if not child .isSkinned then
43
+ child :DisableDrawLayer (' BACKGROUND' )
44
+ child .isSkinned = true
45
+ end
46
+ end
47
+ end
27
48
28
- button .icon :SetInside ()
29
- button .icon :SetTexCoord (unpack (E .TexCoords ))
49
+ local function PaperDollItemSlotButtonUpdate (frame )
50
+ local id = frame .characterSlot and frame :GetID ()
51
+ local rarity = id and GetInventoryItemQuality (' player' , id )
52
+ if rarity and rarity > 1 then
53
+ local r , g , b = GetItemQualityColor (rarity )
54
+ frame :SetBackdropBorderColor (r , g , b )
55
+ else
56
+ frame :SetBackdropBorderColor (unpack (E .media .bordercolor ))
57
+ end
58
+ end
30
59
31
- S :HandleIconBorder (button .IconBorder )
60
+ local function PaperDollFrameSetResistance (frame , unit , index )
61
+ local _ , resistance = UnitResistance (unit , index )
62
+ local icon = format (' %s%d:12:12:0:0:64:64:4:55:4:55|t' , spellSchoolIcon , index + 1 )
63
+ local name = frame :GetName ()
32
64
33
- button .isHooked = true
34
- end
65
+ _G [name .. ' Label' ]:SetFormattedText (' %s ' .. STAT_FORMAT , icon , _G [' SPELL_SCHOOL' .. index .. ' _CAP' ])
35
66
36
- if FLYOUT_LOCATIONS [button .location ] then -- special slots
37
- button :SetBackdropBorderColor (unpack (E .media .bordercolor ))
38
- end
67
+ frame .tooltip = format (' %s %s' .. PAPERDOLLFRAME_TOOLTIP_FORMAT .. ' %s%s' , icon , HIGHLIGHT_FONT_COLOR_CODE , _G [' RESISTANCE' .. index .. ' _NAME' ], resistance or 0 , FONT_COLOR_CODE_CLOSE )
39
68
end
40
69
41
70
local function TabTextureCoords (tex , x1 )
@@ -227,17 +256,6 @@ function S:CharacterFrame()
227
256
end
228
257
end
229
258
230
- hooksecurefunc (' PaperDollItemSlotButton_Update' , function (frame )
231
- if frame .characterSlot then
232
- local rarity = GetInventoryItemQuality (' player' , frame :GetID ())
233
- if rarity and rarity > 1 then
234
- local r , g , b = GetItemQualityColor (rarity )
235
- frame :SetBackdropBorderColor (r , g , b )
236
- else
237
- frame :SetBackdropBorderColor (unpack (E .media .bordercolor ))
238
- end
239
- end
240
- end )
241
259
-- Give character frame model backdrop it's color back
242
260
for _ , corner in pairs ({' TopLeft' ,' TopRight' ,' BotLeft' ,' BotRight' }) do
243
261
local bg = _G [' CharacterModelFrameBackground' .. corner ]
@@ -286,36 +304,13 @@ function S:CharacterFrame()
286
304
S :HandleModelSceneControlButtons (_G .CharacterModelScene .ControlFrame )
287
305
288
306
-- Titles
289
- hooksecurefunc (_G .PaperDollFrame .TitleManagerPane .ScrollBox , ' Update' , function (frame )
290
- for _ , child in next , { frame .ScrollTarget :GetChildren () } do
291
- if not child .isSkinned then
292
- child :DisableDrawLayer (' BACKGROUND' )
293
- child .isSkinned = true
294
- end
295
- end
296
- end )
307
+ hooksecurefunc (_G .PaperDollFrame .TitleManagerPane .ScrollBox , ' Update' , TitleManagerPane_Update )
297
308
298
309
-- Equipement Manager
310
+ hooksecurefunc (_G .PaperDollFrame .EquipmentManagerPane .ScrollBox , ' Update' , EquipmentManagerPane_Update )
299
311
S :HandleButton (_G .PaperDollFrameEquipSet )
300
312
S :HandleButton (_G .PaperDollFrameSaveSet )
301
313
302
- hooksecurefunc (_G .PaperDollFrame .EquipmentManagerPane .ScrollBox , ' Update' , function (frame )
303
- for _ , child in next , { frame .ScrollTarget :GetChildren () } do
304
- if child .icon and not child .isSkinned then
305
- child .BgTop :SetTexture (E .ClearTexture )
306
- child .BgMiddle :SetTexture (E .ClearTexture )
307
- child .BgBottom :SetTexture (E .ClearTexture )
308
- S :HandleIcon (child .icon )
309
- child .HighlightBar :SetColorTexture (1 , 1 , 1 , .25 )
310
- child .HighlightBar :SetDrawLayer (' BACKGROUND' )
311
- child .SelectedBar :SetColorTexture (0.8 , 0.8 , 0.8 , .25 )
312
- child .SelectedBar :SetDrawLayer (' BACKGROUND' )
313
-
314
- child .isSkinned = true
315
- end
316
- end
317
- end )
318
-
319
314
-- Item Quality Borders and Armor Slots
320
315
local CharacterMainHandSlot = _G .CharacterMainHandSlot
321
316
CharacterMainHandSlot :ClearAllPoints ()
@@ -331,57 +326,44 @@ function S:CharacterFrame()
331
326
-- Stats
332
327
for i = 1 , 7 do
333
328
local frame = _G [' CharacterStatsPaneCategory' .. i ]
334
- local name = _G [' CharacterStatsPaneCategory' .. i .. ' NameText' ]
335
- frame .Toolbar = _G [' CharacterStatsPaneCategory' .. i .. ' Toolbar' ]
336
-
337
329
frame :StripTextures ()
338
330
frame :SetTemplate (' Transparent' )
339
331
332
+ frame .Toolbar = _G [' CharacterStatsPaneCategory' .. i .. ' Toolbar' ]
340
333
S :HandleButton (frame .Toolbar , nil , nil , true )
341
334
342
- name :ClearAllPoints ()
343
- name :Point (' CENTER' , frame .Toolbar , ' CENTER' )
344
-
345
- _G [' CharacterStatsPaneCategory' .. i .. ' Stat1' ]:Point (' TOPLEFT' , frame , ' TOPLEFT' , 16 , - 18 )
335
+ local name = _G [' CharacterStatsPaneCategory' .. i .. ' NameText' ]
336
+ if name then
337
+ name :ClearAllPoints ()
338
+ name :Point (' CENTER' , frame .Toolbar )
339
+ end
346
340
347
- -- _G['CharacterStatsPaneCategory'..i..'ToolbarSortUpArrow ']:Kill( )
341
+ _G [' CharacterStatsPaneCategory' .. i .. ' Stat1 ' ]:Point ( ' TOPLEFT ' , frame , 16 , - 18 )
348
342
_G [' CharacterStatsPaneCategory' .. i .. ' ToolbarSortDownArrow' ]:Kill ()
343
+ -- _G['CharacterStatsPaneCategory'..i..'ToolbarSortUpArrow']:Kill()
349
344
end
350
345
351
- hooksecurefunc (' PaperDollFrame_SetResistance' , function (statFrame , unit , index )
352
- local _ , resistance = UnitResistance (unit , index )
353
- local resistanceIcons = ' |TInterface\\ PaperDollInfoFrame\\ SpellSchoolIcon' .. (index + 1 ).. ' :12:12:0:0:64:64:4:55:4:55|t'
354
-
355
- _G [statFrame :GetName ().. ' Label' ]:SetText (resistanceIcons .. ' ' .. format (STAT_FORMAT , _G [' SPELL_SCHOOL' .. index .. ' _CAP' ]))
356
- statFrame .tooltip = resistanceIcons .. ' ' .. HIGHLIGHT_FONT_COLOR_CODE .. format (PAPERDOLLFRAME_TOOLTIP_FORMAT , _G [' RESISTANCE' .. index .. ' _NAME' ]).. ' ' .. resistance .. FONT_COLOR_CODE_CLOSE
357
- end )
358
-
359
- -- Expand Button
360
- local CharacterFrameExpandButton = _G .CharacterFrameExpandButton
361
- S :HandleNextPrevButton (CharacterFrameExpandButton , nil , nil , nil , nil , nil , 26 ) -- Default UI button size is 32
362
- CharacterFrameExpandButton :ClearAllPoints ()
363
- CharacterFrameExpandButton :Point (' BOTTOMRIGHT' , _G .CharacterFrameInset , ' BOTTOMRIGHT' , - 3 , 2 )
364
-
365
- CharacterFrameExpandButton :SetNormalTexture (E .Media .Textures .ArrowUp )
366
- CharacterFrameExpandButton .SetNormalTexture = E .noop
367
- CharacterFrameExpandButton :SetPushedTexture (E .Media .Textures .ArrowUp )
368
- CharacterFrameExpandButton .SetPushedTexture = E .noop
369
- CharacterFrameExpandButton :SetDisabledTexture (E .Media .Textures .ArrowUp )
370
- CharacterFrameExpandButton .SetDisabledTexture = E .noop
371
-
372
- local expandButtonNormal , expandButtonPushed = CharacterFrameExpandButton :GetNormalTexture (), CharacterFrameExpandButton :GetPushedTexture ()
373
- local expandButtonCvar = GetCVar (' characterFrameCollapsed' ) ~= ' 0'
374
- expandButtonNormal :SetRotation (expandButtonCvar and - 1.57 or 1.57 )
375
- expandButtonPushed :SetRotation (expandButtonCvar and - 1.57 or 1.57 )
376
-
377
- hooksecurefunc (CharacterFrame , ' Collapse' , function ()
378
- expandButtonNormal :SetRotation (- 1.57 )
379
- expandButtonPushed :SetRotation (- 1.57 )
380
- end )
381
- hooksecurefunc (CharacterFrame , ' Expand' , function ()
382
- expandButtonNormal :SetRotation (1.57 )
383
- expandButtonPushed :SetRotation (1.57 )
384
- end )
346
+ do -- Expand Button
347
+ local CharacterFrameExpandButton = _G .CharacterFrameExpandButton
348
+ S :HandleNextPrevButton (CharacterFrameExpandButton , nil , nil , nil , nil , nil , 26 ) -- Default UI button size is 32
349
+ CharacterFrameExpandButton :ClearAllPoints ()
350
+ CharacterFrameExpandButton :Point (' BOTTOMRIGHT' , _G .CharacterFrameInset , ' BOTTOMRIGHT' , - 3 , 2 )
351
+
352
+ CharacterFrameExpandButton :SetNormalTexture (E .Media .Textures .ArrowUp )
353
+ CharacterFrameExpandButton .SetNormalTexture = E .noop
354
+ CharacterFrameExpandButton :SetPushedTexture (E .Media .Textures .ArrowUp )
355
+ CharacterFrameExpandButton .SetPushedTexture = E .noop
356
+ CharacterFrameExpandButton :SetDisabledTexture (E .Media .Textures .ArrowUp )
357
+ CharacterFrameExpandButton .SetDisabledTexture = E .noop
358
+
359
+ local expandButtonNormal , expandButtonPushed = CharacterFrameExpandButton :GetNormalTexture (), CharacterFrameExpandButton :GetPushedTexture ()
360
+ local expandButtonCvar = GetCVar (' characterFrameCollapsed' ) ~= ' 0'
361
+ expandButtonNormal :SetRotation (expandButtonCvar and - 1.57 or 1.57 )
362
+ expandButtonPushed :SetRotation (expandButtonCvar and - 1.57 or 1.57 )
363
+
364
+ hooksecurefunc (CharacterFrame , ' Collapse' , function () expandButtonNormal :SetRotation (- 1.57 ) expandButtonPushed :SetRotation (- 1.57 ) end )
365
+ hooksecurefunc (CharacterFrame , ' Expand' , function () expandButtonNormal :SetRotation (1.57 ) expandButtonPushed :SetRotation (1.57 ) end )
366
+ end
385
367
386
368
-- Pet Frame
387
369
S :HandleStatusBar (_G .PetPaperDollFrameExpBar )
@@ -391,7 +373,7 @@ function S:CharacterFrame()
391
373
-- Reputation Frame
392
374
_G .ReputationFrame :StripTextures ()
393
375
394
- for i = 1 , NUM_FACTIONS_DISPLAYED do
376
+ for i = 1 , _G . NUM_FACTIONS_DISPLAYED do
395
377
local factionBar = _G [' ReputationBar' .. i ]
396
378
local factionStatusBar = _G [' ReputationBar' .. i .. ' ReputationBar' ]
397
379
local factionBarButton = _G [' ReputationBar' .. i .. ' ExpandOrCollapseButton' ]
@@ -441,20 +423,20 @@ function S:CharacterFrame()
441
423
442
424
S :HandleCloseButton (_G .TokenFramePopupCloseButton , _G .TokenFramePopup )
443
425
444
- hooksecurefunc (' TokenFrame_Update' , UpdateCurrencySkins )
445
426
hooksecurefunc (_G .TokenFrameContainer , ' update' , UpdateCurrencySkins )
427
+ hooksecurefunc (' TokenFrame_Update' , UpdateCurrencySkins )
428
+ hooksecurefunc (' PaperDollFrame_UpdateSidebarTabs' , FixSidebarTabCoords )
429
+ hooksecurefunc (' PaperDollFrame_SetResistance' , PaperDollFrameSetResistance )
430
+ hooksecurefunc (' PaperDollItemSlotButton_Update' , PaperDollItemSlotButtonUpdate )
446
431
447
432
-- Tabs
448
- for i = 1 , # CHARACTERFRAME_SUBFRAMES do
433
+ for i = 1 , # _G . CHARACTERFRAME_SUBFRAMES do
449
434
S :HandleTab (_G [' CharacterFrameTab' .. i ])
450
435
end
451
436
452
437
-- Reposition Tabs
453
438
hooksecurefunc (' PetPaperDollFrame_UpdateIsAvailable' , HandleTabs )
454
439
HandleTabs ()
455
-
456
- -- Buttons used to toggle between equipment manager, titles, and character stats
457
- hooksecurefunc (' PaperDollFrame_UpdateSidebarTabs' , FixSidebarTabCoords )
458
440
end
459
441
460
442
S :AddCallback (' CharacterFrame' )
0 commit comments