View Single Post
05/30/19, 10:20 AM   #6
Phuein
 
Phuein's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 132
Post

I've come to a solution. Not ideal, as I override a global function, but it's a very specific one-liner. This lets me affect the channel links (which only seem to apply to the chat box, and to this specific usage) without changing any data tables.

Code:
_G["ZO_LinkHandler_CreateChannelLink"] = CreateChannelLink
Code:
local OriginalCreateChannelLink = _G["ZO_LinkHandler_CreateChannelLink"]
local function CreateChannelLink(channelName)
	-- Disabled.
	if not Junkee.savedVars.shortGuildNames then return OriginalCreateChannelLink(channelName) end

	local name = channelName

	for i = CHAT_CHANNEL_GUILD_1, CHAT_CHANNEL_GUILD_5 do
		if GetChannelName(i) == channelName then
			-- Get only the intials.
			name = name:gsub("(%a)%w*", function(l) return l end)
			-- Remove the spaces.
			name = name:gsub("%s+", "")
		end
	end

	-- Only change the appearance, not the data.
	return ZO_LinkHandler_CreateLink(name, nil, CHANNEL_LINK_TYPE, channelName)
end
  Reply With Quote