Skip to content

Commit 667d080

Browse files
committed
[Fixes #44, Fixes #43] Resolve TMog source correctly after purchase to hide it
1 parent a2f2311 commit 667d080

File tree

5 files changed

+42
-36
lines changed

5 files changed

+42
-36
lines changed

Source/PurchaseWatch/Frame.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ end
118118
function CollectionatorPurchaseWatchFrameMixin:ProcessTMogDetails(itemLink)
119119
local _, source = C_TransmogCollection.GetItemInfo(itemLink)
120120
if source == nil then
121-
_, source = C_TransmogCollection.GetItemInfo(C_Item.GetItemInfoInstant(itemLink))
121+
source = Collectionator.Utilities.RecoverTMogSource(C_Item.GetItemInfoInstant(itemLink))
122122
end
123123
if source ~= nil then
124124
local sourceInfo = C_TransmogCollection.GetSourceInfo(source)

Source/Replicate/Scanner/TMog.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ end
2020
function CollectionatorReplicateTMogScannerFrameMixin:GetItem(index, link, scanInfo)
2121
local _, source = C_TransmogCollection.GetItemInfo(link)
2222
if source == nil then
23-
_, source = C_TransmogCollection.GetItemInfo(C_Item.GetItemInfoInstant(link))
23+
source = Collectionator.Utilities.RecoverTMogSource(C_Item.GetItemInfoInstant(link))
2424
end
2525

2626
if source ~= nil then

Source/Summary/Scanner/TMog.lua

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
CollectionatorSummaryTMogScannerFrameMixin = CreateFromMixins(CollectionatorSummaryScannerFrameMixin)
22

3-
local modelScene
4-
modelScene = CreateFrame("ModelScene", nil, UIParent, "ModelSceneMixinTemplate")
5-
modelScene:TransitionToModelSceneID(596, CAMERA_TRANSITION_TYPE_IMMEDIATE, CAMERA_MODIFICATION_TYPE_DISCARD, true)
6-
modelScene:Hide()
7-
local frame = CreateFrame("Frame")
8-
frame:SetScript("OnUpdate", function()
9-
if(modelScene:GetPlayerActor():SetModelByUnit("player")) then
10-
frame:SetScript("OnUpdate", nil)
11-
end
12-
end)
13-
143
function CollectionatorSummaryTMogScannerFrameMixin:OnLoad()
154
CollectionatorSummaryScannerFrameMixin.OnLoad(self)
165

@@ -34,29 +23,7 @@ function CollectionatorSummaryTMogScannerFrameMixin:GetItem(index, itemKeyInfo,
3423
if itemKeyInfo.appearanceLink ~= nil then
3524
source = tonumber(itemKeyInfo.appearanceLink:match("transmogappearance:(%d+)"))
3625
else
37-
source = select(2, C_TransmogCollection.GetItemInfo(scanInfo.itemKey.itemID))
38-
end
39-
40-
if not source and C_Item.IsDressableItemByID(scanInfo.itemKey.itemID) then
41-
local pa = modelScene:GetPlayerActor()
42-
local invType = select(4, C_Item.GetItemInfoInstant(scanInfo.itemKey.itemID))
43-
local mainhandOverride = invType == "INVTYPE_WEAPON" or invType == "INVTYPE_RANGEDRIGHT"
44-
local slot = Collectionator.Constants.SlotMap[invType]
45-
if slot then
46-
local link = select(2, C_Item.GetItemInfo(scanInfo.itemKey.itemID))
47-
local result
48-
if mainhandOverride then
49-
result = pa:TryOn(link, "MAINHANDSLOT")
50-
else
51-
result = pa:TryOn(link)
52-
end
53-
if result == Enum.ItemTryOnReason.Success then
54-
local info = pa:GetItemTransmogInfo(slot)
55-
if info then
56-
source = info.appearanceID
57-
end
58-
end
59-
end
26+
source = Collectionator.Utilities.RecoverTMogSource(scanInfo.itemKey.itemID)
6027
end
6128

6229
if source ~= nil and source > 0 and select(2, C_TransmogCollection.AccountCanCollectSource(source)) then

Source/Utilities/Manifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
<Script file="GroupedByID.lua" />
77
<Script file="GetPrice.lua" />
88
<Script file="GetRealmAndFaction.lua" />
9+
<Script file="RecoverTMogSource.lua" />
910
</Ui>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
local modelScene
2+
modelScene = CreateFrame("ModelScene", nil, UIParent, "ModelSceneMixinTemplate")
3+
modelScene:TransitionToModelSceneID(596, CAMERA_TRANSITION_TYPE_IMMEDIATE, CAMERA_MODIFICATION_TYPE_DISCARD, true)
4+
modelScene:Hide()
5+
local frame = CreateFrame("Frame")
6+
frame:SetScript("OnUpdate", function()
7+
if(modelScene:GetPlayerActor():SetModelByUnit("player")) then
8+
frame:SetScript("OnUpdate", nil)
9+
end
10+
end)
11+
12+
function Collectionator.Utilities.RecoverTMogSource(itemID)
13+
local possible = select(2, C_TransmogCollection.GetItemInfo(itemID))
14+
if possible then
15+
return possible
16+
end
17+
if C_Item.IsDressableItemByID(itemID) then
18+
local pa = modelScene:GetPlayerActor()
19+
local invType = select(4, C_Item.GetItemInfoInstant(itemID))
20+
local mainhandOverride = invType == "INVTYPE_WEAPON" or invType == "INVTYPE_RANGEDRIGHT"
21+
local slot = Collectionator.Constants.SlotMap[invType]
22+
if slot then
23+
local link = select(2, C_Item.GetItemInfo(itemID))
24+
local result
25+
if mainhandOverride then
26+
result = pa:TryOn(link, "MAINHANDSLOT")
27+
else
28+
result = pa:TryOn(link)
29+
end
30+
if result == Enum.ItemTryOnReason.Success then
31+
local info = pa:GetItemTransmogInfo(slot)
32+
if info then
33+
return info.appearanceID
34+
end
35+
end
36+
end
37+
end
38+
end

0 commit comments

Comments
 (0)