Skip to content

Commit b5b9cb6

Browse files
committed
由于暴雪接口变动,正式服不再提供聊天消息显示功能
1 parent 9990b2a commit b5b9cb6

File tree

12 files changed

+265
-185
lines changed

12 files changed

+265
-185
lines changed

InputInput/API.lua

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,19 +259,36 @@ Fun({
259259
['1.15.0'] = C_AddOns.GetNumAddOns,
260260
---@diagnostic disable-next-line: undefined-global
261261
['1.13.2'] = GetNumAddOns,
262-
['1.0.0'] = function () end
262+
['1.0.0'] = function() end
263263
},
264264
C_AddOns_GetAddOnInfo = {
265265
['1.15.0'] = C_AddOns.GetAddOnInfo,
266266
---@diagnostic disable-next-line: undefined-global
267267
['1.13.2'] = GetAddOnInfo,
268-
['1.0.0'] = function () end
268+
['1.0.0'] = function() end
269269
},
270270
C_AddOns_IsAddOnLoaded = {
271271
['1.15.0'] = C_AddOns.IsAddOnLoaded,
272272
---@diagnostic disable-next-line: undefined-global
273273
['1.13.2'] = IsAddOnLoaded,
274-
['1.0.0'] = function () end
274+
['1.0.0'] = function() end
275+
},
276+
issecretvalue = {
277+
['12.0.0'] = issecretvalue,
278+
['1.0.0'] = function() return false end
279+
},
280+
C_ClassColor_GetClassColor = {
281+
['8.1.5'] = function (className)
282+
local color = C_ClassColor.GetClassColor(className)
283+
color.colorStr = color:GenerateHexColor()
284+
return color
285+
end,
286+
['1.0.0'] = function (class)
287+
return RAID_CLASS_COLORS[class]
288+
end
289+
},
290+
C_BattleNet_GetAccountInfoByGUID = {
291+
['1.1.0'] = C_BattleNet.GetAccountInfoByGUID
275292
}
276293
})
277294

InputInput/Icon.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ local C_ClubFinder_GetRecruitingClubInfoFromFinderGUID = API.C_ClubFinder_GetRec
1313
local GetAchievementInfo = API.GetAchievementInfo
1414
local UnitClass = API.UnitClass
1515
local C_CurrencyInfo_GetCurrencyInfo = API.C_CurrencyInfo_GetCurrencyInfo
16+
local C_ClassColor_GetClassColor = API.C_ClassColor_GetClassColor
1617

