376 lines
29 KiB
Lua
376 lines
29 KiB
Lua
-- Integration boundary: original native callbacks + private Source provider,
|
|
-- not a second parser/provider test suite or an emulator of retail services.
|
|
local root=arg[1] or '.'
|
|
local child=arg[2] or (root..'/runtime/continuation-20261113/codex/SHOP-original-store-integration/children')
|
|
local store=child..'/interface/addons/blizzard_storeui/'
|
|
local function read(path)local f=assert(io.open(path,'rb'));local s=f:read('*a');f:close();return s:gsub('\r\n','\n') end
|
|
local function extract(s,signature)
|
|
local start=assert(s:find(signature..'\n',1,true),'missing '..signature)
|
|
local finish=assert(s:find('\nend',start,true),'unterminated '..signature)
|
|
return s:sub(start,finish+3)
|
|
end
|
|
if arg[3]=="internal-preview" then
|
|
local methods={}
|
|
local function frame(id)
|
|
return setmetatable({id=id,shown=true,points={{"TOPLEFT",false,"TOPLEFT",10,-10}},width=120,height=180,scripts={},attributes={}},
|
|
{__index=function(t,k) if methods[k] then return methods[k] end; local f=frame();rawset(t,k,f);return f end})
|
|
end
|
|
function methods:GetID()return self.id end
|
|
function methods:SetID(v)self.id=v end
|
|
function methods:IsShown()return self.shown end
|
|
function methods:Show()self.shown=true end
|
|
function methods:Hide()self.shown=false end
|
|
function methods:SetShown(v)self.shown=v end
|
|
function methods:GetWidth()return self.width end
|
|
function methods:GetHeight()return self.height end
|
|
function methods:GetNumPoints()return #self.points end
|
|
function methods:GetPoint(i)return table.unpack(self.points[i])end
|
|
function methods:SetPoint(...)self.points[#self.points+1]={...}end
|
|
function methods:ClearAllPoints()self.points={}end
|
|
function methods:SetAllPoints(parent)
|
|
self:ClearAllPoints();self:SetPoint('TOPLEFT',parent,'TOPLEFT',0,0);self:SetPoint('BOTTOMRIGHT',parent,'BOTTOMRIGHT',0,0)
|
|
end
|
|
function methods:SetSize(w,h)self.width=w;self.height=h end
|
|
function methods:SetScript(k,v)self.scripts[k]=v end
|
|
function methods:GetScript(k)return self.scripts[k]end
|
|
function methods:IsMouseWheelEnabled()return self.wheel==true end
|
|
function methods:EnableMouseWheel(v)self.wheel=v end
|
|
function methods:IsMouseEnabled()return self.mouse==true end
|
|
function methods:EnableMouse(v)self.mouse=v end
|
|
function methods:SetText(v)self.text=v end
|
|
function methods:GetText()return self.text end
|
|
function methods:SetEnabled()end
|
|
function methods:Stop()end
|
|
function methods:SetTexture()end
|
|
function methods:SetDesaturated()end
|
|
function methods:SetDefaultCardTexture()end
|
|
function methods:UpdateState()end
|
|
function methods:HideIcon()self.Icon:Hide()end
|
|
function methods:ShowIcon(info)self.Icon:Show();self.texture=info.texture end
|
|
function methods:ClearScene()self.clears=(rawget(self,"clears") or 0)+1 end
|
|
function methods:SetFromModelSceneID()self.loads=(rawget(self,"loads") or 0)+1 end
|
|
function methods:GetActiveCamera()return nil end
|
|
function methods:GetActorByTag(tag)if tag=="unwrapped" then return self.actor end;return {Hide=function()end}end
|
|
function methods:SetAttribute(k,v)self.attributes[k]=v end
|
|
local cards={frame(1),frame(2),frame(3)}
|
|
local frozen=read(root..'/runtime/continuation-20261113/codex/PTR-feedback-disable/native70334-ui/interface/addons/blizzard_sharedxml/modelscenemixin.lua')
|
|
ModelSceneMixin={};NoCameraControlModelSceneMixin={}
|
|
for _,name in ipairs({'OnMouseDown','OnMouseUp','OnMouseWheel'}) do
|
|
assert(load(extract(frozen,'function ModelSceneMixin:'..name..'('..(name=='OnMouseWheel' and 'delta' or 'button')..')')))()
|
|
-- The original wheel declaration has trailing whitespace; use its exact
|
|
-- frozen body for the disabled Store-card mixin as well.
|
|
local signature='function NoCameraControlModelSceneMixin:'..name..'('..(name=='OnMouseWheel' and 'delta' or 'button')..')'
|
|
local source=frozen:gsub('%)\t\n',')\n')
|
|
assert(load(extract(source,signature)))()
|
|
end
|
|
for _,name in ipairs({'IsLeftMouseButtonDown','IsRightMouseButtonDown'}) do
|
|
assert(load(extract(frozen,'function ModelSceneMixin:'..name..'()')))();methods[name]=ModelSceneMixin[name]
|
|
end
|
|
local cameras=root..'/runtime/continuation-20261113/codex/PTR-feedback-disable/native70334-ui/interface/addons/blizzard_sharedxml/shared/modelscenecameras/'
|
|
local orbit=read(cameras..'orbitcameramixin.lua');local base=read(cameras..'camerabasemixin.lua')
|
|
OrbitCameraMixin={};CameraBaseMixin={}
|
|
for _,signature in ipairs({'GetZoomPercent()','SetZoomPercent(zoomPercent)','ZoomByPercent(percent)','GetYaw()','SetYaw(yaw)',
|
|
'GetDeltaModifierForCameraMode(mode)','HandleMouseMovement(mode, delta, snapToValue)','OnMouseWheel(delta) -- override','OnUpdate(elapsed) -- override'}) do
|
|
assert(load(extract(orbit,'function OrbitCameraMixin:'..signature)))()
|
|
end
|
|
for _,signature in ipairs({'IsLeftMouseButtonDown()','IsRightMouseButtonDown()','OnMouseDown(button)','OnMouseUp(button)'}) do
|
|
assert(load(extract(base,'function CameraBaseMixin:'..signature)))()
|
|
end
|
|
ORBIT_CAMERA_MOUSE_MODE_NOTHING=0;ORBIT_CAMERA_MOUSE_MODE_YAW_ROTATION=1;ORBIT_CAMERA_MOUSE_MODE_PITCH_ROTATION=2
|
|
ORBIT_CAMERA_MOUSE_MODE_ROLL_ROTATION=3;ORBIT_CAMERA_MOUSE_MODE_ZOOM=4
|
|
Saturate=function(v)return math.max(0,math.min(1,v))end
|
|
InputUtil={GetCursorDelta=function()return 25,0 end};GetAppropriateTopLevelParent=function()end
|
|
for _,card in ipairs(cards)do
|
|
card.ModelScene=frame();card.ModelScene.actor={}
|
|
local camera={scene=card.ModelScene,zoomPercent=.5,yaw=0,
|
|
buttonModes={leftX=1,leftY=0,rightX=0,rightY=0,wheel=4,leftXinterpolate=true}}
|
|
for name,method in pairs(CameraBaseMixin)do camera[name]=method end
|
|
for name,method in pairs(OrbitCameraMixin)do camera[name]=method end
|
|
camera.GetOwningScene=function(self)return self.scene end
|
|
camera.UpdateInterpolationTargets=function()end;camera.SynchronizeCamera=function()end;camera.SnapToTargetInterpolationZoom=function()end
|
|
card.ModelScene.activeCamera=camera
|
|
for _,name in ipairs({'OnMouseDown','OnMouseUp','OnMouseWheel'}) do card.ModelScene[name]=NoCameraControlModelSceneMixin[name] end
|
|
end
|
|
StoreFrame=frame();StoreFrame.NextPageButton.text="next";StoreFrame.PageText.text="1 / 3"
|
|
StoreFrame.productCardPoolCollection={EnumerateActive=function()local i=0;return function()i=i+1;return cards[i]end end}
|
|
local infos={};for i=1,3 do infos[i]={entryID=i,sharedData={name="Name"..i,sourcePriceTokens=10,texture="native-icon",cards={{modelSceneID=4,creatureDisplayInfoID=158,sourceEntryID=i}}}}end
|
|
local reads=0
|
|
local provider={GetEntryInfo=function(_,id)reads=reads+1;return infos[id]end,CanPurchase=function()return true end,RefreshFashionSlots=function()return false end}
|
|
SourceStoreProvider={New=function()return provider end};SourceStoreWire={}
|
|
Enum={BattlepayCardType={SmallCard=1}};C_Glue={IsOnGlueScreen=function()return false end}
|
|
C_ModelInfo={GetModelSceneInfoByID=function()return 1 end};UnitRace=function()return "Human","Human",1 end;UnitSex=function()return 3 end
|
|
SetupItemPreviewActor=function(actor,id)actor.display=id end
|
|
local selected;StoreFrame_GetSelectedEntryID=function()return selected end;StoreFrame_SetSelectedEntryID=function(id)selected=id end
|
|
StoreFrame_UpdateCoverState=function()end;StoreTooltip={};StoreConfirmationFrame=frame();StoreConfirmationFrame:Hide()
|
|
unpack=table.unpack
|
|
assert(load(read(root..'/ops/native_source_store_secure.lua')))()
|
|
for _,card in ipairs(cards)do SourceStore_CardUpdate(card,card.id)end
|
|
cards[1].ModelScene:OnMouseDown('LeftButton');cards[1].ModelScene:OnMouseWheel(1)
|
|
local camera=cards[1].ModelScene.activeCamera
|
|
assert(not cards[1].ModelScene.isLeftButtonDown and camera.zoomPercent==.5,'fixture failed to retain real NoCameraControl behavior')
|
|
assert(cards[1].ModelScene.loads==1)
|
|
local before=reads;SourceStore_OnItemInfoReceived(99999);assert(reads==before,'unrelated item queried catalogue')
|
|
SourceStore_OnItemInfoReceived(1);assert(cards[1].ModelScene.loads==1,'item name arrival rebuilt model')
|
|
SourceStore_CardUpdate(cards[1],1);assert(cards[1].ModelScene.loads==1,'unchanged card reload')
|
|
assert(SourceStore_ShowInternalPreview(infos[1].sharedData.cards))
|
|
assert(cards[1]:IsShown() and not cards[2]:IsShown() and not cards[2].ModelScene:IsShown())
|
|
assert(cards[1].ModelScene.loads==1 and #cards[1].points==2,'focus must reuse original scene in StoreFrame')
|
|
assert(cards[1].points[1][2]==StoreFrame and not StoreFrame.NextPageButton:IsShown())
|
|
cards[1].ModelScene:OnMouseDown('LeftButton');assert(cards[1].ModelScene.isLeftButtonDown)
|
|
camera:OnUpdate(.016);assert(math.abs(camera.yaw+.2)<.000001,'actual original orbit update did not consume drag flags')
|
|
cards[1].ModelScene:OnMouseUp('LeftButton');assert(not cards[1].ModelScene.isLeftButtonDown)
|
|
cards[1].ModelScene:OnMouseDown('RightButton');assert(cards[1].ModelScene.isRightButtonDown)
|
|
cards[1].scripts.OnMouseWheel(cards[1],1)
|
|
assert(math.abs(camera.zoomPercent-.4)<.000001,'actual original orbit wheel did not change zoom')
|
|
SourceStore_OnAttribute(StoreFrame,'action','EscapePressed')
|
|
assert(StoreFrame:IsShown() and cards[2]:IsShown() and cards[2].ModelScene:IsShown())
|
|
assert(cards[1].width==120 and #cards[1].points==1 and cards[1].points[1][4]==10 and not cards[1].wheel)
|
|
assert(StoreFrame.PageText.text=="1 / 3" and StoreFrame.NextPageButton:IsShown())
|
|
assert(cards[1].ModelScene.OnMouseDown==NoCameraControlModelSceneMixin.OnMouseDown and cards[1].ModelScene.OnMouseWheel==NoCameraControlModelSceneMixin.OnMouseWheel)
|
|
assert(not cards[1].ModelScene.isLeftButtonDown and not cards[1].ModelScene.isRightButtonDown and not cards[1].mouse)
|
|
local closedZoom=camera.zoomPercent;cards[1].ModelScene:OnMouseDown('LeftButton');cards[1].ModelScene:OnMouseWheel(1);assert(camera.zoomPercent==closedZoom)
|
|
assert(SourceStore_ShowInternalPreview(infos[2].sharedData.cards));SourceStore_BeforeSetCategory()
|
|
assert(cards[1]:IsShown() and cards[2].width==120,'category released expanded geometry')
|
|
local generated=read(store..'blizzard_shared_storeuisecure.lua')
|
|
assert(generated:find('return SourceStore_ShowInternalPreview(displayInfoEntries)',1,true))
|
|
assert(not generated:find('Interface\\AddOns\\Turtle_ShopUI\\ShopFrame',1,true) and not generated:find('SourceStoreSkinPortraits',1,true),'Octo artwork retained')
|
|
local micro=read(child..'/interface/addons/blizzard_micromenu/mainline/mainmenubarmicrobuttons.lua')
|
|
assert(micro:find('SLASH_SOURCE_NATIVE_STORE1="/shop"',1,true) and micro:find('SlashCmdList.SOURCE_NATIVE_STORE=',1,true))
|
|
print('PASS native internal preview reuses scene; suspends others; Escape/category restore; irrelevant item events do not reload; native artwork and slash entry retained')
|
|
return
|
|
end
|
|
if arg[3]=="preview-strata" then
|
|
local model=read(child..'/interface/addons/blizzard_sharedxml/modelpreviewframe.lua')
|
|
local original=read(root..'/runtime/continuation-20261113/codex/PTR-feedback-disable/native70334-ui/interface/addons/blizzard_sharedxml/modelpreviewframe.xml')
|
|
assert(original:find('frameStrata="FULLSCREEN_DIALOG" frameLevel="5"',1,true),'original XML declaration changed')
|
|
local order={};local frame={Display={ModelScene={SetResetCallback=function()end,ControlFrame={SetModelScene=function()end}}}}
|
|
function frame:SetParent(p)assert(p=='parent');self.strata='MEDIUM';self.level=1;order[#order+1]='parent'end
|
|
function frame:SetFrameStrata(v)self.strata=v;order[#order+1]='strata'end
|
|
function frame:SetFrameLevel(v)self.level=v;order[#order+1]='level'end
|
|
function frame:SetSize(x,y)assert(x==415 and y==565)end
|
|
function frame:ClearAllPoints()end
|
|
function frame:SetPoint(...)assert(table.concat({...},',')=='CENTER,0,40')end
|
|
function frame:SetTitle()end
|
|
function frame:RegisterEvent()end
|
|
GetAppropriateTopLevelParent=function()return 'parent'end
|
|
ButtonFrameTemplate_HidePortrait=function()end;ButtonFrameTemplate_HideAttic=function()end
|
|
assert(load(extract(model,'function ModelPreviewFrame_OnLoad(self)')))()
|
|
ModelPreviewFrame_OnLoad(frame)
|
|
assert(frame.strata=='FULLSCREEN_DIALOG' and frame.level==5)
|
|
assert(table.concat(order,',')=='parent,strata,level','restore must follow parent inheritance')
|
|
print('PASS measured MEDIUM/1 parent inheritance restored to exact original XML FULLSCREEN_DIALOG/5; original dimensions/anchor retained')
|
|
return
|
|
end
|
|
if arg[3]=="preview-stack" then
|
|
local model=read(child..'/interface/addons/blizzard_sharedxml/modelpreviewframe.lua')
|
|
local calls={};local frame={Raise=function()calls[#calls+1]='raise'end}
|
|
ModelPreviewFrame=frame
|
|
ModelPreviewFrame_BuildCarousel=function(self)self.carouselEntries={{}}end
|
|
ModelPreviewFrame_SetStyle=function(_,style)assert(style==nil)end
|
|
ModelPreviewFrame_SetCarouselIndex=function(self,index,zoom,force)assert(self==frame and index==1);calls[#calls+1]='show'end
|
|
assert(load(extract(model,'function ModelPreviewFrame_ShowModels(displayInfoEntries, allowZoom, forceUpdate)')))()
|
|
local entries={{modelSceneID=596,itemModifiedAppearanceIDs={324143}}}
|
|
ModelPreviewFrame_ShowModels(entries,false);ModelPreviewFrame_ShowModels(entries,false)
|
|
assert(table.concat(calls,',')=='show,raise,show,raise' and frame.displayInfoEntries==entries)
|
|
local secure=read(root..'/ops/native_source_store_secure.lua')
|
|
assert(load('local sourceStore={}\n'..extract(secure,'function SourceStore_OnAttribute(self,name,value)')))()
|
|
local updates=0;StoreFrame_UpdateCoverState=function()updates=updates+1 end
|
|
SourceStore_OnAttribute(frame,'previewframeshown',true)
|
|
SourceStore_OnAttribute(frame,'previewframeshown',false)
|
|
assert(updates==2,'preview show/hide did not restore original cover updates')
|
|
assert(model:find('self:SetSize(415, 565);',1,true) and model:find('self:SetPoint("CENTER", 0, 40);',1,true),'original geometry changed')
|
|
print('PASS original preview show-before-raise including repeated preview; original cover show/hide and geometry retained')
|
|
return
|
|
end
|
|
if arg[3]=="magnifier" then
|
|
local source=read(store..'blizzard_shared_productcardmagnifiertemplates.lua')
|
|
local calls,retailCalls=0,0
|
|
local cards={{modelSceneID=596,itemModifiedAppearanceIDs={324143}}}
|
|
local entries={[69129]={sharedData={cards=cards}}}
|
|
local active=true
|
|
SourceStore_IsActive=function()return active end
|
|
C_StoreSecure={GetEntryInfo=function(id)retailCalls=retailCalls+1;assert(id==42);return {sharedData={cards=cards}} end}
|
|
-- Use the actual secure catalogue wrapper; original retail path stays intact.
|
|
local secure=read(root..'/ops/native_source_store_secure.lua')
|
|
assert(load('local sourceStore=...\n'..extract(secure,'function SourceStore_GetEntryInfo(id)')))({GetEntryInfo=function(_,id)return entries[id]end})
|
|
StoreFrame_ShowPreviews=function(value)assert(value==cards);calls=calls+1 end
|
|
assert(load(source))()
|
|
local id=69129;local card={GetID=function()return id end};local magnifier={GetParent=function()return card end}
|
|
DefaultStoreCardMagnifierMixin.OnClick(magnifier);assert(calls==1 and retailCalls==0)
|
|
entries[69129]=nil -- catalogue refresh/pooled stale card: no nil dereference.
|
|
DefaultStoreCardMagnifierMixin.OnClick(magnifier);assert(calls==1 and retailCalls==0)
|
|
active=false;id=42
|
|
DefaultStoreCardMagnifierMixin.OnClick(magnifier);assert(calls==2 and retailCalls==1)
|
|
print('PASS original magnifier Source catalogue dispatch, stale-card hold and unchanged retail callback')
|
|
return
|
|
end
|
|
if arg[3]=="category-lifecycle" then
|
|
SourceStore_CloseInternalPreview=function()end
|
|
local source=read(root..'/ops/native_source_store_secure.lua')
|
|
TurtleDonationShop={};assert(load(read(root..'/ops/data/source_shop/ShopData.lua')))()
|
|
local Provider=assert(load(read(root..'/ops/source_shop_store_provider.lua')))()
|
|
local provider=Provider.New(TurtleDonationShop,{sourceMode=true})
|
|
local sent={};StoreOutbound={SourceShopSend=function(x)sent[#sent+1]=x end,UpdateMicroButtons=function()end}
|
|
SourceStore_Refresh=function()end;PlaySound=function()end;SOUNDKIT={UI_IG_STORE_WINDOW_OPEN_BUTTON=1}
|
|
local frame={SetAttribute=function()end}
|
|
local first=assert(source:find('local sourceCategoryQueue,',1,true));local last=assert(source:find('function SourceStore_OnShow',first,true))
|
|
local chunk='local sourceStore,sourceHide=...\n'..source:sub(first,last-1)..extract(source,'function SourceStore_OnShow(self)')..'\n'..extract(source,'function SourceStore_OnAttribute(self,name,value)')
|
|
assert(load(chunk))(provider,function()end)
|
|
SourceStore_OnShow(frame);assert(#sent==2 and sent[1]=='Categories' and sent[2]=='Balance')
|
|
local function incoming(x)SourceStore_OnAttribute(frame,'sourceshopmessage',x)end
|
|
incoming('Categories:1=0=Misc=default;2=0=Skins=ticket;3=0=Gameplay=toys;4=0=Glyphs=service;5=0=Mounts=mount;6=0=Companions=pet;7=0=Fashion=tabard;8=0=Illusions=scroll;')
|
|
assert(#provider:GetProductGroups()==8 and sent[3]=='Entries:1' and #sent==3)
|
|
incoming('Entries:2=end');assert(#sent==3,'out-of-order end advanced queue')
|
|
for cat=1,8 do
|
|
incoming('Entries:'..cat..'=start')
|
|
incoming('Entries:'..cat..'=0=Item=80=='..(80000+cat)..'=0=0=0=0=0=0=0')
|
|
local before=#sent;incoming('Entries:'..cat..'=end')
|
|
assert(#sent==before+(cat<8 and 1 or 0))
|
|
if cat<8 then assert(sent[#sent]=='Entries:'..(cat+1)) end
|
|
end
|
|
assert(#provider:GetProducts(2)==1)
|
|
local before=#sent;SourceStore_OnShow(frame)
|
|
assert(#sent==before+1 and sent[#sent]=='Balance' and #provider:GetProducts(2)==1,'reopen erased complete Skins')
|
|
incoming('Categories:1=0=Changed=default;');assert(#provider:GetProductGroups()==8,'unsolicited fallback catalogue reset native state')
|
|
local generator=read(root..'/ops/native_source_store.py')
|
|
assert(generator:find('local validCategory = SourceStore_IsActive() or',1,true))
|
|
print('PASS: eight advertised groups, one Entries request per matching end, out-of-order isolation, cached Skins survives reopen, hidden fallback request guard')
|
|
return
|
|
end
|
|
if arg[3]=="clothing-preview" then
|
|
local source=read(root..'/ops/native_source_store_secure.lua')
|
|
local start=assert(source:find('local sourceItemAppearances =',1,true))
|
|
local finish=assert(source:find('local sourceStore =',start,true))
|
|
local resolve=assert(load(source:sub(start,finish-1)..'\nreturn sourcePreview'))()
|
|
local cards=resolve({id=99999,itemID=69129,modelID=49,category=6})
|
|
assert(#cards==1 and cards[1].itemModifiedAppearanceIDs[1]==324143 and cards[1].modelSceneID==596)
|
|
assert(#resolve({id=69129,itemID=99999,modelID=49,category=6})==0)
|
|
assert(#resolve({itemID=69129,category=2})==0)
|
|
assert(resolve({itemID=0,modelID=158,category=1})[1].modelSceneID==4)
|
|
assert(#resolve({itemID=0,modelID=1097,category=1})==0,'unqualified native membership must remain held')
|
|
local show=assert(load(extract(source,'local function sourceShowPreview(card, info)')..'\nreturn sourceShowPreview'))()
|
|
local original=root..'/runtime/continuation-20261113/codex/PTR-feedback-disable/native70334-ui/interface/addons/'
|
|
assert(load(extract(read(original..'blizzard_storeui/blizzard_shared_storeuisecure.lua'),'function StoreProductCard_ShowModel(self, entryInfo, showShadows, forceModelUpdate)')))()
|
|
assert(load(extract(read(original..'blizzard_sharedxml/secureutil.lua'),'function SetupPlayerForModelScene(modelScene, overrideActorName, itemModifiedAppearanceIDs, sheatheWeapons, autoDress, hideWeapons, useNativeForm, playerRaceName, playerGender)')))()
|
|
C_Glue={IsOnGlueScreen=function()return false end};UnitRace=function()return 'Human','Human',1 end
|
|
Enum={UIModelSceneFlags={SheatheWeapon=1,HideWeapon=2,Autodress=4},ModelBlendOperation={None=0}}
|
|
bit={band=function()return 0 end};C_ModelInfo={GetModelSceneInfoByID=function(id)assert(id==596);return 12,{}, {},0 end}
|
|
local tried,model;local actor={SetModelByUnit=function(_,unit,sheathe,autoDress,hide,native)assert(unit=='player' and not autoDress and native);model=true end,TryOn=function(_,id)tried=id end,SetAnimationBlendOperation=function()end}
|
|
local scene={Show=function()end,Hide=function(self)self.hidden=true end,ClearScene=function()end,SetFromModelSceneID=function(_,id)assert(id==596)end,GetPlayerActor=function()return actor end,GetActiveCamera=function()return nil end}
|
|
UnitSex=function()return 2 end
|
|
local card={GetID=function()return 42 end,ModelScene=scene,HideIcon=function(self)self.iconHidden=true end}
|
|
assert(show(card,{sharedData={cards=cards}}) and model and tried==324143 and card.iconHidden)
|
|
actor=nil;assert(not show(card,{sharedData={cards=cards}}) and scene.hidden)
|
|
C_ModelInfo.GetModelSceneInfoByID=function()return nil end
|
|
assert(not show(card,{sharedData={cards=cards}}))
|
|
assert(load(extract(read(original..'blizzard_sharedxml/secureutil.lua'),'function SetupItemPreviewActor(actor, displayID)')))()
|
|
local creature=resolve({itemID=0,modelID=158,category=1})
|
|
C_ModelInfo.GetModelSceneInfoByID=function(id)assert(id==4);return 0,{}, {},0 end
|
|
local display;local creatureActor={SetModelByCreatureDisplayID=function(_,id)display=id end,SetAnimationBlendOperation=function()end}
|
|
local hidden={};scene.GetActorByTag=function(_,tag)if tag=='unwrapped' then return creatureActor end;return {Hide=function()hidden[tag]=true end} end
|
|
scene.SetFromModelSceneID=function(_,id)assert(id==4)end
|
|
assert(show(card,{sharedData={cards=creature}}) and display==158 and hidden.wrapped and hidden['player-rider'])
|
|
creatureActor=nil;assert(not show(card,{sharedData={cards=creature}}))
|
|
print('PASS: original scene596 clothing and scene4 unwrapped creature helpers; exact IDs, held membership, missing scene/actor fallback')
|
|
return
|
|
end
|
|
for _,name in ipairs({'storeuisecure','storeuiinbound','storeuioutbound','storeuitoggle','productcardtemplates','storeuitemplates'}) do assert(load(read(store..'blizzard_shared_'..name..'.lua'))) end
|
|
local sec=read(store..'blizzard_shared_storeuisecure.lua')
|
|
assert(not sec:find('C_StoreSecure =',1,true))
|
|
local pre=sec:sub(1,assert(sec:find('local envTable =',1,true))-1)
|
|
local helperStart=assert(sec:find('-- Appended inside the original Blizzard_StoreUI',1,true))
|
|
local helper=sec:sub(helperStart)
|
|
local retail=setmetatable({}, {__index=function(_,key)error('Unexpected retail service '..key)end})
|
|
C_StoreSecure=retail;C_CatalogShop=retail;C_WowTokenPublic=retail
|
|
C_Glue={IsOnGlueScreen=function()return false end};Enum={BattlepayCardType={SmallCard=1}}
|
|
UnitSex=function()return 2 end;UnitRace=function()return 'Human','Human',1 end;UnitName=function()return 'OwnedCharacter' end
|
|
GetItemInfo=function()return nil end;C_Item={GetItemInfo=GetItemInfo}
|
|
PlaySound=function()end;SOUNDKIT={UI_IG_STORE_WINDOW_OPEN_BUTTON=1,UI_IG_STORE_WINDOW_CLOSE_BUTTON=2}
|
|
local methods={}
|
|
function methods:Show()self.shown=true end
|
|
function methods:Hide()self.shown=false end
|
|
function methods:SetShown(v)self.shown=v end
|
|
function methods:IsShown()return self.shown==true end
|
|
function methods:SetAttribute(k,v)self.attributes[k]=v end
|
|
function methods:GetAttribute(k)return self.attributes[k] end
|
|
function methods:SetText(v)self.text=v end
|
|
function methods:SetEnabled(v)self.enabled=v end
|
|
function methods:Enable()self.enabled=true end
|
|
function methods:Disable()self.enabled=false end
|
|
function methods:SetID(v)self.id=v end
|
|
function methods:GetID()return self.id end
|
|
function methods:SetScript(k,v)self.scripts[k]=v end
|
|
function methods:RegisterEvent(e)self.events[e]=true end
|
|
function methods:SetTexture(t)self.texture=t end
|
|
local function frame()
|
|
return setmetatable({shown=false,attributes={},scripts={},events={}}, {__index=function(t,k)
|
|
if methods[k] then return methods[k] end
|
|
if k=='sourcePreviewKey' then return nil end
|
|
if k:match('^Set') or k=='ClearAllPoints' or k=='Stop' or k=='Raise' or k=='Init' then return function()end end
|
|
local v=frame();rawset(t,k,v);return v
|
|
end})
|
|
end
|
|
function methods:CreateMaskTexture()return frame()end
|
|
function methods:AddMaskTexture(mask)self.mask=mask end
|
|
CreateFrame=function()return frame()end
|
|
CreateFromMixins=function()return frame()end
|
|
local pools={}
|
|
CreateFramePoolCollection=function()return {CreatePool=function(_,kind,parent,template,_,forbidden,_,count)assert(kind=='Button' and parent==StoreFrame and forbidden and count==8);pools[#pools+1]=template end}end
|
|
StoreFrame=frame();StoreConfirmationFrame=frame();StoreTooltip=frame();StoreDialog=frame()
|
|
local outbound={};StoreOutbound={SourceShopSend=function(payload)outbound[#outbound+1]=payload;return true end,UpdateMicroButtons=function()end,HidePreviewFrame=function()end}
|
|
local category,page,selected
|
|
StoreFrame_GetSelectedCategoryID=function()return category end;StoreFrame_SetSelectedCategoryID=function(v)category=v end
|
|
StoreFrame_GetSelectedPageNum=function()return page or 1 end;StoreFrame_SetSelectedPageNum=function(v)page=v end
|
|
StoreFrame_GetSelectedEntryID=function()return selected end;StoreFrame_SetSelectedEntryID=function(v)selected=v end
|
|
StoreFrame_SetCategory=function()end;StoreFrame_UpdateCoverState=function()end
|
|
StoreFrame_SetAlert=function()end;StoreFrame_HideAlert=function()end
|
|
StoreProductCard_UpdateAllStates=function()end
|
|
StoreTooltip_Show=function(name,description)StoreTooltip.title=name;StoreTooltip.description=description end
|
|
StoreFrame.CategoryTreeScrollContainer.UpdateCategories=function()end
|
|
-- The original local pool configuration is injected, not a new card template.
|
|
assert(load('local productCardTemplateData={SmallStoreCardTemplate={poolSize=8}}\n'..pre..helper))()
|
|
for _,signature in ipairs({'function StoreFrame_OnLoad(self)','function StoreFrame_OnShow(self)','function StoreFrame_OnHide(self)','function StoreFrame_OnAttributeChanged(self, name, value)','function StoreFrame_BeginPurchase(entryID)','function StoreConfirmationFinalBuy_OnClick(self)'}) do assert(load(extract(sec,signature)))() end
|
|
StoreFrame_OnLoad(StoreFrame);assert(#pools==1 and StoreFrame:GetAttribute('sourceshop')==true)
|
|
StoreFrame:Show();StoreFrame_OnShow(StoreFrame)
|
|
assert(outbound[1]=='Categories' and outbound[2]=='Balance')
|
|
local function incoming(s)StoreFrame_OnAttributeChanged(StoreFrame,'sourceshopmessage',s)end
|
|
incoming('Categories:1=0=Mounts=mount;2=0=Skins=skin;')
|
|
assert(outbound[3]=='Entries:1')
|
|
incoming('Entries:1=start');incoming('Entries:1=0=Local Mount=80==81088=123=0=0=0=0=0=0');incoming('Entries:1=end');incoming('Balance:100')
|
|
-- Forever layout: Mounts and Services tops; each holds one Source category, shown directly (no child row).
|
|
local groups=SourceStore_GetProductGroups();assert(#groups==2 and groups[1].groupID==-8001 and groups[2].groupID==-8004)
|
|
assert(SourceStore_GetProducts(-8001)[1]==81088 and SourceStore_GetProductGroupInfo(-8001).groupName=='Mounts')
|
|
assert(SourceStore_GetProducts(1)[1]==81088)
|
|
local entry=SourceStore_GetEntryInfo(81088);assert(entry.sharedData.sourcePriceTokens==80 and entry.sharedData.sourceRaceEligible==nil and entry.sharedData.buyableHere)
|
|
StoreCardMixin={}
|
|
local cardSource=read(store..'blizzard_shared_productcardtemplates.lua')
|
|
for _,signature in ipairs({'function StoreCardMixin:GetEntryInfo(entryID)','function StoreCardMixin:UpdateCard(entryID, forceModelUpdate)','function StoreCardMixin:OnClick()','function StoreCardMixin:ShowTooltip()'}) do assert(load(extract(cardSource,signature)))() end
|
|
local card=frame();card.GetEntryInfo=StoreCardMixin.GetEntryInfo;card.ShowIcon=function(_,info)assert(info.sourcePriceTokens==80)end;card.UpdateState=function()end;card.SetDefaultCardTexture=function()end
|
|
StoreCardMixin.UpdateCard(card,81088,true);assert(card.id==81088 and card.CurrentPrice.text=='80 Tokens' and card.ProductName.text=='Local Mount')
|
|
StoreCardMixin.OnClick(card);assert(StoreFrame.BuyButton.enabled)
|
|
StoreFrame_BeginPurchase(81088);assert(StoreConfirmationFrame:IsShown() and StoreConfirmationFrame.NoticeFrame.Price.text=='80 Tokens')
|
|
StoreConfirmationFinalBuy_OnClick(StoreConfirmationFrame.BuyButton);assert(outbound[#outbound]=='Buy:81088' and not StoreFrame.BuyButton.enabled)
|
|
local n=#outbound;StoreConfirmationFinalBuy_OnClick(StoreConfirmationFrame.BuyButton);assert(#outbound==n,'duplicate Buy emitted')
|
|
incoming('BuyResult:ok');assert(outbound[#outbound]=='Balance' and not StoreFrame.BuyButton.enabled)
|
|
incoming('Balance:20');assert(not StoreFrame.BuyButton.enabled)
|
|
incoming('Entries:2=start')
|
|
incoming('Entries:2=0=Mark of the Grim Totem=150==81256=0=0=0=0=0=0=0');incoming('Entries:2=end');incoming('Balance:200')
|
|
local mismatch=SourceStore_GetEntryInfo(81256)
|
|
assert(mismatch.sharedData.sourceRaceEligible==false and mismatch.sharedData.buyableHere)
|
|
card.ShowIcon=function(_,info)assert(info.texture=='Interface\\Icons\\INV_Misc_QuestionMark')end
|
|
StoreCardMixin.UpdateCard(card,81256,true);StoreCardMixin.OnClick(card)
|
|
assert(card.DisabledOverlay:IsShown() and StoreFrame.BuyButton.enabled,'Race display incorrectly gates Source purchase')
|
|
|
|
StoreFrame_OnAttributeChanged(StoreFrame,'action','EscapePressed');assert(not StoreFrame:IsShown() and StoreFrame:GetAttribute('escaperesult'))
|
|
-- Actual global inbound/outbound boundary, isolated from the secure locals.
|
|
local incomingFrame;CreateFrame=function()incomingFrame=frame();return incomingFrame end
|
|
SwapToGlobalEnvironment=function()end;InGlue=function()return false end
|
|
C_ChatInfo={RegisterAddonMessagePrefix=function(p)assert(p=='TW_SHOP')end,SendAddonMessage=function(prefix,payload,distribution,target)assert(prefix=='TW_SHOP' and distribution=='WHISPER' and target=='OwnedCharacter');outbound[#outbound+1]=payload end}
|
|
assert(load(read(store..'blizzard_shared_storeuiinbound.lua')))()
|
|
local before=StoreFrame:GetAttribute('sourceshopmessage')
|
|
incomingFrame.scripts.OnEvent(incomingFrame,'CHAT_MSG_ADDON','TW_SHOP','Balance:50','WHISPER');assert(StoreFrame:GetAttribute('sourceshopmessage')==before)
|
|
incomingFrame.scripts.OnEvent(incomingFrame,'CHAT_MSG_ADDON','TW_SHOP','Balance:50','GUILD');assert(StoreFrame:GetAttribute('sourceshopmessage')=='Balance:50')
|
|
assert(SourceStoreGlobalSend('Buy:81088'));assert(not SourceStoreGlobalSend('Buy:81088;arbitrary'))
|
|
assert(C_StoreSecure==retail,'retail global replaced')
|
|
print('PASS: original Store callbacks/pools, Source token catalogue, confirmation/no-repeat Buy, unknown race preserved, attribute/self-WHISPER boundary, no retail-service calls')
|