66 lines
3.2 KiB
Lua
66 lines
3.2 KiB
Lua
-- OctoTextSize: addon-local factory; Blizzard CreateFrame is unchanged.
|
|
local CreateFrame = OctoTextSize and OctoTextSize.WrapFactory(CreateFrame) or CreateFrame
|
|
-- Source guilds use the original Blizzard Communities frame and club service.
|
|
-- This module only retains the existing character-name Friends simplification.
|
|
WoWHybridUI = WoWHybridUI or {};
|
|
local state = WoWHybridUI;
|
|
|
|
---------------------------------------------------------------- friends
|
|
StaticPopupDialogs["WOWHYBRID_ADD_FRIEND"] = {
|
|
text = ADD_FRIEND_LABEL or "Enter character name:",
|
|
button1 = ACCEPT, button2 = CANCEL,
|
|
hasEditBox = 1, maxLetters = 12,
|
|
OnAccept = function(self)
|
|
local box = self.GetEditBox and self:GetEditBox() or self.editBox or self.EditBox;
|
|
local name = box and strtrim(box:GetText() or "") or "";
|
|
if name ~= "" and not name:find("#", 1, true) then C_FriendList.AddFriend(name); end
|
|
end,
|
|
EditBoxOnEnterPressed = function(self)
|
|
local parent = self:GetParent();
|
|
StaticPopupDialogs["WOWHYBRID_ADD_FRIEND"].OnAccept(parent);
|
|
parent:Hide();
|
|
end,
|
|
EditBoxOnEscapePressed = function(self) self:GetParent():Hide(); end,
|
|
OnShow = function(self) local box = self.GetEditBox and self:GetEditBox() or self.editBox or self.EditBox; if box then box:SetFocus(); end end,
|
|
timeout = 0, whileDead = 1, hideOnEscape = 1,
|
|
};
|
|
|
|
local function HideFriendsExtras()
|
|
if FriendsFrameBattlenetFrame then FriendsFrameBattlenetFrame:Hide(); end
|
|
if FriendsFrame and FRIEND_TAB_QUICK_JOIN then
|
|
PanelTemplates_HideTab(FriendsFrame, FRIEND_TAB_QUICK_JOIN);
|
|
if PanelTemplates_GetSelectedTab(FriendsFrame) == FRIEND_TAB_QUICK_JOIN then
|
|
PanelTemplates_SetTab(FriendsFrame, FRIEND_TAB_FRIENDS); FriendsFrame_Update();
|
|
end
|
|
end
|
|
end
|
|
|
|
local function InstallFriendsNamesOnly()
|
|
if C_InputInterfaceStyle.GetCurrentStyle() == Enum.InputDeviceInterfaceType.Gamepad then return end
|
|
if state.friendsInstalled or not FriendsFrame or not FriendsFrameAddFriendButton then return state.friendsInstalled; end
|
|
FriendsFrameAddFriendButton:SetScript("OnClick", function() StaticPopup_Show("WOWHYBRID_ADD_FRIEND"); end);
|
|
if FriendsFrameBattlenetFrame then hooksecurefunc(FriendsFrameBattlenetFrame, "Show", function(f) f:Hide(); end); end
|
|
FriendsFrame:HookScript("OnShow", HideFriendsExtras);
|
|
if FriendsTabHeader and FriendsTabHeader.RefreshTabVisibility then
|
|
hooksecurefunc(FriendsTabHeader, "RefreshTabVisibility", function(header)
|
|
if header.TabSystem then
|
|
if header.recentAlliesTabID then header.TabSystem:SetTabShown(header.recentAlliesTabID, false); end
|
|
if header.recruitAFriendTabID then header.TabSystem:SetTabShown(header.recruitAFriendTabID, false); end
|
|
if header.TryUpdateInvalidTabSelection then header:TryUpdateInvalidTabSelection(); end
|
|
end
|
|
end);
|
|
FriendsTabHeader:RefreshTabVisibility();
|
|
end
|
|
HideFriendsExtras();
|
|
state.friendsInstalled = true;
|
|
return true;
|
|
end
|
|
|
|
local events = CreateFrame("Frame");
|
|
events:RegisterEvent("ADDON_LOADED");
|
|
events:RegisterEvent("PLAYER_LOGIN");
|
|
events:SetScript("OnEvent", function()
|
|
InstallFriendsNamesOnly();
|
|
state.guildPresentation = "BlizzardCommunities";
|
|
end);
|