1718
local emotes = {
1819
{ value = "angel", key = L["angel"] },
@@ -178,7 +179,7 @@ local function ReplaceIconString(text)
178179
-- trade_level = level
179180
local unit = UnitTokenFromGUID(guid)
180181
if unit then
181-
local classColor = RAID_CLASS_COLORS[select(2, UnitClass(unit))]
182+
local classColor = C_ClassColor_GetClassColor(select(2, UnitClass(unit)))
182183
if not classColor then
183184
---@diagnostic disable-next-line: missing-fields
184185
classColor = {

InputInput/InputInput_Cata.toc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
## Notes-zhTW: 輸入框增強
88
## Notes-ruRU: Расширение поля ввода
99
## Author: York
10-
## Version: 1.1.1
11-
## X-Date: 2025-01-25
10+
## Version: 1.1.2
11+
## X-Date: 2025-03-04
1212

1313
## X-Category: Interface Enhancements
1414
## X-Curse-Project-ID: 1076615

InputInput/InputInput_Classic.toc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
## Notes-zhTW: 輸入框增強
88
## Notes-ruRU: Расширение поля ввода
99
## Author: York
10-
## Version: 1.1.1
11-
## X-Date: 2025-01-25
10+
## Version: 1.1.2
11+
## X-Date: 2025-03-04
1212

1313
## X-Category: Interface Enhancements
1414
## X-Curse-Project-ID: 1076615

InputInput/InputInput_Mainline.toc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
## Notes-zhTW: 輸入框增強
88
## Notes-ruRU: Расширение поля ввода
99
## Author: York
10-
## Version: 1.1.1
11-
## X-Date: 2025-01-25
10+
## Version: 1.1.2
11+
## X-Date: 2025-03-04
1212

1313
## Category-enUS: Chat
1414
## Category-deDE: Chat

InputInput/InputInput_TBC.toc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
## Notes-zhTW: 輸入框增強
88
## Notes-ruRU: Расширение поля ввода
99
## Author: York
10-
## Version: 1.1.1
11-
## X-Date: 2025-01-25
10+
## Version: 1.1.2
11+
## X-Date: 2025-03-04
1212

1313
## X-Category: Interface Enhancements
1414
## X-Curse-Project-ID: 1076615

InputInput/InputInput_Vanilla.toc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
## Notes-zhTW: 輸入框增強
88
## Notes-ruRU: Расширение поля ввода
99
## Author: York
10-
## Version: 1.1.1
11-
## X-Date: 2025-01-25
10+
## Version: 1.1.2
11+
## X-Date: 2025-03-04
1212

1313
## X-Category: Interface Enhancements
1414
## X-Curse-Project-ID: 1076615

InputInput/InputInput_Wrath.toc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
## Notes-zhTW: 輸入框增強
88
## Notes-ruRU: Расширение поля ввода
99
## Author: York
10-
## Version: 1.1.1
11-
## X-Date: 2025-01-25
10+
## Version: 1.1.2
11+
## X-Date: 2025-03-04
1212

1313
## X-Category: Interface Enhancements
1414
## X-Curse-Project-ID: 1076615

InputInput/Main.lua

Lines changed: 67 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ local C_AddOns_GetAddOnEnableState = API.C_AddOns_GetAddOnEnableState
2323
local C_AddOns_EnableAddOn = API.C_AddOns_EnableAddOn
2424
local C_AddOns_DisableAddOn = API.C_AddOns_DisableAddOn
2525
local C_ChatInfo_RegisterAddonMessagePrefix = API.C_ChatInfo_RegisterAddonMessagePrefix
26+
local issecretvalue = API.issecretvalue
27+
local C_ClassColor_GetClassColor = API.C_ClassColor_GetClassColor
2628
-- 引入结巴分词库
2729
local jieba = LibStub("inputinput-jieba")
2830

@@ -579,15 +581,20 @@ end
579581
---@param name string
580582
---@param realm string
581583
---@return string
582-
local function addLevel(name, realm)
583-
local maxLevel = GetMaxPlayerLevel()
584-
local level = UnitLevel(name)
584+
local function addLevel(name, realm, senderGUID)
585+
local level = 0
586+
if not issecretvalue(name) then
587+
level = UnitLevel(name)
588+
end
585589
local name_realm = name
586-
if realm and #realm > 0 and realm ~= GetRealmName() then
590+
if not issecretvalue(realm) and realm and realm ~= GetRealmName() then
587591
name_realm = U:join('-', name, realm)
588592
end
589-
if level and level ~= 0 and maxLevel ~= level then
590-
name_realm = '|cFF909399' .. level .. ' |r' .. name_realm
593+
if level and level ~= 0 then
594+
local maxLevel = GetMaxPlayerLevel()
595+
if maxLevel ~= level then
596+
name_realm = '|cFF909399' .. level .. ' |r' .. name_realm
597+
end
591598
end
592599
return name_realm
593600
end
@@ -613,30 +620,31 @@ local function FormatMSG(channel, senderGUID, msg, isChannel, sender, isPlayer)
613620
name_realm = '|BTag:' .. accountInfo.battleTag .. '|BTag'
614621
end
615622
end
616-
elseif #senderGUID > 0 then
623+
else
617624
local localizedClass, englishClass, localizedRace, englishRace, sex, name, realmName = GetPlayerInfoByGUID(
618625
senderGUID)
619-
class = englishClass
620-
name_realm = addLevel(name, realmName)
626+
if localizedClass then
627+
class = englishClass
628+
name_realm = addLevel(name, realmName, senderGUID)
629+
end
621630
end
622631
end
623-
if #name_realm <= 0 then
632+
if not issecretvalue(name_realm) and #name_realm <= 0 then
624633
name_realm = sender or ''
625634
local name, realm = strsplit('-', name_realm)
626635
class = UnitClass(name)
627-
name_realm = addLevel(name, realm)
636+
name_realm = addLevel(name, realm, senderGUID)
628637
end
629638

630-
local classColor = RAID_CLASS_COLORS[class]
639+
local classColor = C_ClassColor_GetClassColor(class)
631640
if not classColor then
632641
---@diagnostic disable-next-line: missing-fields
633642
classColor = {
634643
colorStr = 'FF' .. channelColor
635644
}
636645
else
637-
U:UnitColor(name_realm, classColor.colorStr)
646+
U:UnitColor(name_realm, classColor.colorStr, senderGUID)
638647
end
639-
640648
local TO = ''
641649
if isPlayer then
642650
TO = L['TO'] .. ': '
@@ -1183,22 +1191,25 @@ local function eventSetup(editBox, bg, border, backdropFrame2, resizeButton, tex
11831191
end
11841192
end)
11851193

1186-
1187-
-- hooksecurefunc("ChatEdit_UpdateHeader", function(self)
1188-
-- ChannelChange(self, bg, bg3, border, backdropFrame2, texture_btn, channel_name, II_LANG)
1189-
-- end)
11901194
-- 11.2.7
1191-
---@diagnostic disable-next-line: undefined-field
1192-
for _, frameName in ipairs(_G.CHAT_FRAMES) do
1193-
local chat = _G[frameName]
1194-
if chat then
1195-
local editbox = chat.editBox
1196-
hooksecurefunc(editbox, "UpdateHeader", function(self)
1197-
ChannelChange(self, bg, bg3, border, backdropFrame2, texture_btn, channel_name, II_LANG)
1198-
end)
1195+
if W.ClientVersion > 110207 then
1196+
---@diagnostic disable-next-line: undefined-field
1197+
for _, frameName in ipairs(_G.CHAT_FRAMES) do
1198+
local chat = _G[frameName]
1199+
if chat then
1200+
local editbox = chat.editBox
1201+
hooksecurefunc(editbox, "UpdateHeader", function(self)
1202+
ChannelChange(self, bg, bg3, border, backdropFrame2, texture_btn, channel_name, II_LANG)
1203+
end)
1204+
end
11991205
end
1206+
else
1207+
hooksecurefunc("ChatEdit_UpdateHeader", function(self)
1208+
ChannelChange(self, bg, bg3, border, backdropFrame2, texture_btn, channel_name, II_LANG)
1209+
end)
12001210
end
12011211

1212+
12021213
-- 设置焦点获得事件处理函数
12031214
editBox:HookScript("OnEditFocusGained", function(self)
12041215
HideEuiBorder(self)
@@ -1225,10 +1236,14 @@ local function eventSetup(editBox, bg, border, backdropFrame2, resizeButton, tex
12251236
end)
12261237

12271238
local frame_E = CreateFrame("Frame", "II_EVENT_FRAME")
1228-
for k, v in pairs(ChatLabels) do
1229-
frame_E:RegisterEvent(v)
1239+
1240+
--正式服关闭聊天信息显示功能
1241+
if W.ClientVersion >= 10100 and W.ClientVersion <= 110207 then
1242+
for k, v in pairs(ChatLabels) do
1243+
frame_E:RegisterEvent(v)
1244+
end
1245+
frame_E:RegisterEvent('CHAT_MSG_CHANNEL')
12301246
end
1231-
frame_E:RegisterEvent('CHAT_MSG_CHANNEL')
12321247

12331248
frame_E:HookScript("OnEvent",
12341249
function(self, ...)
@@ -1405,7 +1420,7 @@ frame:HookScript("OnEvent", function(self_f, event, ...)
14051420
if not isInit then
14061421
editBox, bg, border, backdropFrame2, resizeButton, resizeBtnTexture, channel_name, II_TIP, II_LANG, bg3 =
14071422
MAIN:Init()
1408-
1423+
14091424
C_ChatInfo_RegisterAddonMessagePrefix('INPUTINPUT_V')
14101425
U:Delay(5, function()
14111426
U:InitFriends()
@@ -1642,15 +1657,28 @@ frame:HookScript("OnEvent", function(self_f, event, ...)
16421657
local discord = 'https://discord.gg/qC9RAdXN'
16431658
local curseforge = 'https://www.curseforge.com/wow/addons/inputinput/comments'
16441659
local kook = 'https://kook.vip/vghP6R'
1645-
U:Delay(5, function(cb)
1646-
LOG:Info(string.format(L['Login Information 1'],
1647-
W.colorName,
1648-
'|cFFF56C6C[|HInputInputURL:' ..
1649-
kook .. '|hKOOK(国服)|h]|r、' .. '|cFFF56C6C[|HInputInputURL:' .. discord .. '|hDiscord|h]|r',
1650-
'|cFFF56C6C[|HInputInputURL:' .. curseforge .. '|hCurseForge|h]|r'))
1651-
LOG:Info(string.format(L['Login Information 2'], "|cff409EFF/ii|r", "|cff409EFF/inputinput|r",
1652-
'|cffF56C6C|HInputInputOPT:show|h[', ']|h|r'))
1653-
end)
1660+
if W.ClientVersion >= 110000 then
1661+
U:Delay(5, function(cb)
1662+
LOG:Info(string.format(L['Login Information 1'],
1663+
W.colorName,
1664+
'|cFFF56C6C[|HInputInputURL:' ..
1665+
kook ..
1666+
'|hKOOK(国服)|h]|r、' .. '|cFFF56C6C[|HInputInputURL:' .. discord .. '|hDiscord|h]|r',
1667+
'|cFFF56C6C[|HInputInputURL:' .. curseforge .. '|hCurseForge|h]|r'))
1668+
LOG:Info(string.format(L['Login Information 2'], "|cff409EFF/ii|r", "|cff409EFF/inputinput|r",
1669+
'|cffF56C6C|HInputInputOPT:show|h[', ']|h|r'))
1670+
end)
1671+
else
1672+
U:Delay(5, function(cb)
1673+
LOG:Info(string.format(L['Login Information 1'],
1674+
W.colorName,
1675+
'|cFFF56C6C' ..
1676+
'KOOK(国服)|r、' .. '|cFFF56C6CDiscord|r',
1677+
'|cFFF56C6CCurseForge|r'))
1678+
LOG:Info(string.format(L['Login Information 2'], "|cff409EFF/ii|r", "|cff409EFF/inputinput|r",
1679+
'|cffF56C6C', '|r'))
1680+
end)
1681+
end
16541682
end
16551683
end)
16561684

InputInput/OptionConfig.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ OPTCONFIG.optionConfig = {
1414
click = function(this, self)
1515
end,
1616
default = true,
17+
version1 = 10100,
18+
version2 = 110207,
1719
subElement = {
1820
{
1921
name = 'showTime',

0 commit comments

Comments
 (0)