diff --git a/rChat/bar.lua b/rChat/bar.lua deleted file mode 100644 index d3ed61f..0000000 --- a/rChat/bar.lua +++ /dev/null @@ -1,186 +0,0 @@ -local A, L = ... - -local config = L.C - ---[[=========================== 变量区 ==========================]] --- 是否可移动的标记 -local IsMovable = false -- 没事干别动这个,你改成ture那么进入游戏后聊天条就是可以移动的 ---[[=============================== END ==============================]] -local chatFrame = SELECTED_DOCK_FRAME -- 聊天框架 -local inputbox = chatFrame.editBox -- 输入框 - -COLORSCHEME_BORDER = {0.3, 0.3, 0.3, 1} - --- 边框颜色 --- 主框架初始化 -local ChatBar = CreateFrame("Frame", nil, UIParent, BackdropTemplateMixin and "BackdropTemplate" or nil) --- rChatBar = ChatBar - -local function ChannelSay_OnClick() - ChatFrame_OpenChat("/s " .. inputbox:GetText(), chatFrame) -end - -local function ChannelYell_OnClick() - ChatFrame_OpenChat("/y " .. inputbox:GetText(), chatFrame) -end - -local function ChannelParty_OnClick() - ChatFrame_OpenChat("/p " .. inputbox:GetText(), chatFrame) -end - -local function ChannelGuild_OnClick() - ChatFrame_OpenChat("/g " .. inputbox:GetText(), chatFrame) -end - -local function ChannelRaid_OnClick() - ChatFrame_OpenChat("/raid " .. inputbox:GetText(), chatFrame) -end - -local function ChannelBG_OnClick() - ChatFrame_OpenChat("/bg " .. inputbox:GetText(), chatFrame) -end - -local function ChatEmote_OnClick() - rChat:ToggleEmoteTable() -end - -local function ChannelWorld_OnClick(self, button) - if button == "RightButton" then - local _, channelName, _ = GetChannelName("大脚世界频道") - if channelName == nil then - JoinPermanentChannel("大脚世界频道", nil, 1, 1) - ChatFrame_RemoveMessageGroup(chatFrame, "CHANNEL") - ChatFrame_AddChannel(chatFrame, "大脚世界频道") - print("|cffffe00a<|r|cffff7d0arChat|r|cffffe00a>|r |cff00d200已加入大脚世界频道|r") - else - LeaveChannelByName("大脚世界频道") - print("|cffffe00a<|r|cffff7d0arChat|r|cffffe00a>|r |cffd20000已离开大脚世界频道|r") - end - else - local channel, _, _ = GetChannelName("大脚世界频道") - ChatFrame_OpenChat("/" .. channel .. " " .. inputbox:GetText(), chatFrame) - end -end - -local function Roll_OnClick() - RandomRoll(1, 100) -end - -local function Report_OnClick() - local statText = rChat:StatReport() - if button == "RightButton" then - print("|cffffe00a<|r|cffff7d0arChat|r|cffffe00a>|r |cff00d200我的属性:|r" .. statText) - else - ChatEdit_ActivateChat(inputbox) - inputbox:SetText(statText) - end -end - -local function ChatCopy_OnClick() - rChat:CopyFunc() -end - -local ChannelButtons = { - {name = "say", text = "说", color = {1.00, 1.00, 1.00}, callback = ChannelSay_OnClick}, - {name = "yell", text = "喊", color = {1.00, 0.25, 0.25}, callback = ChannelYell_OnClick}, - {name = "party", text = "队", color = {0.66, 0.66, 1.00}, callback = ChannelParty_OnClick}, - {name = "guild", text = "会", color = {0.25, 1.00, 0.25}, callback = ChannelGuild_OnClick}, - {name = "raid", text = "团", color = {1.00, 0.50, 0.00}, callback = ChannelRaid_OnClick}, - -- {name = "bg", text = "战", color = {1.00, 0.50, 0.00}, callback = ChannelBG_OnClick}, - {name = "world", text = "世", color = {0.78, 1.00, 0.59}, callback = ChannelWorld_OnClick}, - {name = "emote", text = "表", color = {1.00, 0.50, 1.00}, callback = ChatEmote_OnClick}, - {name = "roll", text = "骰", color = {1.00, 1.00, 0.00}, callback = Roll_OnClick}, - -- {name = "report", text = "报", color = {0.80, 0.30, 0.30}, callback = Report_OnClick}, - {name = "copy", text = "复", color = {0.20, 0.60, 0.80}, callback = ChatCopy_OnClick} -} - -local function CreateChannelButton(data, index) - local button = CreateFrame("Button", nil, ChatBar) - button:SetSize(20, 10) - -- frame:SetWidth(22) -- 按钮宽度 - -- frame:SetHeight(22) -- 按钮高度 - button:SetAlpha(config.alpha.leave) - button:SetFrameLevel(1) - - local tex = button:CreateTexture() - tex:SetTexture("Interface\\Buttons\\WHITE8x8") - tex:SetAllPoints() - tex:SetColorTexture(unpack(data.color)) - - button:SetScript( - "OnEnter", - function(self) - self:SetAlpha(config.alpha.enter) - end - ) - button:SetScript( - "OnLeave", - function(self) - self:SetAlpha(config.alpha.leave) - end - ) - - if config.bar.is_vertical then - button:SetPoint("TOP", ChatBar, "TOP", 0, (1 - index) * config.bar.padding) - else - button:SetPoint("LEFT", ChatBar, "LEFT", 10 + (index - 1) * config.bar.padding, 0) - end - - button:RegisterForClicks("AnyUp") - button:SetScript("OnClick", data.callback) - -- 显示的文字 - -- frameText = frame:CreateFontString(data.name .. "Text", "OVERLAY") - -- 字体设置 - -- frameText:SetFont(STANDARD_TEXT_FONT, 15, "OUTLINE") - - -- frameText:SetJustifyH("CENTER") - -- frameText:SetWidth(26) - -- frameText:SetHeight(26) - -- frameText:SetText(data.text) - -- frameText:SetPoint("CENTER", 0, 0) - - -- 文字按钮的颜色 - -- frameText:SetTextColor(data.color[1], data.color[2], data.color[3]) -end - -ChatBar:SetFrameLevel(0) - --- 使用竖直布局 -if config.bar.is_vertical then - -- 主框体宽度 - ChatBar:SetWidth(30) - -- 主框体高度 - ChatBar:SetHeight(#ChannelButtons * config.bar.padding + 10) -else - -- 主框体宽度 - ChatBar:SetWidth(#ChannelButtons * config.bar.padding + 10) - -- 主框体高度 - ChatBar:SetHeight(30) -end - --- 上方聊天输入框 --- if SimpleChat_Config.UseTopInput then --- inputbox:ClearAllPoints() --- inputbox:SetPoint("BOTTOMLEFT", chatFrame, "TOPLEFT", 0, 20) --- inputbox:SetPoint("BOTTOMRIGHT", chatFrame, "TOPRIGHT", 0, 20) --- end - --- 位置设定 -if config.bar.is_vertical then - ChatBar:SetPoint("TOPLEFT", "ChatFrame1", "TOPRIGHT", config.bar.offsetx + 30, config.bar.offsety + 25) -else - ChatBar:SetPoint("TOPLEFT", "ChatFrame1", "BOTTOMLEFT", config.bar.offsetx, config.bar.offsety - 5) -end - -if GetLocale() ~= 'zhCN' then - table.remove(ChannelButtons, 6) -end - -for i = 1, #ChannelButtons do -- 对非战斗记录聊天框的信息进行处理 - CreateChannelButton(ChannelButtons[i], i) -end - ---create drag frame -rLib:CreateDragFrame(ChatBar, L.dragFrames, -2, true) ---create slash commands -rLib:CreateSlashCmd(L.addonName, L.addonShortcut, L.dragFrames, L.addonColor) \ No newline at end of file diff --git a/rChat/copy.lua b/rChat/copy.lua deleted file mode 100644 index 4208bc0..0000000 --- a/rChat/copy.lua +++ /dev/null @@ -1,60 +0,0 @@ -local A, L = ... - -local lines = {} - -local chatCopyFrame = CreateFrame("Frame", "ChatCopyFrame", UIParent, BackdropTemplateMixin and "BackdropTemplate" or nil) -chatCopyFrame:SetPoint("CENTER", UIParent, "CENTER") -chatCopyFrame:SetSize(700, 400) -chatCopyFrame:Hide() -chatCopyFrame:SetFrameStrata("DIALOG") -chatCopyFrame.close = CreateFrame("Button", nil, chatCopyFrame, "UIPanelCloseButton") -chatCopyFrame.close:SetPoint("TOPRIGHT", chatCopyFrame, "TOPRIGHT") -chatCopyFrame:SetBackdrop({ - bgFile = "Interface/DialogFrame/UI-DialogBox-Background", - edgeFile = "Interface/DialogFrame/UI-DialogBox-Border", - tile = true, - tileSize = 16, - edgeSize = 16, - insets = {left = 4, right = 4, top = 4, bottom = 4} -}) - -local scrollArea = CreateFrame("ScrollFrame", "ChatCopyScrollFrame", chatCopyFrame, "UIPanelScrollFrameTemplate") -scrollArea:SetPoint("TOPLEFT", chatCopyFrame, "TOPLEFT", 10, -30) -scrollArea:SetPoint("BOTTOMRIGHT", chatCopyFrame, "BOTTOMRIGHT", -30, 10) - -local editBox = CreateFrame("EditBox", nil, chatCopyFrame) -editBox:SetMultiLine(true) -editBox:SetMaxLetters(99999) -editBox:EnableMouse(true) -editBox:SetAutoFocus(false) -editBox:SetFontObject(ChatFontNormal) -editBox:SetWidth(scrollArea:GetWidth()) -editBox:SetHeight(270) -editBox:SetScript("OnEscapePressed", function(f) - f:GetParent():GetParent():Hide() - f:SetText("") -end) -scrollArea:SetScrollChild(editBox) - -function rChat:CopyFunc() - local cf = SELECTED_CHAT_FRAME - local _, size = cf:GetFont() - FCF_SetChatWindowFontSize(cf, cf, .01) - local ct = 1 - for i = select("#", cf.FontStringContainer:GetRegions()), 1, -1 do - local region = select(i, cf.FontStringContainer:GetRegions()) - if region:GetObjectType() == "FontString" then - if region:GetText() ~= nil then - lines[ct] = tostring(region:GetText()) - ct = ct + 1 - end - end - end - local lineCt = ct - 1 - local text = table.concat(lines, "\n", 1, lineCt) - FCF_SetChatWindowFontSize(cf, cf, size) - chatCopyFrame:Show() - editBox:SetText(text) - editBox:HighlightText(0) - wipe(lines) -end \ No newline at end of file diff --git a/rChat/core.lua b/rChat/core.lua index 1c55955..b2aba02 100644 --- a/rChat/core.lua +++ b/rChat/core.lua @@ -8,7 +8,16 @@ local A, L = ... -local cfg = L.C +local DefaultSetItemRef = SetItemRef + +local cfg = {} +cfg.dropshadow = {} +cfg.dropshadow.offset = {1,-2} +cfg.dropshadow.color = {0,0,0,0.25} +cfg.editbox = {} +cfg.editbox.font = {STANDARD_TEXT_FONT, 13, "THINOUTLINE"} +cfg.chat = {} +cfg.chat.font = {STANDARD_TEXT_FONT, 13, "THINOUTLINE"} --{STANDARD_TEXT_FONT, 12, "OUTLINE"} ----------------------------- -- Functions @@ -40,15 +49,13 @@ local function SkinChat(self) _G[name.."EditBoxRight"]:Hide() --reposition eb:ClearAllPoints() - eb:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 20) - eb:SetPoint("BOTTOMRIGHT", self, "TOPRIGHT", 0, 20) - -- if name == "ChatFrame2" then - -- eb:SetPoint("BOTTOM",self,"TOP",0,20+24) --CombatLogQuickButtonFrame_Custom:GetHeight() - -- else - -- eb:SetPoint("BOTTOM",self,"TOP",0,20) - -- end - -- eb:SetPoint("LEFT",self,-5,0) - -- eb:SetPoint("RIGHT",self,10,0) + if name == "ChatFrame2" then + eb:SetPoint("BOTTOM",self,"TOP",0,22+24) --CombatLogQuickButtonFrame_Custom:GetHeight() + else + eb:SetPoint("BOTTOM",self,"TOP",0,22) + end + eb:SetPoint("LEFT",self,-5,0) + eb:SetPoint("RIGHT",self,10,0) end local function UpdateBackgroundAnchors(self) @@ -75,64 +82,27 @@ local function OnMOuseScroll(self,dir) end end --- ================================ --- 公共频道和自定义频道精简 --- ================================ --- local gsub = _G.string.gsub --- local newAddMsg = {} --- local chn = { --- "%[%d+%. 综合.-%]", --- "%[%d+%. 交易.-%]", --- "%[%d+%. 本地防务.-%]", --- "%[%d+%. 寻求组队%]", --- "%[%d+%. 世界防务%]", --- "%[%d+%. 公会招募.-%]", --- "%[%d+%. 大脚世界频道.-%]", --- "%[%d+%. 新手聊天.-%]", --- "%[%d+%. 自定义频道.-%]" -- 自定义频道英文名随便填写 --- } - --- local rplc = { --- "[%1综]", --- "[%1交]", --- "[%1防]", --- "[%1组]", --- "[%1守]", --- "[%1招]", --- "[%1世]", --- "[%1萌]" --- "[%1自定义]" -- 英文缩写 --- } - --- local rules = { --- --!!不要改 --- {pat = "|c%x+|HChatCopy|h.-|h|r", repl = ""}, --- {pat = "|c%x%x%x%x%x%x%x%x(.-)|r", repl = "%1"}, --- --左鍵 --- {pat = "|Hchannel:.-|h.-|h", repl = "", button = "LeftButton"}, --- {pat = "|Hplayer:.-|h.-|h" .. ":", repl = "", button = "LeftButton"}, --- {pat = "|Hplayer:.-|h.-|h" .. ":", repl = "", button = "LeftButton"}, --- {pat = "|HBNplayer:.-|h.-|h" .. ":", repl = "", button = "LeftButton"}, --- {pat = "|HBNplayer:.-|h.-|h" .. ":", repl = "", button = "LeftButton"}, --- --右鍵 --- {pat = "|Hchannel:.-|h(.-)|h", repl = "%1", button = "RightButton"}, --- {pat = "|Hplayer:.-|h(.-)|h", repl = "%1", button = "RightButton"}, --- {pat = "|HBNplayer:.-|h(.-)|h", repl = "%1", button = "RightButton"}, --- --!!不要改 --- {pat = "|H.-|h(.-)|h", repl = "%1"}, --- {pat = "|TInterface\\TargetingFrame\\UI%-RaidTargetingIcon_(%d):0|t", repl = "{rt%1}"}, --- {pat = "|T.-|t", repl = ""}, --- {pat = "^%s+", repl = ""} --- } +--we replace the default setitemref and use it to parse links for alt invite and url copy +function SetItemRef(link, ...) + local type, value = link:match("(%a+):(.+)") + if IsAltKeyDown() and type == "player" then + InviteUnit(value:match("([^:]+)")) + elseif (type == "url") then + local eb = LAST_ACTIVE_CHAT_EDIT_BOX or ChatFrame1EditBox + if not eb then return end + eb:SetText(value) + eb:SetFocus() + eb:HighlightText() + if not eb:IsShown() then eb:Show() end + else + return DefaultSetItemRef(link, ...) + end +end --AddMessage local function AddMessage(self, text, ...) --channel replace (Trade and such) text = text:gsub('|h%[(%d+)%. .-%]|h', '|h%1.|h') - -- for i = 1, #chn do -- 对应上面几个频道(如果有9个频道就for i = 1, 9 do) - -- text = text:gsub(chn[i], rplc[i]) - -- end - -- text = text:gsub("%[(%d0?)%. .-%]", "%1.") --url search text = text:gsub('([wWhH][wWtT][wWtT][%.pP]%S+[^%p%s])', '|cffffffff|Hurl:%1|h[%1]|h|r') return self.DefaultAddMessage(self, text, ...) @@ -148,7 +118,7 @@ ChatFontNormal:SetShadowOffset(unpack(cfg.dropshadow.offset)) ChatFontNormal:SetShadowColor(unpack(cfg.dropshadow.color)) --font size -CHAT_FONT_HEIGHTS = {12, 14, 16, 17, 18, 19, 20} +CHAT_FONT_HEIGHTS = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20} --tabs CHAT_TAB_HIDE_DELAY = 1 @@ -160,10 +130,10 @@ CHAT_FRAME_TAB_ALERTING_MOUSEOVER_ALPHA = 1 CHAT_FRAME_TAB_ALERTING_NOMOUSE_ALPHA = 1 --channels -CHAT_WHISPER_GET = "%s > " -CHAT_WHISPER_INFORM_GET = "%s < " -CHAT_BN_WHISPER_GET = "%s > " -CHAT_BN_WHISPER_INFORM_GET = "%s < " +CHAT_WHISPER_GET = "From %s " +CHAT_WHISPER_INFORM_GET = "To %s " +CHAT_BN_WHISPER_GET = "From %s " +CHAT_BN_WHISPER_INFORM_GET = "To %s " CHAT_YELL_GET = "%s " CHAT_SAY_GET = "%s " CHAT_BATTLEGROUND_GET = "|Hchannel:Battleground|hBG.|h %s: " @@ -200,17 +170,20 @@ ChatFrameMenuButton:Hide() --ChatFrameChannelButton ChatFrameChannelButton:HookScript("OnShow", ChatFrameChannelButton.Hide) ChatFrameChannelButton:Hide() +-- classic-disable +--[[ --ChatFrameToggleVoiceDeafenButton --- ChatFrameToggleVoiceDeafenButton:HookScript("OnShow", ChatFrameToggleVoiceDeafenButton.Hide) --- ChatFrameToggleVoiceDeafenButton:Hide() +ChatFrameToggleVoiceDeafenButton:HookScript("OnShow", ChatFrameToggleVoiceDeafenButton.Hide) +ChatFrameToggleVoiceDeafenButton:Hide() --ChatFrameToggleVoiceMuteButton --- ChatFrameToggleVoiceMuteButton:HookScript("OnShow", ChatFrameToggleVoiceMuteButton.Hide) --- ChatFrameToggleVoiceMuteButton:Hide() +ChatFrameToggleVoiceMuteButton:HookScript("OnShow", ChatFrameToggleVoiceMuteButton.Hide) +ChatFrameToggleVoiceMuteButton:Hide() --hide the friend micro button --- local button = QuickJoinToastButton or FriendsMicroButton --- button:HookScript("OnShow", button.Hide) --- button:Hide() +local button = QuickJoinToastButton or FriendsMicroButton +button:HookScript("OnShow", button.Hide) +button:Hide() +]]-- --skin chat for i = 1, NUM_CHAT_WINDOWS do @@ -230,4 +203,4 @@ FloatingChatFrame_OnMouseScroll = OnMOuseScroll hooksecurefunc("FCF_OpenTemporaryWindow", OpenTemporaryWindow) --background thingy -hooksecurefunc("FloatingChatFrame_UpdateBackgroundAnchors", UpdateBackgroundAnchors) \ No newline at end of file +hooksecurefunc("FloatingChatFrame_UpdateBackgroundAnchors", UpdateBackgroundAnchors) diff --git a/rChat/emote.lua b/rChat/emote.lua deleted file mode 100644 index fd79b9f..0000000 --- a/rChat/emote.lua +++ /dev/null @@ -1,177 +0,0 @@ -local A, L = ... - --- 表情选择器框架 -local EmoteTableFrame = CreateFrame("Frame", "EmoteTableFrame", UIParent, BackdropTemplateMixin and "BackdropTemplate" or nil) -EmoteTableFrame:SetMovable(true) -EmoteTableFrame:RegisterForDrag("LeftButton") -EmoteTableFrame:SetScript("OnDragStart", EmoteTableFrame.StartMoving) -EmoteTableFrame:SetScript("OnDragStop", EmoteTableFrame.StopMovingOrSizing) -EmoteTableFrame:EnableMouse(true) -EmoteTableFrame:SetWidth((L.C.emote.listsize + 6) * 12 + 10) -EmoteTableFrame:SetHeight((L.C.emote.listsize + 6) * 5 + 10) -EmoteTableFrame:SetPoint("BOTTOM", ChatFrame1EditBox, L.C.emote.offsetx, L.C.emote.offsety) -EmoteTableFrame:SetBackdrop({ - bgFile = "Interface\\Buttons\\WHITE8x8", - edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", - tile = true, - tileSize = 16, - edgeSize = 16, - insets = {left = 3, right = 3, top = 3, bottom = 3} -}) -EmoteTableFrame:SetBackdropColor(0.05, 0.05, 0.05, 0.8) -EmoteTableFrame:SetBackdropBorderColor(0.3, 0.3, 0.3) --- 表情选择框出现位置 默认30,30 -EmoteTableFrame:Hide() -EmoteTableFrame:SetFrameStrata("DIALOG") - --- 表情解析规则 -local fmtstring = format("\124T%%s:%d\124t", max(floor(select(2, SELECTED_CHAT_FRAME:GetFont())), L.C.emote.iconsize)) - --- 自定义表情开始的序号 -local customEmoteStartIndex = 9 - -local emotes = { - --原版暴雪提供的8个图标 - {"{rt1}", [=[Interface\TargetingFrame\UI-RaidTargetingIcon_1]=]}, - {"{rt2}", [=[Interface\TargetingFrame\UI-RaidTargetingIcon_2]=]}, - {"{rt3}", [=[Interface\TargetingFrame\UI-RaidTargetingIcon_3]=]}, - {"{rt4}", [=[Interface\TargetingFrame\UI-RaidTargetingIcon_4]=]}, - {"{rt5}", [=[Interface\TargetingFrame\UI-RaidTargetingIcon_5]=]}, - {"{rt6}", [=[Interface\TargetingFrame\UI-RaidTargetingIcon_6]=]}, - {"{rt7}", [=[Interface\TargetingFrame\UI-RaidTargetingIcon_7]=]}, - {"{rt8}", [=[Interface\TargetingFrame\UI-RaidTargetingIcon_8]=]}, - --自定义表情 - {"{天使}", [=[Interface\Addons\rChat\emotions\Angel]=]}, - {"{生气}", [=[Interface\Addons\rChat\emotions\Angry]=]}, - {"{大笑}", [=[Interface\Addons\rChat\emotions\Biglaugh]=]}, - {"{鼓掌}", [=[Interface\Addons\rChat\emotions\Clap]=]}, - {"{酷}", [=[Interface\Addons\rChat\emotions\Cool]=]}, - {"{哭}", [=[Interface\Addons\rChat\emotions\Cry]=]}, - {"{可爱}", [=[Interface\Addons\rChat\emotions\Cutie]=]}, - {"{鄙视}", [=[Interface\Addons\rChat\emotions\Despise]=]}, - {"{美梦}", [=[Interface\Addons\rChat\emotions\Dreamsmile]=]}, - {"{尴尬}", [=[Interface\Addons\rChat\emotions\Embarrass]=]}, - {"{邪恶}", [=[Interface\Addons\rChat\emotions\Evil]=]}, - {"{兴奋}", [=[Interface\Addons\rChat\emotions\Excited]=]}, - {"{晕}", [=[Interface\Addons\rChat\emotions\Faint]=]}, - {"{打架}", [=[Interface\Addons\rChat\emotions\Fight]=]}, - {"{流感}", [=[Interface\Addons\rChat\emotions\Flu]=]}, - {"{呆}", [=[Interface\Addons\rChat\emotions\Freeze]=]}, - {"{皱眉}", [=[Interface\Addons\rChat\emotions\Frown]=]}, - {"{致敬}", [=[Interface\Addons\rChat\emotions\Greet]=]}, - {"{鬼脸}", [=[Interface\Addons\rChat\emotions\Grimace]=]}, - {"{龇牙}", [=[Interface\Addons\rChat\emotions\Growl]=]}, - {"{开心}", [=[Interface\Addons\rChat\emotions\Happy]=]}, - {"{心}", [=[Interface\Addons\rChat\emotions\Heart]=]}, - {"{恐惧}", [=[Interface\Addons\rChat\emotions\Horror]=]}, - {"{生病}", [=[Interface\Addons\rChat\emotions\Ill]=]}, - {"{无辜}", [=[Interface\Addons\rChat\emotions\Innocent]=]}, - {"{功夫}", [=[Interface\Addons\rChat\emotions\Kongfu]=]}, - {"{花痴}", [=[Interface\Addons\rChat\emotions\Love]=]}, - {"{邮件}", [=[Interface\Addons\rChat\emotions\Mail]=]}, - {"{化妆}", [=[Interface\Addons\rChat\emotions\Makeup]=]}, - -- {"{马里奥}", [=[Interface\Addons\rChat\emotions\Mario]=]}, - {"{沉思}", [=[Interface\Addons\rChat\emotions\Meditate]=]}, - {"{可怜}", [=[Interface\Addons\rChat\emotions\Miserable]=]}, - {"{好}", [=[Interface\Addons\rChat\emotions\Okay]=]}, - {"{漂亮}", [=[Interface\Addons\rChat\emotions\Pretty]=]}, - {"{吐}", [=[Interface\Addons\rChat\emotions\Puke]=]}, - {"{握手}", [=[Interface\Addons\rChat\emotions\Shake]=]}, - {"{喊}", [=[Interface\Addons\rChat\emotions\Shout]=]}, - {"{闭嘴}", [=[Interface\Addons\rChat\emotions\Shuuuu]=]}, - {"{害羞}", [=[Interface\Addons\rChat\emotions\Shy]=]}, - {"{睡觉}", [=[Interface\Addons\rChat\emotions\Sleep]=]}, - {"{微笑}", [=[Interface\Addons\rChat\emotions\Smile]=]}, - {"{吃惊}", [=[Interface\Addons\rChat\emotions\Suprise]=]}, - {"{失败}", [=[Interface\Addons\rChat\emotions\Surrender]=]}, - {"{流汗}", [=[Interface\Addons\rChat\emotions\Sweat]=]}, - {"{流泪}", [=[Interface\Addons\rChat\emotions\Tear]=]}, - {"{悲剧}", [=[Interface\Addons\rChat\emotions\Tears]=]}, - {"{想}", [=[Interface\Addons\rChat\emotions\Think]=]}, - {"{偷笑}", [=[Interface\Addons\rChat\emotions\Titter]=]}, - {"{猥琐}", [=[Interface\Addons\rChat\emotions\Ugly]=]}, - {"{胜利}", [=[Interface\Addons\rChat\emotions\Victory]=]}, - {"{雷锋}", [=[Interface\Addons\rChat\emotions\Volunteer]=]}, - {"{委屈}", [=[Interface\Addons\rChat\emotions\Wronged]=]} -} - -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) - end - end - return false, msg, ... -end - -local function EmoteIconMouseUp(frame, button) - if (button == "LeftButton") then - local chatFrame = GetCVar("chatStyle") == "im" and SELECTED_CHAT_FRAME or DEFAULT_CHAT_FRAME - local eb = chatFrame and chatFrame.editBox - if (eb) then - eb:Insert(frame.text) - eb:Show(); - eb:SetFocus() - end - end - rChat:ToggleEmoteTable() -end - -function rChat:ToggleEmoteTable() - if (EmoteTableFrame:IsShown()) then - EmoteTableFrame:Hide() - else - EmoteTableFrame:Show() - end -end - -local icon, row, col -row = 1 -col = 1 -for i = 1, #emotes do - text = emotes[i][1] - texture = emotes[i][2] - icon = CreateFrame("Frame", format("IconButton%d", i), EmoteTableFrame) - icon:SetWidth(L.C.emote.listsize + 6) - icon:SetHeight(L.C.emote.listsize + 6) - icon.text = text - icon.texture = icon:CreateTexture(nil, "ARTWORK") - icon.texture:SetTexture(texture) - icon.texture:SetAllPoints(icon) - icon:Show() - icon:SetPoint( - "TOPLEFT", - 5 + (col - 1) * (L.C.emote.listsize + 6), - -5 - (row - 1) * (L.C.emote.listsize + 6) - ) - icon:SetScript("OnMouseUp", EmoteIconMouseUp) - icon:EnableMouse(true) - col = col + 1 - if (col > 12) then - row = row + 1 - col = 1 - end -end - -ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", ChatEmoteFilter)-- 公共频道 -ChatFrame_AddMessageEventFilter("CHAT_MSG_SAY", ChatEmoteFilter)-- 说 -ChatFrame_AddMessageEventFilter("CHAT_MSG_YELL", ChatEmoteFilter)-- 大喊 -ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID", ChatEmoteFilter)-- 团队 -ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID_LEADER", ChatEmoteFilter)-- 团队领袖 -ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY", ChatEmoteFilter)-- 队伍 -ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY_LEADER", ChatEmoteFilter)-- 队伍领袖 -ChatFrame_AddMessageEventFilter("CHAT_MSG_GUILD", ChatEmoteFilter)-- 公会 - -ChatFrame_AddMessageEventFilter("CHAT_MSG_AFK", ChatEmoteFilter)-- AFK玩家自动回复 -ChatFrame_AddMessageEventFilter("CHAT_MSG_DND", ChatEmoteFilter)-- 切勿打扰自动回复 - --- 副本和副本领袖 -ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT", ChatEmoteFilter) -ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT_LEADER", ChatEmoteFilter) --- 解析战网私聊 -ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", ChatEmoteFilter) -ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_INFORM", ChatEmoteFilter) -ChatFrame_AddMessageEventFilter("CHAT_MSG_BN_WHISPER", ChatEmoteFilter) -ChatFrame_AddMessageEventFilter("CHAT_MSG_BN_WHISPER_INFORM", ChatEmoteFilter) --- 解析社区聊天内容 -ChatFrame_AddMessageEventFilter("CHAT_MSG_COMMUNITIES_CHANNEL", ChatEmoteFilter) \ No newline at end of file diff --git a/rChat/emotions/Innocent.tga b/rChat/emotions/Innocent.tga deleted file mode 100644 index 79ea6fe..0000000 Binary files a/rChat/emotions/Innocent.tga and /dev/null differ diff --git a/rChat/emotions/Titter.tga b/rChat/emotions/Titter.tga deleted file mode 100644 index 85328ac..0000000 Binary files a/rChat/emotions/Titter.tga and /dev/null differ diff --git a/rChat/emotions/angel.tga b/rChat/emotions/angel.tga deleted file mode 100644 index b401949..0000000 Binary files a/rChat/emotions/angel.tga and /dev/null differ diff --git a/rChat/emotions/angry.tga b/rChat/emotions/angry.tga deleted file mode 100644 index c40ded9..0000000 Binary files a/rChat/emotions/angry.tga and /dev/null differ diff --git a/rChat/emotions/biglaugh.tga b/rChat/emotions/biglaugh.tga deleted file mode 100644 index 0168553..0000000 Binary files a/rChat/emotions/biglaugh.tga and /dev/null differ diff --git a/rChat/emotions/clap.tga b/rChat/emotions/clap.tga deleted file mode 100644 index 8c6eb93..0000000 Binary files a/rChat/emotions/clap.tga and /dev/null differ diff --git a/rChat/emotions/cool.tga b/rChat/emotions/cool.tga deleted file mode 100644 index 348f5ba..0000000 Binary files a/rChat/emotions/cool.tga and /dev/null differ diff --git a/rChat/emotions/cry.tga b/rChat/emotions/cry.tga deleted file mode 100644 index f0c9f50..0000000 Binary files a/rChat/emotions/cry.tga and /dev/null differ diff --git a/rChat/emotions/cutie.tga b/rChat/emotions/cutie.tga deleted file mode 100644 index f9b94bf..0000000 Binary files a/rChat/emotions/cutie.tga and /dev/null differ diff --git a/rChat/emotions/despise.tga b/rChat/emotions/despise.tga deleted file mode 100644 index 7820148..0000000 Binary files a/rChat/emotions/despise.tga and /dev/null differ diff --git a/rChat/emotions/dreamsmile.tga b/rChat/emotions/dreamsmile.tga deleted file mode 100644 index ee0eb46..0000000 Binary files a/rChat/emotions/dreamsmile.tga and /dev/null differ diff --git a/rChat/emotions/embarrass.tga b/rChat/emotions/embarrass.tga deleted file mode 100644 index 4e74a43..0000000 Binary files a/rChat/emotions/embarrass.tga and /dev/null differ diff --git a/rChat/emotions/evil.tga b/rChat/emotions/evil.tga deleted file mode 100644 index f9328db..0000000 Binary files a/rChat/emotions/evil.tga and /dev/null differ diff --git a/rChat/emotions/excited.tga b/rChat/emotions/excited.tga deleted file mode 100644 index 826989c..0000000 Binary files a/rChat/emotions/excited.tga and /dev/null differ diff --git a/rChat/emotions/faint.tga b/rChat/emotions/faint.tga deleted file mode 100644 index d2c48a6..0000000 Binary files a/rChat/emotions/faint.tga and /dev/null differ diff --git a/rChat/emotions/fight.tga b/rChat/emotions/fight.tga deleted file mode 100644 index 377b456..0000000 Binary files a/rChat/emotions/fight.tga and /dev/null differ diff --git a/rChat/emotions/flu.tga b/rChat/emotions/flu.tga deleted file mode 100644 index 8a82259..0000000 Binary files a/rChat/emotions/flu.tga and /dev/null differ diff --git a/rChat/emotions/freeze.tga b/rChat/emotions/freeze.tga deleted file mode 100644 index 81e6a69..0000000 Binary files a/rChat/emotions/freeze.tga and /dev/null differ diff --git a/rChat/emotions/frown.tga b/rChat/emotions/frown.tga deleted file mode 100644 index cc520d7..0000000 Binary files a/rChat/emotions/frown.tga and /dev/null differ diff --git a/rChat/emotions/greet.tga b/rChat/emotions/greet.tga deleted file mode 100644 index c213de6..0000000 Binary files a/rChat/emotions/greet.tga and /dev/null differ diff --git a/rChat/emotions/grimace.tga b/rChat/emotions/grimace.tga deleted file mode 100644 index 7adc3a5..0000000 Binary files a/rChat/emotions/grimace.tga and /dev/null differ diff --git a/rChat/emotions/growl.tga b/rChat/emotions/growl.tga deleted file mode 100644 index 04898e9..0000000 Binary files a/rChat/emotions/growl.tga and /dev/null differ diff --git a/rChat/emotions/happy.tga b/rChat/emotions/happy.tga deleted file mode 100644 index 9e1fcd5..0000000 Binary files a/rChat/emotions/happy.tga and /dev/null differ diff --git a/rChat/emotions/heart.tga b/rChat/emotions/heart.tga deleted file mode 100644 index 34aaef0..0000000 Binary files a/rChat/emotions/heart.tga and /dev/null differ diff --git a/rChat/emotions/horror.tga b/rChat/emotions/horror.tga deleted file mode 100644 index 6c10ccc..0000000 Binary files a/rChat/emotions/horror.tga and /dev/null differ diff --git a/rChat/emotions/ill.tga b/rChat/emotions/ill.tga deleted file mode 100644 index 33f4926..0000000 Binary files a/rChat/emotions/ill.tga and /dev/null differ diff --git a/rChat/emotions/kongfu.tga b/rChat/emotions/kongfu.tga deleted file mode 100644 index d9c46d1..0000000 Binary files a/rChat/emotions/kongfu.tga and /dev/null differ diff --git a/rChat/emotions/love.tga b/rChat/emotions/love.tga deleted file mode 100644 index 1eac44d..0000000 Binary files a/rChat/emotions/love.tga and /dev/null differ diff --git a/rChat/emotions/mail.tga b/rChat/emotions/mail.tga deleted file mode 100644 index deef76f..0000000 Binary files a/rChat/emotions/mail.tga and /dev/null differ diff --git a/rChat/emotions/makeup.tga b/rChat/emotions/makeup.tga deleted file mode 100644 index 49c83f5..0000000 Binary files a/rChat/emotions/makeup.tga and /dev/null differ diff --git a/rChat/emotions/meditate.tga b/rChat/emotions/meditate.tga deleted file mode 100644 index 1e6c2f8..0000000 Binary files a/rChat/emotions/meditate.tga and /dev/null differ diff --git a/rChat/emotions/miserable.tga b/rChat/emotions/miserable.tga deleted file mode 100644 index 3102569..0000000 Binary files a/rChat/emotions/miserable.tga and /dev/null differ diff --git a/rChat/emotions/okay.tga b/rChat/emotions/okay.tga deleted file mode 100644 index 97cb7ce..0000000 Binary files a/rChat/emotions/okay.tga and /dev/null differ diff --git a/rChat/emotions/pretty.tga b/rChat/emotions/pretty.tga deleted file mode 100644 index f5c18de..0000000 Binary files a/rChat/emotions/pretty.tga and /dev/null differ diff --git a/rChat/emotions/puke.tga b/rChat/emotions/puke.tga deleted file mode 100644 index 0dc5336..0000000 Binary files a/rChat/emotions/puke.tga and /dev/null differ diff --git a/rChat/emotions/shake.tga b/rChat/emotions/shake.tga deleted file mode 100644 index de9af1f..0000000 Binary files a/rChat/emotions/shake.tga and /dev/null differ diff --git a/rChat/emotions/shout.tga b/rChat/emotions/shout.tga deleted file mode 100644 index 970ef08..0000000 Binary files a/rChat/emotions/shout.tga and /dev/null differ diff --git a/rChat/emotions/shuuuu.tga b/rChat/emotions/shuuuu.tga deleted file mode 100644 index f748646..0000000 Binary files a/rChat/emotions/shuuuu.tga and /dev/null differ diff --git a/rChat/emotions/shy.tga b/rChat/emotions/shy.tga deleted file mode 100644 index 1287c39..0000000 Binary files a/rChat/emotions/shy.tga and /dev/null differ diff --git a/rChat/emotions/sleep.tga b/rChat/emotions/sleep.tga deleted file mode 100644 index 8e8e3b3..0000000 Binary files a/rChat/emotions/sleep.tga and /dev/null differ diff --git a/rChat/emotions/smile.tga b/rChat/emotions/smile.tga deleted file mode 100644 index 7f20b91..0000000 Binary files a/rChat/emotions/smile.tga and /dev/null differ diff --git a/rChat/emotions/suprise.tga b/rChat/emotions/suprise.tga deleted file mode 100644 index 318b890..0000000 Binary files a/rChat/emotions/suprise.tga and /dev/null differ diff --git a/rChat/emotions/surrender.tga b/rChat/emotions/surrender.tga deleted file mode 100644 index 223b403..0000000 Binary files a/rChat/emotions/surrender.tga and /dev/null differ diff --git a/rChat/emotions/sweat.tga b/rChat/emotions/sweat.tga deleted file mode 100644 index 1b3a37d..0000000 Binary files a/rChat/emotions/sweat.tga and /dev/null differ diff --git a/rChat/emotions/tear.tga b/rChat/emotions/tear.tga deleted file mode 100644 index c5c2e25..0000000 Binary files a/rChat/emotions/tear.tga and /dev/null differ diff --git a/rChat/emotions/tears.tga b/rChat/emotions/tears.tga deleted file mode 100644 index 9e1bda8..0000000 Binary files a/rChat/emotions/tears.tga and /dev/null differ diff --git a/rChat/emotions/think.tga b/rChat/emotions/think.tga deleted file mode 100644 index 62579d4..0000000 Binary files a/rChat/emotions/think.tga and /dev/null differ diff --git a/rChat/emotions/ugly.tga b/rChat/emotions/ugly.tga deleted file mode 100644 index aea68b2..0000000 Binary files a/rChat/emotions/ugly.tga and /dev/null differ diff --git a/rChat/emotions/victory.tga b/rChat/emotions/victory.tga deleted file mode 100644 index 76d8412..0000000 Binary files a/rChat/emotions/victory.tga and /dev/null differ diff --git a/rChat/emotions/volunteer.tga b/rChat/emotions/volunteer.tga deleted file mode 100644 index dc84c41..0000000 Binary files a/rChat/emotions/volunteer.tga and /dev/null differ diff --git a/rChat/emotions/wronged.tga b/rChat/emotions/wronged.tga deleted file mode 100644 index b271625..0000000 Binary files a/rChat/emotions/wronged.tga and /dev/null differ diff --git a/rChat/init.lua b/rChat/init.lua deleted file mode 100644 index 1d4b18b..0000000 --- a/rChat/init.lua +++ /dev/null @@ -1,44 +0,0 @@ -local A, L = ... - -L.dragFrames = {} -L.addonName = A -L.addonColor = "ffff7d0a" -L.addonShortcut = "rchat" - ------------------------------ --- rChat Global ------------------------------ - -rChat = {} -rChat.addonName = A - ------------------------------ --- Configs ------------------------------ - -local cfg = {} -cfg.dropshadow = {} -cfg.dropshadow.offset = {1,-2} -cfg.dropshadow.color = {0,0,0,0.25} -cfg.editbox = {} -cfg.editbox.font = {STANDARD_TEXT_FONT, 14, 'OUTLINE'} -cfg.chat = {} -cfg.chat.font = {STANDARD_TEXT_FONT, 14, 'OUTLINE'} --{STANDARD_TEXT_FONT, 12, "OUTLINE"} - -cfg.emote = {} -cfg.emote.iconsize = 18 -- 聊天文字中的表情大小,你可以根据聊天字号调整 -cfg.emote.listsize = 30 -- 表情选择器的图标大小 -cfg.emote.offsetx = 30 -- 标情况相当于输入框中心的X偏移 -cfg.emote.offsety = 30 -- 标情况相当于输入框中心的Y偏移 - -cfg.alpha = {} -cfg.alpha.enter = 1.0 -cfg.alpha.leave = 0.5 - -cfg.bar = {} -cfg.bar.is_vertical = false -- 启用竖直聊天框 -cfg.bar.padding = 30 -- 排列间隔 -cfg.bar.offsetx = 0 -- 相对于默认位置的X坐标偏移 -cfg.bar.offsety = 0 -- 相对于默认位置的Y坐标偏移 - -L.C = cfg \ No newline at end of file diff --git a/rChat/item.lua b/rChat/item.lua deleted file mode 100644 index 6926337..0000000 --- a/rChat/item.lua +++ /dev/null @@ -1,76 +0,0 @@ -local A, L = ... - -local DefaultSetItemRef = SetItemRef - ---we replace the default setitemref and use it to parse links for alt invite and url copy -function SetItemRef(link, ...) - local type, value = link:match("(%a+):(.+)") - if IsAltKeyDown() and type == "player" then - InviteUnit(value:match("([^:]+)")) - elseif (type == "url") then - local eb = LAST_ACTIVE_CHAT_EDIT_BOX or ChatFrame1EditBox - if not eb then return end - eb:SetText(value) - eb:SetFocus() - eb:HighlightText() - if not eb:IsShown() then eb:Show() end - else - return DefaultSetItemRef(link, ...) - end -end - ---生成新的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 = C_CurrencyInfo.GetCurrencyInfo(tonumber(id)).iconFileID - 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 ChatLinkFilter(self, event, msg, ...) - msg = msg:gsub("(|H%w+:%d+:.-|h.-|h)", SetChatLinkIcon) - return false, msg, ... -end - -ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", ChatLinkFilter)-- 公共频道 -ChatFrame_AddMessageEventFilter("CHAT_MSG_SAY", ChatLinkFilter)-- 说 -ChatFrame_AddMessageEventFilter("CHAT_MSG_YELL", ChatLinkFilter)-- 大喊 -ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID", ChatLinkFilter)-- 团队 -ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID_LEADER", ChatLinkFilter)-- 团队领袖 -ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY", ChatLinkFilter)-- 队伍 -ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY_LEADER", ChatLinkFilter)-- 队伍领袖 -ChatFrame_AddMessageEventFilter("CHAT_MSG_GUILD", ChatLinkFilter)-- 公会 - -ChatFrame_AddMessageEventFilter("CHAT_MSG_AFK", ChatLinkFilter)-- AFK玩家自动回复 -ChatFrame_AddMessageEventFilter("CHAT_MSG_DND", ChatLinkFilter)-- 切勿打扰自动回复 --- 副本和副本领袖 -ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT", ChatLinkFilter) -ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT_LEADER", ChatLinkFilter) --- 解析战网私聊 -ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", ChatLinkFilter) -ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_INFORM", ChatLinkFilter) -ChatFrame_AddMessageEventFilter("CHAT_MSG_BN_WHISPER", ChatLinkFilter) -ChatFrame_AddMessageEventFilter("CHAT_MSG_BN_WHISPER_INFORM", ChatLinkFilter) --- 解析社区聊天内容 -ChatFrame_AddMessageEventFilter("CHAT_MSG_COMMUNITIES_CHANNEL", ChatLinkFilter) ---拾取信息 -ChatFrame_AddMessageEventFilter("CHAT_MSG_LOOT", ChatLinkFilter) -ChatFrame_AddMessageEventFilter("CHAT_MSG_CURRENCY", ChatLinkFilter) \ No newline at end of file diff --git a/rChat/rChat.toc b/rChat/rChat.toc index 9e0e4a7..83f372d 100644 --- a/rChat/rChat.toc +++ b/rChat/rChat.toc @@ -4,11 +4,4 @@ ## Notes: Chat enhancements ## RequiredDeps: rLib -init.lua -core.lua -item.lua -# stat.lua -switch.lua -copy.lua -emote.lua -bar.lua \ No newline at end of file +core.lua \ No newline at end of file diff --git a/rChat/stat.lua b/rChat/stat.lua deleted file mode 100644 index 7e9e8ce..0000000 --- a/rChat/stat.lua +++ /dev/null @@ -1,188 +0,0 @@ ------------------------------ --- Variables ------------------------------ - -local A, L = ... - -local slotNames = { - "HeadSlot", - "NeckSlot", - "ShoulderSlot", - "BackSlot", - "ChestSlot", - "ShirtSlot", - "TabardSlot", - "WristSlot", - "HandsSlot", - "WaistSlot", - "LegsSlot", - "FeetSlot", - "Finger0Slot", - "Finger1Slot", - "Trinket0Slot", - "Trinket1Slot", - "MainHandSlot", - "SecondaryHandSlot", - "AmmoSlot" -} - --- 本地化专精 -local function Talent() - local Spec = GetSpecialization() - local SpecName = Spec and select(2, GetSpecializationInfo(Spec)) or "无" - return SpecName -end - --- 格式化血量 -local function HealText() - local HP = UnitHealthMax("player") - if HP > 1e4 then - return format("%.2f万", HP / 1e4) - else - return HP - end -end - --- 神器等级 -local function ArtifactLevel() - local currentLevel = " " - local azeriteItemLocation = C_AzeriteItem.FindActiveAzeriteItem() - if azeriteItemLocation then - currentLevel = C_AzeriteItem.GetPowerLevel(azeriteItemLocation) - end - return currentLevel -end - --- 特质装等级 -local function AzeriteItemLevel(slotNum) - local currentLevel = "0" - - local slotId = GetInventorySlotInfo(slotNames[slotNum]) - local itemLink = GetInventoryItemLink("player", slotId) - - if itemLink then - local itemLoc - if ItemLocation then - itemLoc = ItemLocation:CreateFromEquipmentSlot(slotId) - end - if C_AzeriteEmpoweredItem.IsAzeriteEmpoweredItem(itemLoc) then - return select(4, GetItemInfo(itemLink)) - end - end - return currentLevel -end - -local function GetItemLevel(slotNum) - local slotId = GetInventorySlotInfo(slotNames[slotNum]) - local itemLink = GetInventoryItemLink("player", slotId) - if itemLink then - local _ ,_ ,_ , ilvl ,_ ,_, iSubType = GetItemInfo(itemLink) - return iSubType .. "-" .. ilvl - end - return "0" -end - --- 基础属性 -local function BaseInfo() - local BaseStat = "" - BaseStat = BaseStat .. ("[%s] "):format(UnitClass("player")) - BaseStat = BaseStat .. ("[%s] "):format(Talent()) - BaseStat = BaseStat .. ("最高装等:%.1f 当前:%.1f "):format(GetAverageItemLevel()) - - local mainHand = GetItemLevel(17) - if mainHand ~= "0" then - BaseStat = BaseStat .. ("主手:%s "):format(mainHand) - end - - local offHand = GetItemLevel(18) - if offHand ~= "0" then - BaseStat = BaseStat .. ("副手:%s "):format(offHand) - end - - BaseStat = BaseStat .. ("血量:%s "):format(HealText()) - -- BaseStat = BaseStat .. ("神器:%s "):format(ArtifactLevel())-- 项链等级 - -- BaseStat = BaseStat .. ("头部:%s "):format(AzeriteItemLevel(1))-- 头部特质装等级 - -- BaseStat = BaseStat .. ("肩部:%s "):format(AzeriteItemLevel(3))-- 肩部特质装等级 - -- BaseStat = BaseStat .. ("胸部:%s "):format(AzeriteItemLevel(5))-- 胸部特质装等级 - return BaseStat -end - --- 输出属性(9 = 暴击 12 = 溅射 17 = 吸血 18 = 急速 21 = 闪避 26 = 精通 29 = 装备+自身全能 31 = 装备全能) --- by图图 -local function DpsInfo() - local DpsStat = {"", "", ""} - local specAttr = { - --纯力敏智属性职业 - WARRIOR = {1, 1, 1}, - DEATHKNIGHT = {1, 1, 1}, - ROGUE = {2, 2, 2}, - HUNTER = {2, 2, 2}, - DEMONHUNTER = {2, 2}, - MAGE = {3, 3, 3}, - WARLOCK = {3, 3, 3}, - PRIEST = {3, 3, 3}, - --混合力敏智属性职业 - SHAMAN = {3, 2, 3}, - MONK = {2, 3, 2}, - DRUID = {3, 2, 2, 3}, - PALADIN = {3, 1, 1} - } - local specId = GetSpecialization() - -- print("specId = "..specId) - local classCN, classEnName = UnitClass("player") - local classSpecArr = specAttr[classEnName] - DpsStat[1] = ("力量:%s "):format(UnitStat("player", 1)) - DpsStat[2] = ("敏捷:%s "):format(UnitStat("player", 2)) - DpsStat[3] = ("智力:%s "):format(UnitStat("player", 4)) - return DpsStat[classSpecArr[specId]] -end - --- 坦克属性 -local function TankInfo() - local TankStat = "" - TankStat = TankStat .. ("耐力:%s "):format(UnitStat("player", 3)) - TankStat = TankStat .. ("护甲:%s "):format(select(3, UnitArmor("player"))) - TankStat = TankStat .. ("躲闪:%.0f%% "):format(GetDodgeChance()) - TankStat = TankStat .. ("招架:%.0f%% "):format(GetParryChance()) - TankStat = TankStat .. ("格挡:%.0f%% "):format(GetBlockChance()) - return TankStat -end - --- 治疗属性 -local function HealInfo() - local HealStat = "" - -- HealStat = HealStat..("精神:%s "):format(UnitStat("player", 5)) - -- HealStat = HealStat .. ("法力回复:%d "):format(GetManaRegen() * 5) - return HealStat -end - --- 增强属性 -local function MoreInfo() - local MoreStat = "" - MoreStat = MoreStat .. ("爆击:%.0f%% "):format(GetCritChance()) - MoreStat = MoreStat .. ("急速:%.0f%% "):format(GetMeleeHaste()) - MoreStat = MoreStat .. ("精通:%.0f%% "):format(GetMasteryEffect()) - MoreStat = MoreStat .. ("全能:%.0f%% "):format( - GetCombatRatingBonus(CR_VERSATILITY_DAMAGE_DONE) + GetVersatilityBonus(CR_VERSATILITY_DAMAGE_DONE) - ) - -- MoreStat = MoreStat .. ("吸血:%.0f%% "):format(GetCombatRating(17) / 230) - -- MoreStat = MoreStat .. ("闪避:%.0f%% "):format(GetCombatRating(21) / 110) - return MoreStat -end - --- 属性收集 -function rChat:StatReport() - if UnitLevel("player") < 10 then - return BaseInfo() - end - local StatInfo = "" - local Role = GetSpecializationRole(GetSpecialization()) - if Role == "HEALER" then - StatInfo = StatInfo .. BaseInfo() .. DpsInfo() .. HealInfo() .. MoreInfo() - elseif Role == "TANK" then - StatInfo = StatInfo .. BaseInfo() .. DpsInfo() .. TankInfo() .. MoreInfo() - else - StatInfo = StatInfo .. BaseInfo() .. DpsInfo() .. MoreInfo() - end - return StatInfo -end \ No newline at end of file diff --git a/rChat/switch.lua b/rChat/switch.lua deleted file mode 100644 index 04027d2..0000000 --- a/rChat/switch.lua +++ /dev/null @@ -1,132 +0,0 @@ ---[[ - EasyChannel.lua - 频道和密语对象的快速切换 - 提取自网易有爱163Chat - 插件更新地址 http://nga.178.com/read.php?tid=9633520 ---]] -function ChatEdit_CustomTabPressed(...) - return ChatEdit_CustomTabPressed_Inner(...) -end - -local cycles = { - -- "说" - { - chatType = "SAY", - use = function(self, editbox) - return 1 - end - }, - --大喊 - { - chatType = "YELL", - use = function(self, editbox) - return 1 - end - }, - --小队 - { - chatType = "PARTY", - use = function(self, editbox) - return IsInGroup() - end - }, - --团队 - { - chatType = "RAID", - use = function(self, editbox) - return IsInRaid() - end - }, - --实时聊天 - { - chatType = "INSTANCE_CHAT", - use = function(self, editbox) - return select(2, IsInInstance()) == "pvp" - end - }, - --公会 - { - chatType = "GUILD", - use = function(self, editbox) - return IsInGuild() - end - }, - --频道 - { - chatType = "CHANNEL", - use = function(self, editbox, currChatType) - local currNum - if currChatType ~= "CHANNEL" then - currNum = IsShiftKeyDown() and 21 or 0 - else - currNum = editbox:GetAttribute("channelTarget") - end - local h, r, step = currNum + 1, 20, 1 - if IsShiftKeyDown() then - h, r, step = currNum - 1, 1, -1 - end - for i = h, r, step do - local channelNum, channelName = GetChannelName(i) - if channelNum > 0 and channelName:find("大脚世界频道") then - --print(channelName); --DEBUG - editbox:SetAttribute("channelTarget", i) - return true - end - end - end - }, - { - chatType = "SAY", - use = function(self, editbox) - return 1 - end - } -} - -local chatTypeBeforeSwitch, tellTargetBeforeSwitch --记录在频道和密语之间切换时的状态 -function ChatEdit_CustomTabPressed_Inner(self) - if strsub(tostring(self:GetText()), 1, 1) == "/" then - return - end - local currChatType = self:GetAttribute("chatType") - if (IsControlKeyDown()) then - if (currChatType == "WHISPER" or currChatType == "BN_WHISPER") then - --记录之前的密语对象,以便后续切回 - self:SetAttribute("chatType", chatTypeBeforeSwitch or "SAY") - ChatEdit_UpdateHeader(self) - chatTypeBeforeSwitch = "WHISPER" - tellTargetBeforeSwitch = self:GetAttribute("tellTarget") - return --这里和下面不同,这里可以不返回true - else - local newTarget, newTargetType = ChatEdit_GetNextTellTarget() - if tellTargetBeforeSwitch or (newTarget and newTarget ~= "") then - self:SetAttribute("chatType", tellTargetBeforeSwitch and chatTypeBeforeSwitch or newTargetType) - self:SetAttribute("tellTarget", tellTargetBeforeSwitch or newTarget) - ChatEdit_UpdateHeader(self) - chatTypeBeforeSwitch = currChatType - tellTargetBeforeSwitch = nil - return true --这里必须返回true,否则会被暴雪默认的再切换一次密语对象 - end - end - end - - --对于说然后SHIFT的情况,因为没有return,所以第一层循环会一直遍历到最后的SAY - for i, curr in ipairs(cycles) do - if curr.chatType == currChatType then - local h, r, step = i + 1, #cycles, 1 - if IsShiftKeyDown() then - h, r, step = i - 1, 1, -1 - end - if currChatType == "CHANNEL" then - h = i - end --频道仍然要测试一下 - for j = h, r, step do - if cycles[j]:use(self, currChatType) then - self:SetAttribute("chatType", cycles[j].chatType) - ChatEdit_UpdateHeader(self) - return - end - end - end - end -end diff --git a/rChatPlus/core.lua b/rChatPlus/core.lua index c2d2f41..05f9cc7 100644 --- a/rChatPlus/core.lua +++ b/rChatPlus/core.lua @@ -110,11 +110,12 @@ local function CreateChatVoicePanel() Holder.backdrop = L.CreateBackdrop(Holder) Holder.backdrop:SetBackdropColor(options.panelColor.r, options.panelColor.g, options.panelColor.b, options.panelColor.a) --create drag frame - rLib:CreateDragFrame(Holder, L.dragFrames, -2, true) + -- rLib:CreateDragFrame(Holder, L.dragFrames, -2, true) _G.ChatFrameChannelButton:ClearAllPoints() _G.ChatFrameChannelButton:SetPoint('TOP', Holder, 'TOP', 0, -2) + L.HandleButton(_G.ChatFrameChannelButton, nil, nil, true) _G.ChatFrameChannelButton.Icon:SetParent(_G.ChatFrameChannelButton) _G.ChatFrameChannelButton.Icon:SetDesaturated(options.desaturateVoiceIcons) _G.ChatFrameChannelButton:SetParent(Holder) @@ -124,9 +125,14 @@ local function CreateChatVoicePanel() end local function HandleChatVoiceIcons() + -- reset this btn disabled in rchat + _G.ChatFrameChannelButton:HookScript("OnShow", _G.ChatFrameChannelButton.Show) + _G.ChatFrameChannelButton:Show() + if options.hideVoiceButtons then _G.ChatFrameChannelButton:Hide() elseif options.pinVoiceButtons then + L.HandleButton(_G.ChatFrameChannelButton) _G.ChatFrameChannelButton.Icon:SetDesaturated(options.desaturateVoiceIcons) _G.ChatFrameChannelButton:ClearAllPoints() _G.ChatFrameChannelButton:SetPoint('RIGHT', _G.GeneralDockManager, 'RIGHT', 2, 0) @@ -450,6 +456,26 @@ local function CopyChat(frame) end end +local function EmoteButtonOnMouseUp(self, btn) + local chat = self:GetParent() + L.ToggleEmoteTable() +end + +local function EmoteButtonOnEnter(self) + self:SetAlpha(1) + self.texture:SetDesaturated(false) +end + +local function EmoteButtonOnLeave(self) + local chat = self:GetParent() + if _G[chat:GetName()..'TabText']:IsShown() then + self:SetAlpha(0.35) + else + self:SetAlpha(0) + end + self.texture:SetDesaturated(true) +end + local function CopyButtonOnMouseUp(self, btn) local chat = self:GetParent() if btn == 'RightButton' and chat:GetID() == 1 then @@ -472,6 +498,7 @@ local function CopyButtonOnLeave(self) end end + local function ToggleChatButton(button) if button then button:SetShown(not options.hideCopyButton) @@ -549,6 +576,32 @@ local function StyleChat(frame) copyButton:SetScript('OnLeave', CopyButtonOnLeave) ToggleChatButton(copyButton) + --emote button + if options.emote.enable then + local emoteButton = CreateFrame('Frame', format('%sEmoteButton%d', A, id), frame) + emoteButton:EnableMouse(true) + emoteButton:SetAlpha(0.35) + emoteButton:SetSize(20, 20) + emoteButton:SetPoint('TOPRIGHT', 0, -30) + emoteButton:SetFrameLevel(frame:GetFrameLevel() + 5) + frame.emoteButton = emoteButton + + local emoteTexture = L.CreateIcon(frame.emoteButton, 'OVERLAY') + emoteTexture:SetTexture(options.mediapath .. "Emote.blp") + emoteTexture:SetDesaturated(true) + emoteButton.texture = emoteTexture + + emoteButton:SetScript('OnMouseUp', EmoteButtonOnMouseUp) + emoteButton:SetScript('OnEnter', EmoteButtonOnEnter) + emoteButton:SetScript('OnLeave', EmoteButtonOnLeave) + end + + local lang = _G[name.."EditBoxLanguage"] + lang:GetRegions():SetAlpha(0) + lang:SetPoint("TOPRIGHT", editbox, "TOPRIGHT", -15, -2) + lang:SetPoint("BOTTOMRIGHT", editbox, "BOTTOMRIGHT", -15, 2) + -- L.CreateBackdrop(lang) + frame.styled = true end diff --git a/rChatPlus/init.lua b/rChatPlus/init.lua index 1a0a0ba..b9f1cab 100644 --- a/rChatPlus/init.lua +++ b/rChatPlus/init.lua @@ -2,8 +2,8 @@ local A, L = ... L.dragFrames = {} L.addonName = A -L.addonColor = "ff27c400" -L.addonShortcut = "rchat" +L.addonColor = "ffff7d0a" +L.addonShortcut = "rcp" ----------------------------- -- rChatPlus Global @@ -53,7 +53,7 @@ L.C = { fadeTabsNoBackdrop = true, hideCopyButton = false, useAltKey = false, - panelColor = {r = .06, g = .06, b = .06, a = 0.5}, + panelColor = {r = .06, g = .06, b = .06, a = .2}, pinVoiceButtons = true, hideVoiceButtons = false, desaturateVoiceIcons = true, @@ -61,4 +61,9 @@ L.C = { L.C.backdrop.edgeSize = 2 L.C.backdrop.inset = 2 -L.C.backdrop.insets = {left=2,right=2,top=2,bottom=2} \ No newline at end of file +L.C.backdrop.insets = {left=2,right=2,top=2,bottom=2} + +L.C.emote = {} +L.C.emote.enable = true +L.C.emote.iconsize = 15 -- 聊天文字中的表情大小,你可以根据聊天字号调整 +L.C.emote.listsize = 20 -- 表情选择器的图标大小 \ No newline at end of file diff --git a/rChatPlus/medias/ArrowUp.tga b/rChatPlus/medias/ArrowUp.tga new file mode 100644 index 0000000..4e97a12 Binary files /dev/null and b/rChatPlus/medias/ArrowUp.tga differ diff --git a/rChatPlus/medias/ArrowUpGlow.tga b/rChatPlus/medias/ArrowUpGlow.tga new file mode 100644 index 0000000..8a6a7d4 Binary files /dev/null and b/rChatPlus/medias/ArrowUpGlow.tga differ diff --git a/rChatPlus/medias/Close.tga b/rChatPlus/medias/Close.tga new file mode 100644 index 0000000..0abb312 Binary files /dev/null and b/rChatPlus/medias/Close.tga differ diff --git a/rChatPlus/medias/Emote.blp b/rChatPlus/medias/Emote.blp new file mode 100644 index 0000000..99e64f9 Binary files /dev/null and b/rChatPlus/medias/Emote.blp differ diff --git a/rChatPlus/medias/emotions/angel.tga b/rChatPlus/medias/emotions/angel.tga new file mode 100644 index 0000000..b401949 Binary files /dev/null and b/rChatPlus/medias/emotions/angel.tga differ diff --git a/rChatPlus/medias/emotions/angry.tga b/rChatPlus/medias/emotions/angry.tga new file mode 100644 index 0000000..c40ded9 Binary files /dev/null and b/rChatPlus/medias/emotions/angry.tga differ diff --git a/rChatPlus/medias/emotions/biglaugh.tga b/rChatPlus/medias/emotions/biglaugh.tga new file mode 100644 index 0000000..0168553 Binary files /dev/null and b/rChatPlus/medias/emotions/biglaugh.tga differ diff --git a/rChatPlus/medias/emotions/clap.tga b/rChatPlus/medias/emotions/clap.tga new file mode 100644 index 0000000..8c6eb93 Binary files /dev/null and b/rChatPlus/medias/emotions/clap.tga differ diff --git a/rChatPlus/medias/emotions/cool.tga b/rChatPlus/medias/emotions/cool.tga new file mode 100644 index 0000000..348f5ba Binary files /dev/null and b/rChatPlus/medias/emotions/cool.tga differ diff --git a/rChatPlus/medias/emotions/cry.tga b/rChatPlus/medias/emotions/cry.tga new file mode 100644 index 0000000..f0c9f50 Binary files /dev/null and b/rChatPlus/medias/emotions/cry.tga differ diff --git a/rChatPlus/medias/emotions/cute.tga b/rChatPlus/medias/emotions/cute.tga new file mode 100644 index 0000000..f9b94bf Binary files /dev/null and b/rChatPlus/medias/emotions/cute.tga differ diff --git a/rChatPlus/medias/emotions/despise.tga b/rChatPlus/medias/emotions/despise.tga new file mode 100644 index 0000000..7820148 Binary files /dev/null and b/rChatPlus/medias/emotions/despise.tga differ diff --git a/rChatPlus/medias/emotions/dreamsmile.tga b/rChatPlus/medias/emotions/dreamsmile.tga new file mode 100644 index 0000000..ee0eb46 Binary files /dev/null and b/rChatPlus/medias/emotions/dreamsmile.tga differ diff --git a/rChatPlus/medias/emotions/embarras.tga b/rChatPlus/medias/emotions/embarras.tga new file mode 100644 index 0000000..4e74a43 Binary files /dev/null and b/rChatPlus/medias/emotions/embarras.tga differ diff --git a/rChatPlus/medias/emotions/evil.tga b/rChatPlus/medias/emotions/evil.tga new file mode 100644 index 0000000..f9328db Binary files /dev/null and b/rChatPlus/medias/emotions/evil.tga differ diff --git a/rChatPlus/medias/emotions/excited.tga b/rChatPlus/medias/emotions/excited.tga new file mode 100644 index 0000000..826989c Binary files /dev/null and b/rChatPlus/medias/emotions/excited.tga differ diff --git a/rChatPlus/medias/emotions/faint.tga b/rChatPlus/medias/emotions/faint.tga new file mode 100644 index 0000000..d2c48a6 Binary files /dev/null and b/rChatPlus/medias/emotions/faint.tga differ diff --git a/rChatPlus/medias/emotions/fight.tga b/rChatPlus/medias/emotions/fight.tga new file mode 100644 index 0000000..377b456 Binary files /dev/null and b/rChatPlus/medias/emotions/fight.tga differ diff --git a/rChatPlus/medias/emotions/flu.tga b/rChatPlus/medias/emotions/flu.tga new file mode 100644 index 0000000..8a82259 Binary files /dev/null and b/rChatPlus/medias/emotions/flu.tga differ diff --git a/rChatPlus/medias/emotions/freeze.tga b/rChatPlus/medias/emotions/freeze.tga new file mode 100644 index 0000000..81e6a69 Binary files /dev/null and b/rChatPlus/medias/emotions/freeze.tga differ diff --git a/rChatPlus/medias/emotions/frown.tga b/rChatPlus/medias/emotions/frown.tga new file mode 100644 index 0000000..cc520d7 Binary files /dev/null and b/rChatPlus/medias/emotions/frown.tga differ diff --git a/rChatPlus/medias/emotions/greet.tga b/rChatPlus/medias/emotions/greet.tga new file mode 100644 index 0000000..c213de6 Binary files /dev/null and b/rChatPlus/medias/emotions/greet.tga differ diff --git a/rChatPlus/medias/emotions/grimace.tga b/rChatPlus/medias/emotions/grimace.tga new file mode 100644 index 0000000..7adc3a5 Binary files /dev/null and b/rChatPlus/medias/emotions/grimace.tga differ diff --git a/rChatPlus/medias/emotions/growl.tga b/rChatPlus/medias/emotions/growl.tga new file mode 100644 index 0000000..04898e9 Binary files /dev/null and b/rChatPlus/medias/emotions/growl.tga differ diff --git a/rChatPlus/medias/emotions/happy.tga b/rChatPlus/medias/emotions/happy.tga new file mode 100644 index 0000000..9e1fcd5 Binary files /dev/null and b/rChatPlus/medias/emotions/happy.tga differ diff --git a/rChatPlus/medias/emotions/heart.tga b/rChatPlus/medias/emotions/heart.tga new file mode 100644 index 0000000..34aaef0 Binary files /dev/null and b/rChatPlus/medias/emotions/heart.tga differ diff --git a/rChatPlus/medias/emotions/horror.tga b/rChatPlus/medias/emotions/horror.tga new file mode 100644 index 0000000..6c10ccc Binary files /dev/null and b/rChatPlus/medias/emotions/horror.tga differ diff --git a/rChatPlus/medias/emotions/ill.tga b/rChatPlus/medias/emotions/ill.tga new file mode 100644 index 0000000..33f4926 Binary files /dev/null and b/rChatPlus/medias/emotions/ill.tga differ diff --git a/rChatPlus/medias/emotions/innocent.tga b/rChatPlus/medias/emotions/innocent.tga new file mode 100644 index 0000000..79ea6fe Binary files /dev/null and b/rChatPlus/medias/emotions/innocent.tga differ diff --git a/rChatPlus/medias/emotions/kongfu.tga b/rChatPlus/medias/emotions/kongfu.tga new file mode 100644 index 0000000..d9c46d1 Binary files /dev/null and b/rChatPlus/medias/emotions/kongfu.tga differ diff --git a/rChatPlus/medias/emotions/love.tga b/rChatPlus/medias/emotions/love.tga new file mode 100644 index 0000000..1eac44d Binary files /dev/null and b/rChatPlus/medias/emotions/love.tga differ diff --git a/rChatPlus/medias/emotions/mail.tga b/rChatPlus/medias/emotions/mail.tga new file mode 100644 index 0000000..deef76f Binary files /dev/null and b/rChatPlus/medias/emotions/mail.tga differ diff --git a/rChatPlus/medias/emotions/makeup.tga b/rChatPlus/medias/emotions/makeup.tga new file mode 100644 index 0000000..49c83f5 Binary files /dev/null and b/rChatPlus/medias/emotions/makeup.tga differ diff --git a/rChatPlus/medias/emotions/mario.tga b/rChatPlus/medias/emotions/mario.tga new file mode 100644 index 0000000..8543790 Binary files /dev/null and b/rChatPlus/medias/emotions/mario.tga differ diff --git a/rChatPlus/medias/emotions/meditate.tga b/rChatPlus/medias/emotions/meditate.tga new file mode 100644 index 0000000..1e6c2f8 Binary files /dev/null and b/rChatPlus/medias/emotions/meditate.tga differ diff --git a/rChatPlus/medias/emotions/miserable.tga b/rChatPlus/medias/emotions/miserable.tga new file mode 100644 index 0000000..3102569 Binary files /dev/null and b/rChatPlus/medias/emotions/miserable.tga differ diff --git a/rChatPlus/medias/emotions/okay.tga b/rChatPlus/medias/emotions/okay.tga new file mode 100644 index 0000000..97cb7ce Binary files /dev/null and b/rChatPlus/medias/emotions/okay.tga differ diff --git a/rChatPlus/medias/emotions/pretty.tga b/rChatPlus/medias/emotions/pretty.tga new file mode 100644 index 0000000..f5c18de Binary files /dev/null and b/rChatPlus/medias/emotions/pretty.tga differ diff --git a/rChatPlus/medias/emotions/puke.tga b/rChatPlus/medias/emotions/puke.tga new file mode 100644 index 0000000..0dc5336 Binary files /dev/null and b/rChatPlus/medias/emotions/puke.tga differ diff --git a/rChatPlus/medias/emotions/raiders.tga b/rChatPlus/medias/emotions/raiders.tga new file mode 100644 index 0000000..3c347ee Binary files /dev/null and b/rChatPlus/medias/emotions/raiders.tga differ diff --git a/rChatPlus/medias/emotions/shake.tga b/rChatPlus/medias/emotions/shake.tga new file mode 100644 index 0000000..de9af1f Binary files /dev/null and b/rChatPlus/medias/emotions/shake.tga differ diff --git a/rChatPlus/medias/emotions/shout.tga b/rChatPlus/medias/emotions/shout.tga new file mode 100644 index 0000000..970ef08 Binary files /dev/null and b/rChatPlus/medias/emotions/shout.tga differ diff --git a/rChatPlus/medias/emotions/shy.tga b/rChatPlus/medias/emotions/shy.tga new file mode 100644 index 0000000..1287c39 Binary files /dev/null and b/rChatPlus/medias/emotions/shy.tga differ diff --git a/rChatPlus/medias/emotions/silent.tga b/rChatPlus/medias/emotions/silent.tga new file mode 100644 index 0000000..f748646 Binary files /dev/null and b/rChatPlus/medias/emotions/silent.tga differ diff --git a/rChatPlus/medias/emotions/sleep.tga b/rChatPlus/medias/emotions/sleep.tga new file mode 100644 index 0000000..8e8e3b3 Binary files /dev/null and b/rChatPlus/medias/emotions/sleep.tga differ diff --git a/rChatPlus/medias/emotions/smile.tga b/rChatPlus/medias/emotions/smile.tga new file mode 100644 index 0000000..7f20b91 Binary files /dev/null and b/rChatPlus/medias/emotions/smile.tga differ diff --git a/rChatPlus/medias/emotions/suprise.tga b/rChatPlus/medias/emotions/suprise.tga new file mode 100644 index 0000000..318b890 Binary files /dev/null and b/rChatPlus/medias/emotions/suprise.tga differ diff --git a/rChatPlus/medias/emotions/surrender.tga b/rChatPlus/medias/emotions/surrender.tga new file mode 100644 index 0000000..223b403 Binary files /dev/null and b/rChatPlus/medias/emotions/surrender.tga differ diff --git a/rChatPlus/medias/emotions/sweat.tga b/rChatPlus/medias/emotions/sweat.tga new file mode 100644 index 0000000..1b3a37d Binary files /dev/null and b/rChatPlus/medias/emotions/sweat.tga differ diff --git a/rChatPlus/medias/emotions/tear.tga b/rChatPlus/medias/emotions/tear.tga new file mode 100644 index 0000000..c5c2e25 Binary files /dev/null and b/rChatPlus/medias/emotions/tear.tga differ diff --git a/rChatPlus/medias/emotions/tears.tga b/rChatPlus/medias/emotions/tears.tga new file mode 100644 index 0000000..9e1bda8 Binary files /dev/null and b/rChatPlus/medias/emotions/tears.tga differ diff --git a/rChatPlus/medias/emotions/think.tga b/rChatPlus/medias/emotions/think.tga new file mode 100644 index 0000000..62579d4 Binary files /dev/null and b/rChatPlus/medias/emotions/think.tga differ diff --git a/rChatPlus/medias/emotions/titter.tga b/rChatPlus/medias/emotions/titter.tga new file mode 100644 index 0000000..85328ac Binary files /dev/null and b/rChatPlus/medias/emotions/titter.tga differ diff --git a/rChatPlus/medias/emotions/ugly.tga b/rChatPlus/medias/emotions/ugly.tga new file mode 100644 index 0000000..aea68b2 Binary files /dev/null and b/rChatPlus/medias/emotions/ugly.tga differ diff --git a/rChatPlus/medias/emotions/victory.tga b/rChatPlus/medias/emotions/victory.tga new file mode 100644 index 0000000..76d8412 Binary files /dev/null and b/rChatPlus/medias/emotions/victory.tga differ diff --git a/rChatPlus/medias/emotions/volunteer.tga b/rChatPlus/medias/emotions/volunteer.tga new file mode 100644 index 0000000..dc84c41 Binary files /dev/null and b/rChatPlus/medias/emotions/volunteer.tga differ diff --git a/rChatPlus/medias/emotions/wronged.tga b/rChatPlus/medias/emotions/wronged.tga new file mode 100644 index 0000000..b271625 Binary files /dev/null and b/rChatPlus/medias/emotions/wronged.tga differ diff --git a/rChatPlus/orgin.lua b/rChatPlus/orgin.lua deleted file mode 100644 index b2aba02..0000000 --- a/rChatPlus/orgin.lua +++ /dev/null @@ -1,206 +0,0 @@ - --- rChat: core --- zork, 2016 - ------------------------------ --- Variables ------------------------------ - -local A, L = ... - -local DefaultSetItemRef = SetItemRef - -local cfg = {} -cfg.dropshadow = {} -cfg.dropshadow.offset = {1,-2} -cfg.dropshadow.color = {0,0,0,0.25} -cfg.editbox = {} -cfg.editbox.font = {STANDARD_TEXT_FONT, 13, "THINOUTLINE"} -cfg.chat = {} -cfg.chat.font = {STANDARD_TEXT_FONT, 13, "THINOUTLINE"} --{STANDARD_TEXT_FONT, 12, "OUTLINE"} - ------------------------------ --- Functions ------------------------------ - ---SkinChat -local function SkinChat(self) - if not self then return end - local name = self:GetName() - --chat frame resizing - self:SetClampRectInsets(0, 0, 0, 0) - self:SetMaxResize(UIParent:GetWidth()/2, UIParent:GetHeight()/2) - self:SetMinResize(100, 50) - self:SetFont(unpack(cfg.chat.font)) - self:SetShadowOffset(unpack(cfg.dropshadow.offset)) - self:SetShadowColor(unpack(cfg.dropshadow.color)) - --chat fading - self:SetFading(true) - --hide button frame - local bf = _G[name.."ButtonFrame"] - bf:HookScript("OnShow", bf.Hide) - bf:Hide() - --editbox - local eb = _G[name.."EditBox"] - eb:SetAltArrowKeyMode(false) - --textures - _G[name.."EditBoxLeft"]:Hide() - _G[name.."EditBoxMid"]:Hide() - _G[name.."EditBoxRight"]:Hide() - --reposition - eb:ClearAllPoints() - if name == "ChatFrame2" then - eb:SetPoint("BOTTOM",self,"TOP",0,22+24) --CombatLogQuickButtonFrame_Custom:GetHeight() - else - eb:SetPoint("BOTTOM",self,"TOP",0,22) - end - eb:SetPoint("LEFT",self,-5,0) - eb:SetPoint("RIGHT",self,10,0) -end - -local function UpdateBackgroundAnchors(self) - --fix wierd combat log - self:SetClampRectInsets(0, 0, 0, 0) -end - ---OpenTemporaryWindow -local function OpenTemporaryWindow() - for _, name in next, CHAT_FRAMES do - local frame = _G[name] - if (frame.isTemporary) then - SkinChat(frame) - end - end -end - ---OnMOuseScroll -local function OnMOuseScroll(self,dir) - if(dir > 0) then - if(IsShiftKeyDown()) then self:ScrollToTop() else self:ScrollUp() end - else - if(IsShiftKeyDown()) then self:ScrollToBottom() else self:ScrollDown() end - end -end - ---we replace the default setitemref and use it to parse links for alt invite and url copy -function SetItemRef(link, ...) - local type, value = link:match("(%a+):(.+)") - if IsAltKeyDown() and type == "player" then - InviteUnit(value:match("([^:]+)")) - elseif (type == "url") then - local eb = LAST_ACTIVE_CHAT_EDIT_BOX or ChatFrame1EditBox - if not eb then return end - eb:SetText(value) - eb:SetFocus() - eb:HighlightText() - if not eb:IsShown() then eb:Show() end - else - return DefaultSetItemRef(link, ...) - end -end - ---AddMessage -local function AddMessage(self, text, ...) - --channel replace (Trade and such) - text = text:gsub('|h%[(%d+)%. .-%]|h', '|h%1.|h') - --url search - text = text:gsub('([wWhH][wWtT][wWtT][%.pP]%S+[^%p%s])', '|cffffffff|Hurl:%1|h[%1]|h|r') - return self.DefaultAddMessage(self, text, ...) -end - ------------------------------ --- Stuff ------------------------------ - ---editbox font -ChatFontNormal:SetFont(unpack(cfg.editbox.font)) -ChatFontNormal:SetShadowOffset(unpack(cfg.dropshadow.offset)) -ChatFontNormal:SetShadowColor(unpack(cfg.dropshadow.color)) - ---font size -CHAT_FONT_HEIGHTS = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20} - ---tabs -CHAT_TAB_HIDE_DELAY = 1 -CHAT_FRAME_TAB_NORMAL_MOUSEOVER_ALPHA = 1 -CHAT_FRAME_TAB_NORMAL_NOMOUSE_ALPHA = 0 -CHAT_FRAME_TAB_SELECTED_MOUSEOVER_ALPHA = 1 -CHAT_FRAME_TAB_SELECTED_NOMOUSE_ALPHA = 0 -CHAT_FRAME_TAB_ALERTING_MOUSEOVER_ALPHA = 1 -CHAT_FRAME_TAB_ALERTING_NOMOUSE_ALPHA = 1 - ---channels -CHAT_WHISPER_GET = "From %s " -CHAT_WHISPER_INFORM_GET = "To %s " -CHAT_BN_WHISPER_GET = "From %s " -CHAT_BN_WHISPER_INFORM_GET = "To %s " -CHAT_YELL_GET = "%s " -CHAT_SAY_GET = "%s " -CHAT_BATTLEGROUND_GET = "|Hchannel:Battleground|hBG.|h %s: " -CHAT_BATTLEGROUND_LEADER_GET = "|Hchannel:Battleground|hBGL.|h %s: " -CHAT_GUILD_GET = "|Hchannel:Guild|hG.|h %s: " -CHAT_OFFICER_GET = "|Hchannel:Officer|hGO.|h %s: " -CHAT_PARTY_GET = "|Hchannel:Party|hP.|h %s: " -CHAT_PARTY_LEADER_GET = "|Hchannel:Party|hPL.|h %s: " -CHAT_PARTY_GUIDE_GET = "|Hchannel:Party|hPG.|h %s: " -CHAT_RAID_GET = "|Hchannel:Raid|hR.|h %s: " -CHAT_RAID_LEADER_GET = "|Hchannel:Raid|hRL.|h %s: " -CHAT_RAID_WARNING_GET = "|Hchannel:RaidWarning|hRW.|h %s: " -CHAT_INSTANCE_CHAT_GET = "|Hchannel:Battleground|hI.|h %s: " -CHAT_INSTANCE_CHAT_LEADER_GET = "|Hchannel:Battleground|hIL.|h %s: " ---CHAT_MONSTER_PARTY_GET = CHAT_PARTY_GET ---CHAT_MONSTER_SAY_GET = CHAT_SAY_GET ---CHAT_MONSTER_WHISPER_GET = CHAT_WHISPER_GET ---CHAT_MONSTER_YELL_GET = CHAT_YELL_GET -CHAT_FLAG_AFK = "<AFK> " -CHAT_FLAG_DND = "<DND> " -CHAT_FLAG_GM = "<[GM]> " - ---remove the annoying guild loot messages by replacing them with the original ones -YOU_LOOT_MONEY_GUILD = YOU_LOOT_MONEY -LOOT_MONEY_SPLIT_GUILD = LOOT_MONEY_SPLIT - ---don't cut the toastframe -BNToastFrame:SetClampedToScreen(true) -BNToastFrame:SetClampRectInsets(-15,15,15,-15) - ---ChatFrameMenuButton -ChatFrameMenuButton:HookScript("OnShow", ChatFrameMenuButton.Hide) -ChatFrameMenuButton:Hide() ---ChatFrameChannelButton -ChatFrameChannelButton:HookScript("OnShow", ChatFrameChannelButton.Hide) -ChatFrameChannelButton:Hide() --- classic-disable ---[[ ---ChatFrameToggleVoiceDeafenButton -ChatFrameToggleVoiceDeafenButton:HookScript("OnShow", ChatFrameToggleVoiceDeafenButton.Hide) -ChatFrameToggleVoiceDeafenButton:Hide() ---ChatFrameToggleVoiceMuteButton -ChatFrameToggleVoiceMuteButton:HookScript("OnShow", ChatFrameToggleVoiceMuteButton.Hide) -ChatFrameToggleVoiceMuteButton:Hide() - ---hide the friend micro button -local button = QuickJoinToastButton or FriendsMicroButton -button:HookScript("OnShow", button.Hide) -button:Hide() -]]-- - ---skin chat -for i = 1, NUM_CHAT_WINDOWS do - local chatframe = _G["ChatFrame"..i] - SkinChat(chatframe) - --adjust channel display - if (i ~= 2) then - chatframe.DefaultAddMessage = chatframe.AddMessage - chatframe.AddMessage = AddMessage - end -end - ---scroll -FloatingChatFrame_OnMouseScroll = OnMOuseScroll - ---temporary chat windows -hooksecurefunc("FCF_OpenTemporaryWindow", OpenTemporaryWindow) - ---background thingy -hooksecurefunc("FloatingChatFrame_UpdateBackgroundAnchors", UpdateBackgroundAnchors) diff --git a/rChatPlus/plugins/bar.lua b/rChatPlus/plugins/bar.lua new file mode 100644 index 0000000..d3ed61f --- /dev/null +++ b/rChatPlus/plugins/bar.lua @@ -0,0 +1,186 @@ +local A, L = ... + +local config = L.C + +--[[=========================== 变量区 ==========================]] +-- 是否可移动的标记 +local IsMovable = false -- 没事干别动这个,你改成ture那么进入游戏后聊天条就是可以移动的 +--[[=============================== END ==============================]] +local chatFrame = SELECTED_DOCK_FRAME -- 聊天框架 +local inputbox = chatFrame.editBox -- 输入框 + +COLORSCHEME_BORDER = {0.3, 0.3, 0.3, 1} + +-- 边框颜色 +-- 主框架初始化 +local ChatBar = CreateFrame("Frame", nil, UIParent, BackdropTemplateMixin and "BackdropTemplate" or nil) +-- rChatBar = ChatBar + +local function ChannelSay_OnClick() + ChatFrame_OpenChat("/s " .. inputbox:GetText(), chatFrame) +end + +local function ChannelYell_OnClick() + ChatFrame_OpenChat("/y " .. inputbox:GetText(), chatFrame) +end + +local function ChannelParty_OnClick() + ChatFrame_OpenChat("/p " .. inputbox:GetText(), chatFrame) +end + +local function ChannelGuild_OnClick() + ChatFrame_OpenChat("/g " .. inputbox:GetText(), chatFrame) +end + +local function ChannelRaid_OnClick() + ChatFrame_OpenChat("/raid " .. inputbox:GetText(), chatFrame) +end + +local function ChannelBG_OnClick() + ChatFrame_OpenChat("/bg " .. inputbox:GetText(), chatFrame) +end + +local function ChatEmote_OnClick() + rChat:ToggleEmoteTable() +end + +local function ChannelWorld_OnClick(self, button) + if button == "RightButton" then + local _, channelName, _ = GetChannelName("大脚世界频道") + if channelName == nil then + JoinPermanentChannel("大脚世界频道", nil, 1, 1) + ChatFrame_RemoveMessageGroup(chatFrame, "CHANNEL") + ChatFrame_AddChannel(chatFrame, "大脚世界频道") + print("|cffffe00a<|r|cffff7d0arChat|r|cffffe00a>|r |cff00d200已加入大脚世界频道|r") + else + LeaveChannelByName("大脚世界频道") + print("|cffffe00a<|r|cffff7d0arChat|r|cffffe00a>|r |cffd20000已离开大脚世界频道|r") + end + else + local channel, _, _ = GetChannelName("大脚世界频道") + ChatFrame_OpenChat("/" .. channel .. " " .. inputbox:GetText(), chatFrame) + end +end + +local function Roll_OnClick() + RandomRoll(1, 100) +end + +local function Report_OnClick() + local statText = rChat:StatReport() + if button == "RightButton" then + print("|cffffe00a<|r|cffff7d0arChat|r|cffffe00a>|r |cff00d200我的属性:|r" .. statText) + else + ChatEdit_ActivateChat(inputbox) + inputbox:SetText(statText) + end +end + +local function ChatCopy_OnClick() + rChat:CopyFunc() +end + +local ChannelButtons = { + {name = "say", text = "说", color = {1.00, 1.00, 1.00}, callback = ChannelSay_OnClick}, + {name = "yell", text = "喊", color = {1.00, 0.25, 0.25}, callback = ChannelYell_OnClick}, + {name = "party", text = "队", color = {0.66, 0.66, 1.00}, callback = ChannelParty_OnClick}, + {name = "guild", text = "会", color = {0.25, 1.00, 0.25}, callback = ChannelGuild_OnClick}, + {name = "raid", text = "团", color = {1.00, 0.50, 0.00}, callback = ChannelRaid_OnClick}, + -- {name = "bg", text = "战", color = {1.00, 0.50, 0.00}, callback = ChannelBG_OnClick}, + {name = "world", text = "世", color = {0.78, 1.00, 0.59}, callback = ChannelWorld_OnClick}, + {name = "emote", text = "表", color = {1.00, 0.50, 1.00}, callback = ChatEmote_OnClick}, + {name = "roll", text = "骰", color = {1.00, 1.00, 0.00}, callback = Roll_OnClick}, + -- {name = "report", text = "报", color = {0.80, 0.30, 0.30}, callback = Report_OnClick}, + {name = "copy", text = "复", color = {0.20, 0.60, 0.80}, callback = ChatCopy_OnClick} +} + +local function CreateChannelButton(data, index) + local button = CreateFrame("Button", nil, ChatBar) + button:SetSize(20, 10) + -- frame:SetWidth(22) -- 按钮宽度 + -- frame:SetHeight(22) -- 按钮高度 + button:SetAlpha(config.alpha.leave) + button:SetFrameLevel(1) + + local tex = button:CreateTexture() + tex:SetTexture("Interface\\Buttons\\WHITE8x8") + tex:SetAllPoints() + tex:SetColorTexture(unpack(data.color)) + + button:SetScript( + "OnEnter", + function(self) + self:SetAlpha(config.alpha.enter) + end + ) + button:SetScript( + "OnLeave", + function(self) + self:SetAlpha(config.alpha.leave) + end + ) + + if config.bar.is_vertical then + button:SetPoint("TOP", ChatBar, "TOP", 0, (1 - index) * config.bar.padding) + else + button:SetPoint("LEFT", ChatBar, "LEFT", 10 + (index - 1) * config.bar.padding, 0) + end + + button:RegisterForClicks("AnyUp") + button:SetScript("OnClick", data.callback) + -- 显示的文字 + -- frameText = frame:CreateFontString(data.name .. "Text", "OVERLAY") + -- 字体设置 + -- frameText:SetFont(STANDARD_TEXT_FONT, 15, "OUTLINE") + + -- frameText:SetJustifyH("CENTER") + -- frameText:SetWidth(26) + -- frameText:SetHeight(26) + -- frameText:SetText(data.text) + -- frameText:SetPoint("CENTER", 0, 0) + + -- 文字按钮的颜色 + -- frameText:SetTextColor(data.color[1], data.color[2], data.color[3]) +end + +ChatBar:SetFrameLevel(0) + +-- 使用竖直布局 +if config.bar.is_vertical then + -- 主框体宽度 + ChatBar:SetWidth(30) + -- 主框体高度 + ChatBar:SetHeight(#ChannelButtons * config.bar.padding + 10) +else + -- 主框体宽度 + ChatBar:SetWidth(#ChannelButtons * config.bar.padding + 10) + -- 主框体高度 + ChatBar:SetHeight(30) +end + +-- 上方聊天输入框 +-- if SimpleChat_Config.UseTopInput then +-- inputbox:ClearAllPoints() +-- inputbox:SetPoint("BOTTOMLEFT", chatFrame, "TOPLEFT", 0, 20) +-- inputbox:SetPoint("BOTTOMRIGHT", chatFrame, "TOPRIGHT", 0, 20) +-- end + +-- 位置设定 +if config.bar.is_vertical then + ChatBar:SetPoint("TOPLEFT", "ChatFrame1", "TOPRIGHT", config.bar.offsetx + 30, config.bar.offsety + 25) +else + ChatBar:SetPoint("TOPLEFT", "ChatFrame1", "BOTTOMLEFT", config.bar.offsetx, config.bar.offsety - 5) +end + +if GetLocale() ~= 'zhCN' then + table.remove(ChannelButtons, 6) +end + +for i = 1, #ChannelButtons do -- 对非战斗记录聊天框的信息进行处理 + CreateChannelButton(ChannelButtons[i], i) +end + +--create drag frame +rLib:CreateDragFrame(ChatBar, L.dragFrames, -2, true) +--create slash commands +rLib:CreateSlashCmd(L.addonName, L.addonShortcut, L.dragFrames, L.addonColor) \ No newline at end of file diff --git a/rChatPlus/plugins/emote.lua b/rChatPlus/plugins/emote.lua new file mode 100644 index 0000000..fe0b49c --- /dev/null +++ b/rChatPlus/plugins/emote.lua @@ -0,0 +1,198 @@ +local A, L = ... + +if not L.C.emote.enable then return end + +-- 表情选择器框架 +local EmoteTableFrame = CreateFrame("Frame", "EmoteTableFrame", UIParent, BackdropTemplateMixin and "BackdropTemplate" or nil) +EmoteTableFrame:SetMovable(true) +EmoteTableFrame:RegisterForDrag("LeftButton") +EmoteTableFrame:SetScript("OnDragStart", EmoteTableFrame.StartMoving) +EmoteTableFrame:SetScript("OnDragStop", EmoteTableFrame.StopMovingOrSizing) +EmoteTableFrame:EnableMouse(true) +EmoteTableFrame:SetWidth((L.C.emote.listsize + 6) * 12 + 10) +EmoteTableFrame:SetHeight((L.C.emote.listsize + 6) * 5 + 10) +EmoteTableFrame:SetPoint("BOTTOMRIGHT", ChatFrame1EditBox, "TOPRIGHT", 1, 5) +EmoteTableFrame.backdrop = L.CreateBackdrop(EmoteTableFrame) +-- EmoteTableFrame:SetBackdrop({ +-- bgFile = "Interface\\Buttons\\WHITE8x8", +-- edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", +-- tile = true, +-- tileSize = 16, +-- edgeSize = 16, +-- insets = {left = 3, right = 3, top = 3, bottom = 3} +-- }) +-- EmoteTableFrame:SetBackdropColor(0.05, 0.05, 0.05, 0.8) +-- EmoteTableFrame:SetBackdropBorderColor(0.3, 0.3, 0.3) +-- 表情选择框出现位置 默认30,30 +EmoteTableFrame:Hide() +EmoteTableFrame:SetFrameStrata("DIALOG") + +-- 表情解析规则 +local fmtstring = format("\124T%%s:%d\124t", max(floor(select(2, SELECTED_CHAT_FRAME:GetFont())), L.C.emote.iconsize)) + +-- 自定义表情开始的序号 +local customEmoteStartIndex = 9 +local lang = GetLocale() + +local maps = {Angel="Angel",Angry="Angry",Biglaugh="Biglaugh",Clap="Clap",Cool="Cool",Cry="Cry",Cute="Cute",Despise="Despise",Dreamsmile="Dreamsmile",Embarras="Embarras",Evil="Evil",Excited="Excited",Faint="Faint",Fight="Fight",Flu="Flu",Freeze="Freeze",Frown="Frown",Greet="Greet",Grimace="Grimace",Growl="Growl",Happy="Happy",Heart="Heart",Horror="Horror",Ill="Ill",Innocent="Innocent",Kongfu="Kongfu",Love="Love",Mail="Mail",Makeup="Makeup",Mario="Mario",Meditate="Meditate",Miserable="Miserable",Okay="Okay",Pretty="Pretty",Puke="Puke",Shake="Shake",Shout="Shout",Silent="Silent",Shy="Shy",Sleep="Sleep",Smile="Smile",Suprise="Suprise",Surrender="Surrender",Sweat="Sweat",Tear="Tear",Tears="Tears",Think="Think",Titter="Titter",Ugly="Ugly",Victory="Victory",Volunteer="Volunteer",Wronged="Wronged"} + +if lang == "zhCN" then + maps = {Angel="天使",Angry="生气",Biglaugh="大笑",Clap="鼓掌",Cool="酷",Cry="哭",Cute="可爱",Despise="鄙视",Dreamsmile="美梦",Embarras="尴尬",Evil="邪恶",Excited="兴奋",Faint="晕",Fight="打架",Flu="流感",Freeze="呆",Frown="皱眉",Greet="致敬",Grimace="鬼脸",Growl="龇牙",Happy="开心",Heart="心",Horror="恐惧",Ill="生病",Innocent="无辜",Kongfu="功夫",Love="花痴",Mail="邮件",Makeup="化妆",Mario="马里奥",Meditate="沉思",Miserable="可怜",Okay="好",Pretty="漂亮",Puke="吐",Shake="握手",Shout="喊",Silent="闭嘴",Shy="害羞",Sleep="睡觉",Smile="微笑",Suprise="吃惊",Surrender="失败",Sweat="流汗",Tear="流泪",Tears="悲剧",Think="想",Titter="偷笑",Ugly="猥琐",Victory="胜利",Volunteer="雷锋",Wronged="委屈"} +elseif lang == "zhTW" then + maps = {Angel="天使",Angry="生氣",Biglaugh="大笑",Clap="鼓掌",Cool="酷",Cry="哭",Cute="可愛",Despise="鄙視",Dreamsmile="美夢",Embarras="尷尬",Evil="邪惡",Excited="興奮",Faint="暈",Fight="打架",Flu="流感",Freeze="呆",Frown="皺眉",Greet="致敬",Grimace="鬼臉",Growl="齜牙",Happy="開心",Heart="心",Horror="恐懼",Ill="生病",Innocent="無辜",Kongfu="功夫",Love="花癡",Mail="郵件",Makeup="化妝",Mario="馬里奧",Meditate="沉思",Miserable="可憐",Okay="好",Pretty="漂亮",Puke="吐",Shake="握手",Shout="喊",Silent="閉嘴",Shy="害羞",Sleep="睡覺",Smile="微笑",Suprise="吃驚",Surrender="失敗",Sweat="流汗",Tear="流淚",Tears="悲劇",Think="想",Titter="偷笑",Ugly="猥瑣",Victory="勝利",Volunteer="雷鋒",Wronged="委屈"} +end + +local emotes = { + --原版暴雪提供的8个图标 + {"{rt1}", [=[Interface\TargetingFrame\UI-RaidTargetingIcon_1]=]}, + {"{rt2}", [=[Interface\TargetingFrame\UI-RaidTargetingIcon_2]=]}, + {"{rt3}", [=[Interface\TargetingFrame\UI-RaidTargetingIcon_3]=]}, + {"{rt4}", [=[Interface\TargetingFrame\UI-RaidTargetingIcon_4]=]}, + {"{rt5}", [=[Interface\TargetingFrame\UI-RaidTargetingIcon_5]=]}, + {"{rt6}", [=[Interface\TargetingFrame\UI-RaidTargetingIcon_6]=]}, + {"{rt7}", [=[Interface\TargetingFrame\UI-RaidTargetingIcon_7]=]}, + {"{rt8}", [=[Interface\TargetingFrame\UI-RaidTargetingIcon_8]=]}, +} + +for i,v in pairs(maps) do + local tex = L.C.mediapath .. "emotions\\" .. i + local key = "{" .. v .. "}" + table.insert(emotes, {key, tex}) +end +-- --自定义表情 +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Angel]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Angry]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Biglaugh]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Clap]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Cool]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Cry]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Cutie]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Despise]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Dreamsmile]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Embarrass]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Evil]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Excited]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Faint]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Fight]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Flu]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Freeze]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Frown]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Greet]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Grimace]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Growl]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Happy]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Heart]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Horror]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Ill]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Innocent]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Kongfu]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Love]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Mail]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Makeup]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Mario]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Meditate]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Miserable]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Okay]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Pretty]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Puke]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Shake]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Shout]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Shuuuu]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Shy]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Sleep]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Smile]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Suprise]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Surrender]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Sweat]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Tear]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Tears]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Think]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Titter]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Ugly]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Victory]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Volunteer]=]}, +-- {"{"..maps[Angel].."}", [=[Interface\Addons\rChatPlus\medias\emotions\Wronged]=]} +-- } + +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) + end + end + return false, msg, ... +end + +local function ToggleEmoteTable() + if (EmoteTableFrame:IsShown()) then + EmoteTableFrame:Hide() + else + EmoteTableFrame:Show() + end +end +L.ToggleEmoteTable = ToggleEmoteTable + +local function EmoteIconMouseUp(frame, button) + if (button == "LeftButton") then + local chatFrame = GetCVar("chatStyle") == "im" and SELECTED_CHAT_FRAME or DEFAULT_CHAT_FRAME + local eb = chatFrame and chatFrame.editBox + if (eb) then + eb:Insert(frame.text) + eb:Show(); + eb:SetFocus() + end + end + + ToggleEmoteTable() +end + +local icon, row, col +row = 1 +col = 1 +for i = 1, #emotes do + text = emotes[i][1] + texture = emotes[i][2] + icon = CreateFrame("Frame", format("IconButton%d", i), EmoteTableFrame) + icon:SetWidth(L.C.emote.listsize + 6) + icon:SetHeight(L.C.emote.listsize + 6) + icon.text = text + icon.texture = icon:CreateTexture(nil, "ARTWORK") + icon.texture:SetTexture(texture) + icon.texture:SetAllPoints(icon) + icon:Show() + icon:SetPoint( + "TOPLEFT", + 5 + (col - 1) * (L.C.emote.listsize + 6), + -5 - (row - 1) * (L.C.emote.listsize + 6) + ) + icon:SetScript("OnMouseUp", EmoteIconMouseUp) + icon:EnableMouse(true) + col = col + 1 + if (col > 12) then + row = row + 1 + col = 1 + end +end + +ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", ChatEmoteFilter)-- 公共频道 +ChatFrame_AddMessageEventFilter("CHAT_MSG_SAY", ChatEmoteFilter)-- 说 +ChatFrame_AddMessageEventFilter("CHAT_MSG_YELL", ChatEmoteFilter)-- 大喊 +ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID", ChatEmoteFilter)-- 团队 +ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID_LEADER", ChatEmoteFilter)-- 团队领袖 +ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY", ChatEmoteFilter)-- 队伍 +ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY_LEADER", ChatEmoteFilter)-- 队伍领袖 +ChatFrame_AddMessageEventFilter("CHAT_MSG_GUILD", ChatEmoteFilter)-- 公会 + +ChatFrame_AddMessageEventFilter("CHAT_MSG_AFK", ChatEmoteFilter)-- AFK玩家自动回复 +ChatFrame_AddMessageEventFilter("CHAT_MSG_DND", ChatEmoteFilter)-- 切勿打扰自动回复 + +-- 副本和副本领袖 +ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT", ChatEmoteFilter) +ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT_LEADER", ChatEmoteFilter) +-- 解析战网私聊 +ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", ChatEmoteFilter) +ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_INFORM", ChatEmoteFilter) +ChatFrame_AddMessageEventFilter("CHAT_MSG_BN_WHISPER", ChatEmoteFilter) +ChatFrame_AddMessageEventFilter("CHAT_MSG_BN_WHISPER_INFORM", ChatEmoteFilter) +-- 解析社区聊天内容 +ChatFrame_AddMessageEventFilter("CHAT_MSG_COMMUNITIES_CHANNEL", ChatEmoteFilter) \ No newline at end of file diff --git a/rChatPlus/plugins/link.lua b/rChatPlus/plugins/link.lua new file mode 100644 index 0000000..6926337 --- /dev/null +++ b/rChatPlus/plugins/link.lua @@ -0,0 +1,76 @@ +local A, L = ... + +local DefaultSetItemRef = SetItemRef + +--we replace the default setitemref and use it to parse links for alt invite and url copy +function SetItemRef(link, ...) + local type, value = link:match("(%a+):(.+)") + if IsAltKeyDown() and type == "player" then + InviteUnit(value:match("([^:]+)")) + elseif (type == "url") then + local eb = LAST_ACTIVE_CHAT_EDIT_BOX or ChatFrame1EditBox + if not eb then return end + eb:SetText(value) + eb:SetFocus() + eb:HighlightText() + if not eb:IsShown() then eb:Show() end + else + return DefaultSetItemRef(link, ...) + end +end + +--生成新的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 = C_CurrencyInfo.GetCurrencyInfo(tonumber(id)).iconFileID + 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 ChatLinkFilter(self, event, msg, ...) + msg = msg:gsub("(|H%w+:%d+:.-|h.-|h)", SetChatLinkIcon) + return false, msg, ... +end + +ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", ChatLinkFilter)-- 公共频道 +ChatFrame_AddMessageEventFilter("CHAT_MSG_SAY", ChatLinkFilter)-- 说 +ChatFrame_AddMessageEventFilter("CHAT_MSG_YELL", ChatLinkFilter)-- 大喊 +ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID", ChatLinkFilter)-- 团队 +ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID_LEADER", ChatLinkFilter)-- 团队领袖 +ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY", ChatLinkFilter)-- 队伍 +ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY_LEADER", ChatLinkFilter)-- 队伍领袖 +ChatFrame_AddMessageEventFilter("CHAT_MSG_GUILD", ChatLinkFilter)-- 公会 + +ChatFrame_AddMessageEventFilter("CHAT_MSG_AFK", ChatLinkFilter)-- AFK玩家自动回复 +ChatFrame_AddMessageEventFilter("CHAT_MSG_DND", ChatLinkFilter)-- 切勿打扰自动回复 +-- 副本和副本领袖 +ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT", ChatLinkFilter) +ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT_LEADER", ChatLinkFilter) +-- 解析战网私聊 +ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", ChatLinkFilter) +ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_INFORM", ChatLinkFilter) +ChatFrame_AddMessageEventFilter("CHAT_MSG_BN_WHISPER", ChatLinkFilter) +ChatFrame_AddMessageEventFilter("CHAT_MSG_BN_WHISPER_INFORM", ChatLinkFilter) +-- 解析社区聊天内容 +ChatFrame_AddMessageEventFilter("CHAT_MSG_COMMUNITIES_CHANNEL", ChatLinkFilter) +--拾取信息 +ChatFrame_AddMessageEventFilter("CHAT_MSG_LOOT", ChatLinkFilter) +ChatFrame_AddMessageEventFilter("CHAT_MSG_CURRENCY", ChatLinkFilter) \ No newline at end of file diff --git a/rChatPlus/plugins/stat.lua b/rChatPlus/plugins/stat.lua new file mode 100644 index 0000000..7e9e8ce --- /dev/null +++ b/rChatPlus/plugins/stat.lua @@ -0,0 +1,188 @@ +----------------------------- +-- Variables +----------------------------- + +local A, L = ... + +local slotNames = { + "HeadSlot", + "NeckSlot", + "ShoulderSlot", + "BackSlot", + "ChestSlot", + "ShirtSlot", + "TabardSlot", + "WristSlot", + "HandsSlot", + "WaistSlot", + "LegsSlot", + "FeetSlot", + "Finger0Slot", + "Finger1Slot", + "Trinket0Slot", + "Trinket1Slot", + "MainHandSlot", + "SecondaryHandSlot", + "AmmoSlot" +} + +-- 本地化专精 +local function Talent() + local Spec = GetSpecialization() + local SpecName = Spec and select(2, GetSpecializationInfo(Spec)) or "无" + return SpecName +end + +-- 格式化血量 +local function HealText() + local HP = UnitHealthMax("player") + if HP > 1e4 then + return format("%.2f万", HP / 1e4) + else + return HP + end +end + +-- 神器等级 +local function ArtifactLevel() + local currentLevel = " " + local azeriteItemLocation = C_AzeriteItem.FindActiveAzeriteItem() + if azeriteItemLocation then + currentLevel = C_AzeriteItem.GetPowerLevel(azeriteItemLocation) + end + return currentLevel +end + +-- 特质装等级 +local function AzeriteItemLevel(slotNum) + local currentLevel = "0" + + local slotId = GetInventorySlotInfo(slotNames[slotNum]) + local itemLink = GetInventoryItemLink("player", slotId) + + if itemLink then + local itemLoc + if ItemLocation then + itemLoc = ItemLocation:CreateFromEquipmentSlot(slotId) + end + if C_AzeriteEmpoweredItem.IsAzeriteEmpoweredItem(itemLoc) then + return select(4, GetItemInfo(itemLink)) + end + end + return currentLevel +end + +local function GetItemLevel(slotNum) + local slotId = GetInventorySlotInfo(slotNames[slotNum]) + local itemLink = GetInventoryItemLink("player", slotId) + if itemLink then + local _ ,_ ,_ , ilvl ,_ ,_, iSubType = GetItemInfo(itemLink) + return iSubType .. "-" .. ilvl + end + return "0" +end + +-- 基础属性 +local function BaseInfo() + local BaseStat = "" + BaseStat = BaseStat .. ("[%s] "):format(UnitClass("player")) + BaseStat = BaseStat .. ("[%s] "):format(Talent()) + BaseStat = BaseStat .. ("最高装等:%.1f 当前:%.1f "):format(GetAverageItemLevel()) + + local mainHand = GetItemLevel(17) + if mainHand ~= "0" then + BaseStat = BaseStat .. ("主手:%s "):format(mainHand) + end + + local offHand = GetItemLevel(18) + if offHand ~= "0" then + BaseStat = BaseStat .. ("副手:%s "):format(offHand) + end + + BaseStat = BaseStat .. ("血量:%s "):format(HealText()) + -- BaseStat = BaseStat .. ("神器:%s "):format(ArtifactLevel())-- 项链等级 + -- BaseStat = BaseStat .. ("头部:%s "):format(AzeriteItemLevel(1))-- 头部特质装等级 + -- BaseStat = BaseStat .. ("肩部:%s "):format(AzeriteItemLevel(3))-- 肩部特质装等级 + -- BaseStat = BaseStat .. ("胸部:%s "):format(AzeriteItemLevel(5))-- 胸部特质装等级 + return BaseStat +end + +-- 输出属性(9 = 暴击 12 = 溅射 17 = 吸血 18 = 急速 21 = 闪避 26 = 精通 29 = 装备+自身全能 31 = 装备全能) +-- by图图 +local function DpsInfo() + local DpsStat = {"", "", ""} + local specAttr = { + --纯力敏智属性职业 + WARRIOR = {1, 1, 1}, + DEATHKNIGHT = {1, 1, 1}, + ROGUE = {2, 2, 2}, + HUNTER = {2, 2, 2}, + DEMONHUNTER = {2, 2}, + MAGE = {3, 3, 3}, + WARLOCK = {3, 3, 3}, + PRIEST = {3, 3, 3}, + --混合力敏智属性职业 + SHAMAN = {3, 2, 3}, + MONK = {2, 3, 2}, + DRUID = {3, 2, 2, 3}, + PALADIN = {3, 1, 1} + } + local specId = GetSpecialization() + -- print("specId = "..specId) + local classCN, classEnName = UnitClass("player") + local classSpecArr = specAttr[classEnName] + DpsStat[1] = ("力量:%s "):format(UnitStat("player", 1)) + DpsStat[2] = ("敏捷:%s "):format(UnitStat("player", 2)) + DpsStat[3] = ("智力:%s "):format(UnitStat("player", 4)) + return DpsStat[classSpecArr[specId]] +end + +-- 坦克属性 +local function TankInfo() + local TankStat = "" + TankStat = TankStat .. ("耐力:%s "):format(UnitStat("player", 3)) + TankStat = TankStat .. ("护甲:%s "):format(select(3, UnitArmor("player"))) + TankStat = TankStat .. ("躲闪:%.0f%% "):format(GetDodgeChance()) + TankStat = TankStat .. ("招架:%.0f%% "):format(GetParryChance()) + TankStat = TankStat .. ("格挡:%.0f%% "):format(GetBlockChance()) + return TankStat +end + +-- 治疗属性 +local function HealInfo() + local HealStat = "" + -- HealStat = HealStat..("精神:%s "):format(UnitStat("player", 5)) + -- HealStat = HealStat .. ("法力回复:%d "):format(GetManaRegen() * 5) + return HealStat +end + +-- 增强属性 +local function MoreInfo() + local MoreStat = "" + MoreStat = MoreStat .. ("爆击:%.0f%% "):format(GetCritChance()) + MoreStat = MoreStat .. ("急速:%.0f%% "):format(GetMeleeHaste()) + MoreStat = MoreStat .. ("精通:%.0f%% "):format(GetMasteryEffect()) + MoreStat = MoreStat .. ("全能:%.0f%% "):format( + GetCombatRatingBonus(CR_VERSATILITY_DAMAGE_DONE) + GetVersatilityBonus(CR_VERSATILITY_DAMAGE_DONE) + ) + -- MoreStat = MoreStat .. ("吸血:%.0f%% "):format(GetCombatRating(17) / 230) + -- MoreStat = MoreStat .. ("闪避:%.0f%% "):format(GetCombatRating(21) / 110) + return MoreStat +end + +-- 属性收集 +function rChat:StatReport() + if UnitLevel("player") < 10 then + return BaseInfo() + end + local StatInfo = "" + local Role = GetSpecializationRole(GetSpecialization()) + if Role == "HEALER" then + StatInfo = StatInfo .. BaseInfo() .. DpsInfo() .. HealInfo() .. MoreInfo() + elseif Role == "TANK" then + StatInfo = StatInfo .. BaseInfo() .. DpsInfo() .. TankInfo() .. MoreInfo() + else + StatInfo = StatInfo .. BaseInfo() .. DpsInfo() .. MoreInfo() + end + return StatInfo +end \ No newline at end of file diff --git a/rChatPlus/plugins/switch.lua b/rChatPlus/plugins/switch.lua new file mode 100644 index 0000000..04027d2 --- /dev/null +++ b/rChatPlus/plugins/switch.lua @@ -0,0 +1,132 @@ +--[[ + EasyChannel.lua + 频道和密语对象的快速切换 + 提取自网易有爱163Chat + 插件更新地址 http://nga.178.com/read.php?tid=9633520 +--]] +function ChatEdit_CustomTabPressed(...) + return ChatEdit_CustomTabPressed_Inner(...) +end + +local cycles = { + -- "说" + { + chatType = "SAY", + use = function(self, editbox) + return 1 + end + }, + --大喊 + { + chatType = "YELL", + use = function(self, editbox) + return 1 + end + }, + --小队 + { + chatType = "PARTY", + use = function(self, editbox) + return IsInGroup() + end + }, + --团队 + { + chatType = "RAID", + use = function(self, editbox) + return IsInRaid() + end + }, + --实时聊天 + { + chatType = "INSTANCE_CHAT", + use = function(self, editbox) + return select(2, IsInInstance()) == "pvp" + end + }, + --公会 + { + chatType = "GUILD", + use = function(self, editbox) + return IsInGuild() + end + }, + --频道 + { + chatType = "CHANNEL", + use = function(self, editbox, currChatType) + local currNum + if currChatType ~= "CHANNEL" then + currNum = IsShiftKeyDown() and 21 or 0 + else + currNum = editbox:GetAttribute("channelTarget") + end + local h, r, step = currNum + 1, 20, 1 + if IsShiftKeyDown() then + h, r, step = currNum - 1, 1, -1 + end + for i = h, r, step do + local channelNum, channelName = GetChannelName(i) + if channelNum > 0 and channelName:find("大脚世界频道") then + --print(channelName); --DEBUG + editbox:SetAttribute("channelTarget", i) + return true + end + end + end + }, + { + chatType = "SAY", + use = function(self, editbox) + return 1 + end + } +} + +local chatTypeBeforeSwitch, tellTargetBeforeSwitch --记录在频道和密语之间切换时的状态 +function ChatEdit_CustomTabPressed_Inner(self) + if strsub(tostring(self:GetText()), 1, 1) == "/" then + return + end + local currChatType = self:GetAttribute("chatType") + if (IsControlKeyDown()) then + if (currChatType == "WHISPER" or currChatType == "BN_WHISPER") then + --记录之前的密语对象,以便后续切回 + self:SetAttribute("chatType", chatTypeBeforeSwitch or "SAY") + ChatEdit_UpdateHeader(self) + chatTypeBeforeSwitch = "WHISPER" + tellTargetBeforeSwitch = self:GetAttribute("tellTarget") + return --这里和下面不同,这里可以不返回true + else + local newTarget, newTargetType = ChatEdit_GetNextTellTarget() + if tellTargetBeforeSwitch or (newTarget and newTarget ~= "") then + self:SetAttribute("chatType", tellTargetBeforeSwitch and chatTypeBeforeSwitch or newTargetType) + self:SetAttribute("tellTarget", tellTargetBeforeSwitch or newTarget) + ChatEdit_UpdateHeader(self) + chatTypeBeforeSwitch = currChatType + tellTargetBeforeSwitch = nil + return true --这里必须返回true,否则会被暴雪默认的再切换一次密语对象 + end + end + end + + --对于说然后SHIFT的情况,因为没有return,所以第一层循环会一直遍历到最后的SAY + for i, curr in ipairs(cycles) do + if curr.chatType == currChatType then + local h, r, step = i + 1, #cycles, 1 + if IsShiftKeyDown() then + h, r, step = i - 1, 1, -1 + end + if currChatType == "CHANNEL" then + h = i + end --频道仍然要测试一下 + for j = h, r, step do + if cycles[j]:use(self, currChatType) then + self:SetAttribute("chatType", cycles[j].chatType) + ChatEdit_UpdateHeader(self) + return + end + end + end + end +end diff --git a/rChatPlus/rChatPlus.toc b/rChatPlus/rChatPlus.toc index 7b80b3f..80a2b8c 100644 --- a/rChatPlus/rChatPlus.toc +++ b/rChatPlus/rChatPlus.toc @@ -1,10 +1,13 @@ ## Interface: 20502 ## Author: rawoil -## Title: rChat|cff27c400Plus|r |cff1a9fc0BCC|r +## Title: rChat|cffff7d0aPlus|r |cff1a9fc0BCC|r ## Notes: Chat enhancements advanced ## RequiredDeps: rLib, oUF_SimpleConfig init.lua utils.lua core.lua -setup.lua \ No newline at end of file + +plugins/emote.lua + +setup.lua diff --git a/rChatPlus/utils.lua b/rChatPlus/utils.lua index 7732904..f3c56f1 100644 --- a/rChatPlus/utils.lua +++ b/rChatPlus/utils.lua @@ -98,4 +98,16 @@ local function RGBToHex(r, g, b, header, ending) b = b <= 1 and b >= 0 and b or 1 return format('%s%02x%02x%02x%s', header or '|cff', r*255, g*255, b*255, ending or '') end -L.RGBToHex = RGBToHex \ No newline at end of file +L.RGBToHex = RGBToHex + +local function HandleButton(button) + if button.isSkinned then return end + + if button.SetNormalTexture and not overrideTex then button:SetNormalTexture('') end + if button.SetHighlightTexture then button:SetHighlightTexture('') end + if button.SetPushedTexture then button:SetPushedTexture('') end + if button.SetDisabledTexture then button:SetDisabledTexture('') end + + button.isSkinned = true +end +L.HandleButton = HandleButton \ No newline at end of file diff --git a/rSkin/modules/MerInspect.lua b/rSkin/modules/MerInspect.lua index 5b55892..55ff372 100644 --- a/rSkin/modules/MerInspect.lua +++ b/rSkin/modules/MerInspect.lua @@ -21,7 +21,7 @@ local function SkinInspectFrame(frame) end local function SkinMerInspect() - if not IsAddOnLoaded("MerInspect-BCC") then return end + if not IsAddOnLoaded("MerInspect") then return end if not _G.ShowInspectItemListFrame then return end diff --git a/rSkin/rSkin.toc b/rSkin/rSkin.toc index 2d4f149..22b2fd8 100644 --- a/rSkin/rSkin.toc +++ b/rSkin/rSkin.toc @@ -3,7 +3,7 @@ ## Title: rSkin |cff1a9fc0BCC|r ## Notes: Reskin other addons to fit zorkui's L&F ## RequiredDeps: rLib, rButtonTemplate_Zork, oUF_SimpleConfig -## OptionalDeps: DBM-Core, WeakAuras, ls_Toasts, Details, BigWigs_Plugins, ThreatClassic2, Dominos, MerInspect-BCC +## OptionalDeps: DBM-Core, WeakAuras, ls_Toasts, Details, BigWigs_Plugins, ThreatClassic2, Dominos, MerInspect ## SavedVariablesPerCharacter: rSkinDB init.lua