跟随版本 0.8.19

This commit is contained in:
rucky
2026-03-24 15:56:28 +08:00
parent 40d37dc8c4
commit c0f1ecc713
19 changed files with 2227 additions and 259 deletions

View File

@@ -504,21 +504,7 @@ end
local function GetChannelAliasKeys(name)
local key = ChannelKey(name)
if key == "" then return nil end
-- Check exact match first
local gIdx = CHANNEL_ALIAS_GROUP_INDEX[key]
if not gIdx then
-- Check substring match for each alias in each group.
-- Only use aliases 3+ chars long to avoid false positives (e.g. "h" matching "whisper").
for i, group in ipairs(CHANNEL_ALIAS_GROUPS) do
for _, alias in ipairs(group) do
if string.len(alias) >= 3 and string.find(key, alias, 1, true) then
gIdx = i
break
end
end
if gIdx then break end
end
end
if not gIdx then return nil end
return CHANNEL_ALIAS_GROUPS[gIdx]
end
@@ -583,7 +569,7 @@ local function GetJoinedChannels()
-- plus individual channels that are not aliases.
-- For alias groups (like hc/hardcore/硬核), only add ONE representative
-- so we don't create duplicate conflicting entries.
local customChannels = { "hc", "硬核", "hardcore", "h", "交易", "综合", "世界防务", "本地防务", "world" }
local customChannels = { "hc", "硬核", "hardcore", "h", "交易", "综合", "世界防务", "本地防务", "world", "世界" }
local seenAliasGroups = {}
for _, cname in ipairs(customChannels) do
local key = ChannelKey(cname)
@@ -600,20 +586,7 @@ local function GetJoinedChannels()
else
local aliases = GetChannelAliasKeys(cname)
if aliases then
-- This is an alias channel - check if any alias is already seen/added
local gIdx = CHANNEL_ALIAS_GROUP_INDEX[key]
-- Also check substring aliases
if not gIdx then
for i, group in ipairs(CHANNEL_ALIAS_GROUPS) do
for _, a in ipairs(group) do
if string.find(key, a, 1, true) then
gIdx = i
break
end
end
if gIdx then break end
end
end
local alreadyInJoined = false
if gIdx then
for _, a in ipairs(CHANNEL_ALIAS_GROUPS[gIdx]) do
@@ -6477,6 +6450,39 @@ function SFrames.Chat:Initialize()
GuildRoster()
end
SFrames:RefreshClassColorCache()
if JoinChannelByName and GetChannelList then
local autoJoinFrame = CreateFrame("Frame")
local waitTime = 0
autoJoinFrame:SetScript("OnUpdate", function()
waitTime = waitTime + arg1
if waitTime < 8 then return end
autoJoinFrame:SetScript("OnUpdate", nil)
local inWorld = false
local raw = { GetChannelList() }
local ci = 1
while ci <= table.getn(raw) do
local cname = raw[ci + 1]
if type(cname) == "string" and string.lower(cname) == "world" then
inWorld = true
break
end
ci = ci + 3
end
if not inWorld then
JoinChannelByName("world")
local applyWait = 0
autoJoinFrame:SetScript("OnUpdate", function()
applyWait = applyWait + arg1
if applyWait < 3 then return end
autoJoinFrame:SetScript("OnUpdate", nil)
if SFrames and SFrames.Chat then
SFrames.Chat:ApplyAllTabChannels()
end
end)
end
end)
end
end)
-- 团队成员变化时更新职业缓存