883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
101 lines
8.7 KiB
Lua
101 lines
8.7 KiB
Lua
-- Exercise saved original70334 menu transitions and list regeneration.
|
|
local root=arg[1] or 'runtime/continuation-20261113/codex/W15-native-source-controls/native-assets/children/interface/addons/'
|
|
local function frame()
|
|
local f={shown=true,scripts={}}
|
|
function f:Hide()self.shown=false end;function f:Show()self.shown=true;if self.scripts.OnShow then self.scripts.OnShow(self)end end
|
|
function f:HookScript(event,fn)self.scripts[event]=fn end
|
|
function f:RegisterEvent()end;function f:Enable()self.enabled=true end;function f:Disable()self.enabled=false end
|
|
return f
|
|
end
|
|
StaticPopupDialogs={};ACCEPT='Accept';CANCEL='Cancel';GUILD='Guild'
|
|
GUILDCONTROL_GUILDRANKS='Ranks';GUILDCONTROL_RANK_PERMISSIONS='Permissions';GUILDCONTROL_BANK_PERMISSIONS='Bank';GUILDCONTROL_DISCORD_SETTINGS='Discord %s'
|
|
local leader,discord=true,false
|
|
function IsGuildLeader()return leader end;function IsInGuild()return true end
|
|
function StaticPopup_Hide()end;function CreateAtlasMarkup()return '[icon]'end
|
|
C_Discord={IsEnabled=function()return discord end,UpdateDiscordServers=function()end,UpdateGuildLobby=function()end}
|
|
C_GuildBank={IsGuildBankEnabled=function()return true end}
|
|
assert(loadfile(root..'blizzard_guildcontrolui/blizzard_guildcontrolui.lua'))()
|
|
local nativeOrderUpdate=GuildControlUI_RankOrder_Update
|
|
assert(loadfile(root..'blizzard_communities/communitieslist.lua'))()
|
|
GuildControlUI=frame();GuildControlUI.dropdown={SetWidth=function()end,SetupMenu=function(self,fn)self.generator=fn end}
|
|
GuildControlUIRankOrderFrame=frame();GuildControlUIRankSettingsFrame=frame();GuildControlUIRankBankFrame=frame();GuildControlUIRankDiscordFrame=frame()
|
|
GuildControlUI.orderFrame=GuildControlUIRankOrderFrame;GuildControlUI.rankPermFrame=GuildControlUIRankSettingsFrame;GuildControlUI.bankTabFrame=GuildControlUIRankBankFrame;GuildControlUI.discordFrame=GuildControlUIRankDiscordFrame
|
|
local nativeUpdates=0;GuildControlUI_RankPermissions_Update=function()nativeUpdates=nativeUpdates+1 end;GuildControlUI_RankOrder_Update=function()end;GuildControlUI_BankTabPermissions_Update=function()end;GuildControlUI_Discord_Update=function()end
|
|
for _,key in ipairs({'BankBg','BankLabel','Checkbox15','Checkbox16','Checkbox19','GoldBox','Checkbox5','Checkbox7','Checkbox6','Checkbox8','Checkbox18','Checkbox18Tooltip','Checkbox21','OfficerBg'})do _G['GuildControlUIRankSettingsFrame'..key]=frame()end
|
|
GuildControlUIRankSettingsFrame.OfficerCheckbox=frame();GuildControlUIRankSettingsFrame.OfficerPermissions=frame()
|
|
GuildControlUI_SetupSelected(1)
|
|
local function menu()
|
|
local rows={};GuildControlUI.dropdown.generator(nil,{SetTag=function()end,CreateRadio=function(_,label,selected,callback,data)rows[#rows+1]={label=label,selected=selected,callback=callback,data=data}end});return rows
|
|
end
|
|
assert(#menu()==2) -- Native source omits bank3 without replacing original callbacks.
|
|
ScrollBoxConstants={RetainScrollPosition=1};Enum={ClubType={Character=1,BattleNet=2}}
|
|
C_Club={ShouldAllowClubType=function()return true end};C_ClubFinder={IsEnabled=function()return true end,IsCommunityFinderEnabled=function()return true end}
|
|
function CreateDataProvider()
|
|
local d={rows={}};function d:Insert(r)table.insert(self.rows,r)end
|
|
function d:RemoveAllByPredicate(predicate)for i=#self.rows,1,-1 do if predicate(self.rows[i])then table.remove(self.rows,i)end end end
|
|
return d
|
|
end
|
|
local nativeGuild={clubId='real-source-guild'}
|
|
local list=setmetatable({ScrollBox={SetDataProvider=function(self,p)self.provider=p end,GetDataProvider=function(self)return self.provider end}}, {__index=CommunitiesListMixin})
|
|
CommunitiesGuildLogFrame=frame()
|
|
CommunitiesFrame={GuildLogButton=frame(),GuildInfoTab=frame(),CommunitiesList=list,GuildFinderFrame={UpdateType=function()end},SetTitle=function(self,title)self.title=title end}
|
|
function list:GetCommunitiesFrame()return CommunitiesFrame end
|
|
function list:GetCommunitiesList()return {nativeGuild}end
|
|
function list:ValidateTickets()end;function list:GetTickets()return {}end;function list:GetInvitations()return {}end;function list:GetClubFinderInvitations()return {}end
|
|
list:Update();assert(#list.ScrollBox.provider.rows==2) -- Original native producer emits guild/guildfinder only.
|
|
-- No addon hook or provider post-mutation participates in these callbacks.
|
|
GuildControlUIRankPermissions_HideGuildBankOptions(GuildControlUI)
|
|
local rows=menu();assert(#rows==2 and rows[1].data==1 and rows[2].data==2)
|
|
rows[2].callback(2);assert(GuildControlUI.selectedTab==2 and GuildControlUI.currFrame==GuildControlUIRankSettingsFrame and nativeUpdates==1)
|
|
for _,key in ipairs({'BankBg','BankLabel','Checkbox15','Checkbox16','Checkbox19','GoldBox'})do assert(not _G['GuildControlUIRankSettingsFrame'..key].shown)end
|
|
for _,key in ipairs({'Checkbox18','Checkbox18Tooltip','Checkbox21','OfficerBg'})do assert(not _G['GuildControlUIRankSettingsFrame'..key].shown)end
|
|
assert(not GuildControlUIRankSettingsFrame.OfficerCheckbox.shown and not GuildControlUIRankSettingsFrame.OfficerPermissions.shown)
|
|
for _,key in ipairs({'Checkbox5','Checkbox7','Checkbox6','Checkbox8'})do assert(_G['GuildControlUIRankSettingsFrame'..key].shown)end
|
|
rows=menu();rows[1].callback(1);assert(GuildControlUI.selectedTab==1 and not GuildControlUIRankBankFrame.shown and GuildControlUIRankOrderFrame.shown)
|
|
list:Update();local filtered=list.ScrollBox.provider.rows;assert(#filtered==2 and filtered[1].clubInfo==nativeGuild and filtered[2].setGuildFinder)
|
|
-- Existing Discord gate and native officer transition are deliberately preserved.
|
|
discord=true;rows=menu();assert(#rows==3 and rows[3].data==4);leader=false;GuildControlUI_Setup();rows=menu();assert(#rows==1 and rows[1].data==4 and GuildControlUI.selectedTab==4)
|
|
-- New Rank remains the original callback, with original mutation arguments.
|
|
local added;SOUNDKIT={IG_MAINMENU_OPEN=1};GUILD_NEW_RANK='New Rank';function PlaySound()end
|
|
function GuildControlAddRank(name)added=name end
|
|
GuildControlUI_AddRankButton_OnClick();assert(added=='New Rank')
|
|
-- Execute actual patched XML OnShow code extracted by the focused checker.
|
|
local hideHistory=assert(loadfile(arg[2]))();local history=frame()
|
|
function QueryGuildEventLog()error('unsupported history request escaped')end
|
|
hideHistory(history);assert(not history.shown)
|
|
|
|
-- Original rank order update keeps NewRank/name widgets while hiding all
|
|
-- unsupported delete/reorder controls, including an empty last rank.
|
|
RANK='Rank';function GuildControlGetNumRanks()return 5 end
|
|
function GuildControlGetRankName(i)return 'Rank'..i end
|
|
function GetNumMembersInRank()return 0 end;function GuildControlGetAllowedShifts()return true,true end
|
|
C_GuildInfo={GuildControlGetRankFlags=function()return {}end}
|
|
local orderFrame={newButton=frame(),dupButton=frame(),GetName=function()return 'TestOrder'end}
|
|
for i=1,5 do
|
|
local r=frame();r.rankLabel={SetText=function()end};r.nameBox={SetText=function(self,value)self.value=value end};r.deleteButton=frame();r.upButton=frame();r.downButton=frame();_G['TestOrderRank'..i]=r
|
|
end
|
|
nativeOrderUpdate(orderFrame);assert(orderFrame.newButton.shown)
|
|
for i=1,5 do local r=_G['TestOrderRank'..i];assert(r.shown and r.nameBox.value=='Rank'..i and not r.deleteButton.shown and not r.upButton.shown and not r.downButton.shown)end
|
|
-- All thirteen labels/indices remain original native widgets. Their flag
|
|
-- callback now preserves explicit Source intent; the full transport lifecycle
|
|
-- is exercised in native_guild_rank_intent_test.lua.
|
|
for i=1,13 do
|
|
local text={SetText=function(self,value)self.value=value end};_G['GuildControlUIRankSettingsFrameCheckbox'..i..'Text']=text;_G['GUILDCONTROL_OPTION'..i]='OriginalLocalized'..i
|
|
end
|
|
function GuildControlSetRank()end;leader=true;GuildControlUI_OnLoad(GuildControlUI)
|
|
local changedIndex,checked
|
|
function GuildControlUI_SourceRankFlag(i,value)changedIndex=i;checked=value end
|
|
for i=1,13 do
|
|
assert(_G['GuildControlUIRankSettingsFrameCheckbox'..i..'Text'].value=='OriginalLocalized'..i)
|
|
GuildControlUI_CheckClicked({GetChecked=function()return true end,GetID=function()return i end})
|
|
assert(changedIndex==i and checked==true)
|
|
end
|
|
-- The actual native display-mode function redirects a formerly selected
|
|
-- Preferred Play Settings pane to Guild Info without opening/requesting it.
|
|
CommunitiesFrameMixin={};COMMUNITIES_FRAME_DISPLAY_MODES={GUILD_INFO={},GUILD_PREFERRED_PLAY_SETTINGS={}}
|
|
assert(loadfile(arg[3]))()
|
|
local display={displayMode=COMMUNITIES_FRAME_DISPLAY_MODES.GUILD_INFO,CloseActiveDialogs=function()error('unexpected pane transition')end}
|
|
CommunitiesFrameMixin.SetDisplayMode(display,COMMUNITIES_FRAME_DISPLAY_MODES.GUILD_PREFERRED_PLAY_SETTINGS)
|
|
assert(display.displayMode==COMMUNITIES_FRAME_DISPLAY_MODES.GUILD_INFO)
|
|
print('PASS native-owned rank widgets/list provider, bank/community filtering, actual extra-control hide helper, original NewRank/Source-intent rename, delete/reorder hidden,13 native permission indices, history/preferred-settings hold, Discord preserved')
|