Fix creature previews in the store
This commit is contained in:
@@ -64,7 +64,8 @@ local KEYS = {
|
|||||||
rewardCount_7 = 27,
|
rewardCount_7 = 27,
|
||||||
rewardCount_8 = 28,
|
rewardCount_8 = 28,
|
||||||
new = 29,
|
new = 29,
|
||||||
enabled = 30
|
enabled = 30,
|
||||||
|
previewDisplayId = 31
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,7 +504,7 @@ function SHOP_UI.ServiceBoxes_Create(parent)
|
|||||||
if(self.Type == 1 and service.Flags == 1) then
|
if(self.Type == 1 and service.Flags == 1) then
|
||||||
SHOP_UI.ModelFrame_ShowPlayer(self.Rewards)
|
SHOP_UI.ModelFrame_ShowPlayer(self.Rewards)
|
||||||
elseif((self.Type == 3 or self.Type == 4) and self.DisplayId > 0) then -- Handler for creatures with models
|
elseif((self.Type == 3 or self.Type == 4) and self.DisplayId > 0) then -- Handler for creatures with models
|
||||||
SHOP_UI.ModelFrame_ShowCreature(self.DisplayId)
|
SHOP_UI.ModelFrame_ShowCreature(self.DisplayId, self.PreviewDisplayId)
|
||||||
end
|
end
|
||||||
-- Parchment page sound
|
-- Parchment page sound
|
||||||
PlaySound(836)
|
PlaySound(836)
|
||||||
@@ -614,6 +615,7 @@ function SHOP_UI.ServiceBoxes_Update()
|
|||||||
service.Currency = serviceData[KEYS.service.currency]
|
service.Currency = serviceData[KEYS.service.currency]
|
||||||
service.TooltipHyperlink = serviceData[KEYS.service.hyperlink]
|
service.TooltipHyperlink = serviceData[KEYS.service.hyperlink]
|
||||||
service.DisplayId = serviceData[KEYS.service.displayId]
|
service.DisplayId = serviceData[KEYS.service.displayId]
|
||||||
|
service.PreviewDisplayId = serviceData[KEYS.service.previewDisplayId] or 0
|
||||||
service.Discount = serviceData[KEYS.service.discount]
|
service.Discount = serviceData[KEYS.service.discount]
|
||||||
service.Flags = serviceData[KEYS.service.flags]
|
service.Flags = serviceData[KEYS.service.flags]
|
||||||
service.New = serviceData[KEYS.service.new]
|
service.New = serviceData[KEYS.service.new]
|
||||||
@@ -1150,7 +1152,7 @@ function SHOP_UI.ModelFrame_ShowPlayer(displayId)
|
|||||||
PlaySound("INTERFACESOUND_GAMESCROLLBUTTON", "Master")
|
PlaySound("INTERFACESOUND_GAMESCROLLBUTTON", "Master")
|
||||||
end
|
end
|
||||||
|
|
||||||
function SHOP_UI.ModelFrame_ShowCreature(displayId)
|
function SHOP_UI.ModelFrame_ShowCreature(creatureEntry, previewDisplayId)
|
||||||
-- hacky ass model frame handling
|
-- hacky ass model frame handling
|
||||||
-- hide model frames
|
-- hide model frames
|
||||||
if(SHOP_UI["MODEL_FRAME"].playerModel:IsShown()) then
|
if(SHOP_UI["MODEL_FRAME"].playerModel:IsShown()) then
|
||||||
@@ -1161,7 +1163,11 @@ function SHOP_UI.ModelFrame_ShowCreature(displayId)
|
|||||||
SHOP_UI["MODEL_FRAME"]:Hide()
|
SHOP_UI["MODEL_FRAME"]:Hide()
|
||||||
|
|
||||||
-- set the correct unit and show frame
|
-- set the correct unit and show frame
|
||||||
SHOP_UI["MODEL_FRAME"].creatureModel:SetCreature(displayId)
|
if(previewDisplayId and previewDisplayId > 0) then
|
||||||
|
SHOP_UI["MODEL_FRAME"].creatureModel:SetCreature(creatureEntry, previewDisplayId)
|
||||||
|
else
|
||||||
|
SHOP_UI["MODEL_FRAME"].creatureModel:SetCreature(creatureEntry)
|
||||||
|
end
|
||||||
SHOP_UI["MODEL_FRAME"].creatureModel:Show()
|
SHOP_UI["MODEL_FRAME"].creatureModel:Show()
|
||||||
SHOP_UI["MODEL_FRAME"]:Show()
|
SHOP_UI["MODEL_FRAME"]:Show()
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ local KEYS = {
|
|||||||
rewardCount_7 = 27,
|
rewardCount_7 = 27,
|
||||||
rewardCount_8 = 28,
|
rewardCount_8 = 28,
|
||||||
new = 29,
|
new = 29,
|
||||||
enabled = 30
|
enabled = 30,
|
||||||
|
previewDisplayId = 31
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,6 +140,8 @@ function ServiceData.Load()
|
|||||||
Query:GetUInt32(KEYS.service.rewardCount_7),
|
Query:GetUInt32(KEYS.service.rewardCount_7),
|
||||||
Query:GetUInt32(KEYS.service.rewardCount_8),
|
Query:GetUInt32(KEYS.service.rewardCount_8),
|
||||||
Query:GetUInt32(KEYS.service.new),
|
Query:GetUInt32(KEYS.service.new),
|
||||||
|
Query:GetUInt32(KEYS.service.enabled),
|
||||||
|
0,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
until not Query:NextRow()
|
until not Query:NextRow()
|
||||||
@@ -224,6 +227,27 @@ function CreatureDisplays.Load()
|
|||||||
until not ModelQuery:NextRow()
|
until not ModelQuery:NextRow()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Keep the creature entry for the stock preview path, but also send its
|
||||||
|
-- primary CreatureDisplayInfo ID. WarcraftXL can apply that display
|
||||||
|
-- directly, avoiding stale or missing client creature-cache records.
|
||||||
|
for _, service in pairs(ServiceData.Cache) do
|
||||||
|
local serviceType = service[KEYS.service.serviceType]
|
||||||
|
local entry = service[KEYS.service.displayOrEntry]
|
||||||
|
if ((serviceType == 3 or serviceType == 4) and entry > 0) then
|
||||||
|
local creature = CreatureDisplays.Cache[entry]
|
||||||
|
local displayId = 0
|
||||||
|
if (creature) then
|
||||||
|
for modelIndex = 11, 14 do
|
||||||
|
if (creature[modelIndex] and creature[modelIndex] > 0) then
|
||||||
|
displayId = creature[modelIndex]
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
service[KEYS.service.previewDisplayId] = displayId
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function LinkData.Load()
|
function LinkData.Load()
|
||||||
|
|||||||
Reference in New Issue
Block a user