Skip to content

Commit

Permalink
适配8.2.0
Browse files Browse the repository at this point in the history
修正部分错误
精简代码
  • Loading branch information
tytannial committed Jun 29, 2019
1 parent 875cf49 commit 188924d
Show file tree
Hide file tree
Showing 12 changed files with 183 additions and 297 deletions.
2 changes: 1 addition & 1 deletion ChatCopy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ editBox:SetScript("OnEscapePressed", function(f)f:GetParent():GetParent():Hide()
scrollArea:SetScrollChild(editBox)

function SimpleChat:CopyFunc()
local cf = SELECTED_DOCK_FRAME
local cf = SELECTED_CHAT_FRAME
local _, size = cf:GetFont()
FCF_SetChatWindowFontSize(cf, cf, .01)
local ct = 1
Expand Down
2 changes: 1 addition & 1 deletion ChatEmote.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
--[[
ChatEmote.lua
聊天表情相关代码
修正只解析一个表情
插件更新地址 http://nga.178.com/read.php?tid=9633520
--]]
local SimpleChat = LibStub("AceAddon-3.0"):GetAddon("SimpleChat")
Expand Down Expand Up @@ -86,7 +87,6 @@ local function ChatEmoteFilter(self, event, msg, ...)
for i = customEmoteStartIndex, #emotes do
if msg:find(emotes[i][1]) then
msg = msg:gsub(emotes[i][1], format(fmtstring, emotes[i][2]), 1)
break
end
end
end
Expand Down
87 changes: 87 additions & 0 deletions ChatLink.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
----------------------------------------------
-- 聊天超链接增强模块
-- @原作者:M TinyChat
-- 修改日志:
-- 合并物品等级和图标解析,增加货币解析。移除了鼠标提示,预计下版本重新加入。
----------------------------------------------
local SimpleChat = LibStub("AceAddon-3.0"):GetAddon("SimpleChat")

local SimpleChat_Config

--生成新的ICON超链接
local function GetHyperlink(Hyperlink, texture)
if not texture then
return Hyperlink
else
return "|T" .. texture .. ":0|t|h" .. Hyperlink
end
end

--等级图标显示
local function SetChatLinkIcon(Hyperlink)
local schema, id = string.match(Hyperlink, "|H(%w+):(%d+):")
local texture
if (schema == "item") then
texture = select(10, GetItemInfo(tonumber(id)))
elseif (schema == "currency") then
texture = select(3, GetCurrencyInfo(tonumber(id)))
elseif (schema == "spell") then
texture = select(3, GetSpellInfo(tonumber(id)))
elseif (schema == "achievement") then
texture = select(10, GetAchievementInfo(tonumber(id)))
end
return GetHyperlink(Hyperlink, texture)
end

--等级图标显示
local function SetChatLinkLevel(Hyperlink)
local link = string.match(Hyperlink, "|H(.-)|h")
local level = select(4, GetItemInfo(link))
if (level) then
Hyperlink = Hyperlink:gsub("|h%[(.-)%]|h", "|h[" .. level .. ":%1]|h")
end
return Hyperlink
end

--过滤器
local function ChatLinkFilter(self, event, msg, ...)
if not SimpleChat_Config then
return false, msg, ...
end

-- if SimpleChat_Config.ShowChatLinkIlvl then
-- msg = msg:gsub("(|Hitem:%d+:.-|h.-|h)", SetChatLinkLevel)
-- end
if SimpleChat_Config.ShowChatLinkIcon then
msg = msg:gsub("(|H%w+:%d+:.-|h.-|h)", SetChatLinkIcon)
end
return false, msg, ...
end

function SimpleChat:InitChatLink()
SimpleChat_Config = self.db.profile
self:RegisterFilter("CHAT_MSG_CHANNEL", ChatLinkFilter)-- 公共频道
self:RegisterFilter("CHAT_MSG_SAY", ChatLinkFilter)--
self:RegisterFilter("CHAT_MSG_YELL", ChatLinkFilter)-- 大喊
self:RegisterFilter("CHAT_MSG_RAID", ChatLinkFilter)-- 团队
self:RegisterFilter("CHAT_MSG_RAID_LEADER", ChatLinkFilter)-- 团队领袖
self:RegisterFilter("CHAT_MSG_PARTY", ChatLinkFilter)-- 队伍
self:RegisterFilter("CHAT_MSG_PARTY_LEADER", ChatLinkFilter)-- 队伍领袖
self:RegisterFilter("CHAT_MSG_GUILD", ChatLinkFilter)-- 公会

self:RegisterFilter("CHAT_MSG_AFK", ChatLinkFilter)-- AFK玩家自动回复
self:RegisterFilter("CHAT_MSG_DND", ChatLinkFilter)-- 切勿打扰自动回复
-- 副本和副本领袖
self:RegisterFilter("CHAT_MSG_INSTANCE_CHAT", ChatLinkFilter)
self:RegisterFilter("CHAT_MSG_INSTANCE_CHAT_LEADER", ChatLinkFilter)
-- 解析战网私聊
self:RegisterFilter("CHAT_MSG_WHISPER", ChatLinkFilter)
self:RegisterFilter("CHAT_MSG_WHISPER_INFORM", ChatLinkFilter)
self:RegisterFilter("CHAT_MSG_BN_WHISPER", ChatLinkFilter)
self:RegisterFilter("CHAT_MSG_BN_WHISPER_INFORM", ChatLinkFilter)
-- 解析社区聊天内容
self:RegisterFilter("CHAT_MSG_COMMUNITIES_CHANNEL", ChatLinkFilter)
--拾取信息
self:RegisterFilter("CHAT_MSG_LOOT", ChatLinkFilter)
self:RegisterFilter("CHAT_MSG_CURRENCY", ChatLinkFilter)
end
112 changes: 0 additions & 112 deletions ChatLinkIcon.lua

This file was deleted.

85 changes: 0 additions & 85 deletions ChatLinkIlvl.lua

This file was deleted.

2 changes: 1 addition & 1 deletion Chatbar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ function SimpleChat:InitChatBar()
ChatBar:SetPoint("TOPLEFT", "ChatFrame1", "BOTTOMLEFT", SimpleChat_Config.ChatBarOffsetX, SimpleChat_Config.ChatBarOffsetY - 30)
end
end
print("|cffffe00a<|r|cffff7d0aSimpleChat|r|cffffe00a>|r 聊天条位置初始化完毕")
else
local point = SimpleChat_Config.Position.point
local relativeTo = SimpleChat_Config.Position.relativeTo
Expand All @@ -253,4 +252,5 @@ function SimpleChat:InitChatBar()
for i = 1, #ChannelButtons do -- 对非战斗记录聊天框的信息进行处理
CreateChannelButton(ChannelButtons[i], i)
end
print("|cffffe00a<|r|cffff7d0aSimpleChat|r|cffffe00a>|r 聊天条加载完毕")
end
6 changes: 2 additions & 4 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ local SimpleChat_Config = {
-- 聊天物品链接增强
ShowChatLinkIlvl = true, -- 显示物品链接装等
ShowChatLinkIcon = true, -- 显示物品链接图标
ShowChatLinkBigIcon = true, -- 鼠标移动到链接图标上时会放大
-- ShowChatLinkBigIcon = true, -- 鼠标移动到链接图标上时会放大
-- 聊天表情
EmoteIconSize = 18, -- 聊天文字中的表情大小,你可以根据聊天字号调整
EmoteIconListSize = 30, -- 表情选择器的图标大小
Expand Down Expand Up @@ -52,9 +52,7 @@ function SimpleChat:OnInitialize()
-- 加载功能模块
self:InitChatBar() -- 加载聊天条
self:InitChannel() -- 频道增强
self:InitChatLinkIlvl() -- 聊天链接装等显示
self:InitChatLinkIcon() -- 聊天链接图标显示
self:InitChatLinkBigIconFrame() -- 聊天链接大图标框架
self:InitChatLink() -- 聊天链接增强
self:InitEmoteTableFrame() -- 表情选择框架
end

Expand Down
Loading

0 comments on commit 188924d

Please sign in to comment.