mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-25 21:40:49 +00:00
chatcopy: add module to copy chat contents
* chatmenu is now available via rightclick on chatcopy * moved whisperproxy into a seperate module * reduced/cleaned up whisperproxy code
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 2.4 KiB |
+6
-146
@@ -177,139 +177,6 @@ pfUI:RegisterModule("chat", function ()
|
|||||||
pfUI.chat.urlcopy.SetItemRef(link, text, button)
|
pfUI.chat.urlcopy.SetItemRef(link, text, button)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- whisper forwarding
|
|
||||||
pfUI.chat.left.panelTop.proxy = CreateFrame("Button", "leftChatWhisperProxy", pfUI.chat.left.panelTop)
|
|
||||||
pfUI.chat.left.panelTop.proxy:RegisterEvent("CHAT_MSG_WHISPER")
|
|
||||||
pfUI.chat.left.panelTop.proxy:SetPoint("TOPRIGHT", pfUI.chat.left, "TOPRIGHT", -20, -6)
|
|
||||||
pfUI.chat.left.panelTop.proxy:SetWidth(12)
|
|
||||||
pfUI.chat.left.panelTop.proxy:SetHeight(12)
|
|
||||||
pfUI.chat.left.panelTop.proxy:SetNormalTexture("Interface\\AddOns\\pfUI\\img\\proxy")
|
|
||||||
pfUI.chat.left.panelTop.proxy:SetAlpha(0.25)
|
|
||||||
for i,v in ipairs({pfUI.chat.left.panelTop.proxy:GetRegions()}) do
|
|
||||||
if v.SetVertexColor then v:SetVertexColor(1,1,1,1) end
|
|
||||||
end
|
|
||||||
|
|
||||||
pfUI.chat.left.panelTop.proxy.enabled = false
|
|
||||||
pfUI.chat.left.panelTop.proxy.forwardto = ""
|
|
||||||
|
|
||||||
function pfUI.chat.left.panelTop.proxy.toggle()
|
|
||||||
if pfUI.chat.left.panelTop.proxy.enabled == true then
|
|
||||||
-- redirect inactive
|
|
||||||
pfUI.chat.left.panelTop.proxy.enabled = false
|
|
||||||
pfUI.chat.left.panelTop.proxy:SetAlpha(0.25)
|
|
||||||
for i,v in ipairs({pfUI.chat.left.panelTop.proxy:GetRegions()}) do
|
|
||||||
if v.SetVertexColor then v:SetVertexColor(1,1,1,1) end
|
|
||||||
end
|
|
||||||
DEFAULT_CHAT_FRAME:AddMessage("Forwarding to |cff33ffcc" .. pfUI.chat.left.panelTop.proxy.forwardto .. "|r has been disabled")
|
|
||||||
elseif pfUI.chat.left.panelTop.proxy.forwardto ~= "" then
|
|
||||||
-- redirect active
|
|
||||||
pfUI.chat.left.panelTop.proxy.enabled = true
|
|
||||||
pfUI.chat.left.panelTop.proxy:SetAlpha(1)
|
|
||||||
for i,v in ipairs({pfUI.chat.left.panelTop.proxy:GetRegions()}) do
|
|
||||||
if v.SetVertexColor then v:SetVertexColor(1,.25,.25,1) end
|
|
||||||
end
|
|
||||||
DEFAULT_CHAT_FRAME:AddMessage("All messages will be forwarded to |cff33ffcc" .. pfUI.chat.left.panelTop.proxy.forwardto)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
pfUI.chat.left.panelTop.proxy:RegisterForClicks("LeftButtonUp", "RightButtonUp")
|
|
||||||
pfUI.chat.left.panelTop.proxy:SetScript("OnClick", function()
|
|
||||||
if arg1 == "RightButton" then
|
|
||||||
if pfUI.chat.left.panelTop.proxyName:IsShown() then
|
|
||||||
pfUI.chat.left.panelTop.proxyName:Hide()
|
|
||||||
else
|
|
||||||
pfUI.chat.left.panelTop.proxyName:Show()
|
|
||||||
end
|
|
||||||
else
|
|
||||||
pfUI.chat.left.panelTop.proxy.toggle()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
pfUI.chat.left.panelTop.proxy:SetScript("OnEvent", function()
|
|
||||||
local forwardto = pfUI.chat.left.panelTop.proxy.forwardto
|
|
||||||
if pfUI.chat.left.panelTop.proxy.enabled == false then return end
|
|
||||||
|
|
||||||
if arg2 ~= UnitName("player") and arg2 ~= forwardto and forwardto ~= UnitName("player") then
|
|
||||||
SendChatMessage("[" .. arg2 .. "]: " .. arg1, "WHISPER", nil, forwardto)
|
|
||||||
end
|
|
||||||
|
|
||||||
if arg2 == forwardto then
|
|
||||||
local isForward, _, name, message = string.find(arg1, "(.*): (.*)")
|
|
||||||
if isForward then
|
|
||||||
SendChatMessage(message, "WHISPER", nil, name)
|
|
||||||
SendChatMessage("-> " .. name, "WHISPER", nil, forwardto)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
pfUI.chat.left.panelTop.proxyName = CreateFrame("Frame", "leftChatWhisperProxyName", UIParent)
|
|
||||||
pfUI.chat.left.panelTop.proxyName:SetPoint("CENTER", 0, 0)
|
|
||||||
pfUI.chat.left.panelTop.proxyName:SetHeight(90)
|
|
||||||
pfUI.chat.left.panelTop.proxyName:SetWidth(200)
|
|
||||||
CreateBackdrop(pfUI.chat.left.panelTop.proxyName, default_border)
|
|
||||||
pfUI.chat.left.panelTop.proxyName:SetScript("OnShow", function()
|
|
||||||
pfUI.chat.left.panelTop.proxyName.input:SetText(pfUI.chat.left.panelTop.proxy.forwardto)
|
|
||||||
end)
|
|
||||||
|
|
||||||
pfUI.chat.left.panelTop.proxyName.caption = pfUI.chat.left.panelTop.proxyName:CreateFontString("Status", "LOW", "GameFontNormal")
|
|
||||||
pfUI.chat.left.panelTop.proxyName.caption:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE")
|
|
||||||
pfUI.chat.left.panelTop.proxyName.caption:SetPoint("TOP", 0, -10)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.caption:SetFontObject(GameFontWhite)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.caption:SetJustifyH("CENTER")
|
|
||||||
pfUI.chat.left.panelTop.proxyName.caption:SetText(T["Forward all whispers to:"])
|
|
||||||
|
|
||||||
pfUI.chat.left.panelTop.proxyName.input = CreateFrame("EditBox", nil, pfUI.chat.left.panelTop.proxyName)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.input:SetTextColor(.2,1.1,1)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.input:SetJustifyH("CENTER")
|
|
||||||
CreateBackdrop(pfUI.chat.left.panelTop.proxyName.input, default_border)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.input:SetPoint("TOPLEFT" , pfUI.chat.left.panelTop.proxyName, "TOPLEFT", 10, -30)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.input:SetPoint("BOTTOMRIGHT" , pfUI.chat.left.panelTop.proxyName, "BOTTOMRIGHT", -10, 40)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.input:SetFontObject(GameFontWhite)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.input:SetAutoFocus(false)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.input:SetText(pfUI.chat.left.panelTop.proxy.forwardto)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.input:SetScript("OnEscapePressed", function(self)
|
|
||||||
pfUI.chat.left.panelTop.proxyName:Hide()
|
|
||||||
end)
|
|
||||||
|
|
||||||
pfUI.chat.left.panelTop.proxyName.okay = CreateFrame("Button", nil, pfUI.chat.left.panelTop.proxyName)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.okay:SetWidth(80)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.okay:SetHeight(20)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.okay:SetPoint("BOTTOMRIGHT", -10, 10)
|
|
||||||
CreateBackdrop(pfUI.chat.left.panelTop.proxyName.okay, default_border)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.okay.text = pfUI.chat.left.panelTop.proxyName.okay:CreateFontString("Status", "LOW", "GameFontNormal")
|
|
||||||
pfUI.chat.left.panelTop.proxyName.okay.text:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE")
|
|
||||||
pfUI.chat.left.panelTop.proxyName.okay.text:ClearAllPoints()
|
|
||||||
pfUI.chat.left.panelTop.proxyName.okay.text:SetAllPoints(pfUI.chat.left.panelTop.proxyName.okay)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.okay.text:SetPoint("CENTER", 0, 0)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.okay.text:SetFontObject(GameFontWhite)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.okay.text:SetText(T["Save"])
|
|
||||||
pfUI.chat.left.panelTop.proxyName.okay:SetScript("OnClick", function()
|
|
||||||
pfUI.chat.left.panelTop.proxy.forwardto = pfUI.chat.left.panelTop.proxyName.input:GetText()
|
|
||||||
if pfUI.chat.left.panelTop.proxy.enabled == true then
|
|
||||||
DEFAULT_CHAT_FRAME:AddMessage("All messages will now be forwarded to |cff33ffcc" .. pfUI.chat.left.panelTop.proxy.forwardto)
|
|
||||||
end
|
|
||||||
pfUI.chat.left.panelTop.proxyName:Hide()
|
|
||||||
end)
|
|
||||||
|
|
||||||
pfUI.chat.left.panelTop.proxyName.abort = CreateFrame("Button", nil, pfUI.chat.left.panelTop.proxyName)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.abort:SetWidth(80)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.abort:SetHeight(20)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.abort:SetPoint("BOTTOMLEFT", 10, 10)
|
|
||||||
CreateBackdrop(pfUI.chat.left.panelTop.proxyName.abort, default_border)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.abort.text = pfUI.chat.left.panelTop.proxyName.abort:CreateFontString("Status", "LOW", "GameFontNormal")
|
|
||||||
pfUI.chat.left.panelTop.proxyName.abort.text:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE")
|
|
||||||
pfUI.chat.left.panelTop.proxyName.abort.text:ClearAllPoints()
|
|
||||||
pfUI.chat.left.panelTop.proxyName.abort.text:SetAllPoints(pfUI.chat.left.panelTop.proxyName.abort)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.abort.text:SetPoint("CENTER", 0, 0)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.abort.text:SetFontObject(GameFontWhite)
|
|
||||||
pfUI.chat.left.panelTop.proxyName.abort.text:SetText(T["Abort"])
|
|
||||||
pfUI.chat.left.panelTop.proxyName.abort:SetScript("OnClick", function()
|
|
||||||
pfUI.chat.left.panelTop.proxyName:Hide()
|
|
||||||
end)
|
|
||||||
|
|
||||||
pfUI.chat.left.panelTop.proxyName:Hide()
|
|
||||||
|
|
||||||
|
|
||||||
pfUI.chat.right = CreateFrame("Frame", "pfChatRight", UIParent)
|
pfUI.chat.right = CreateFrame("Frame", "pfChatRight", UIParent)
|
||||||
pfUI.chat.right:SetFrameStrata("BACKGROUND")
|
pfUI.chat.right:SetFrameStrata("BACKGROUND")
|
||||||
pfUI.chat.right:SetWidth(C.chat.right.width)
|
pfUI.chat.right:SetWidth(C.chat.right.width)
|
||||||
@@ -368,12 +235,12 @@ pfUI:RegisterModule("chat", function ()
|
|||||||
ChatTypeInfo.CHANNEL.sticky = 1
|
ChatTypeInfo.CHANNEL.sticky = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
for i,v in ipairs({ChatFrameMenuButton:GetRegions()}) do
|
ChatFrameMenuButton:Hide()
|
||||||
v:SetAllPoints(ChatFrameMenuButton)
|
ChatMenu:SetClampedToScreen(true)
|
||||||
local _, class = UnitClass("player")
|
CreateBackdrop(ChatMenu)
|
||||||
v:SetTexture(.5,.5,.5, 1)
|
CreateBackdrop(EmoteMenu)
|
||||||
v:SetVertexColor(RAID_CLASS_COLORS[class].r + .3 * .5, RAID_CLASS_COLORS[class].g +.3 * .5, RAID_CLASS_COLORS[class].b +.3 * .5,1)
|
CreateBackdrop(LanguageMenu)
|
||||||
end
|
CreateBackdrop(VoiceMacroMenu)
|
||||||
|
|
||||||
for i=1, NUM_CHAT_WINDOWS do
|
for i=1, NUM_CHAT_WINDOWS do
|
||||||
local frame = _G["ChatFrame"..i]
|
local frame = _G["ChatFrame"..i]
|
||||||
@@ -645,13 +512,6 @@ pfUI:RegisterModule("chat", function ()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
ChatFrameMenuButton:SetNormalTexture("foo")
|
|
||||||
ChatFrameMenuButton:ClearAllPoints()
|
|
||||||
ChatFrameMenuButton:SetParent(pfUI.chat.left.panelTop)
|
|
||||||
ChatFrameMenuButton:SetPoint("TOPRIGHT",-6,-6)
|
|
||||||
ChatFrameMenuButton:SetHeight(6)
|
|
||||||
ChatFrameMenuButton:SetWidth(6)
|
|
||||||
|
|
||||||
pfUI.chat.editbox = CreateFrame("Frame", "pfChatInputBox", UIParent)
|
pfUI.chat.editbox = CreateFrame("Frame", "pfChatInputBox", UIParent)
|
||||||
if C.chat.text.input_height == "0" then
|
if C.chat.text.input_height == "0" then
|
||||||
pfUI.chat.editbox:SetHeight(22)
|
pfUI.chat.editbox:SetHeight(22)
|
||||||
|
|||||||
@@ -0,0 +1,198 @@
|
|||||||
|
pfUI:RegisterModule("chatcopy", function ()
|
||||||
|
-- temporary till the new API is merged
|
||||||
|
local function CreateScrollFrame(name, parent)
|
||||||
|
local f = CreateFrame("ScrollFrame", name, parent)
|
||||||
|
SetAllPointsOffset(f, parent, 2)
|
||||||
|
|
||||||
|
-- create slider
|
||||||
|
f.slider = CreateFrame("Slider", nil, f)
|
||||||
|
f.slider:SetOrientation('VERTICAL')
|
||||||
|
f.slider:SetPoint("TOPLEFT", f, "TOPRIGHT", -7, 0)
|
||||||
|
f.slider:SetPoint("BOTTOMRIGHT", 0, 0)
|
||||||
|
f.slider:SetThumbTexture("Interface\\AddOns\\pfUI\\img\\col")
|
||||||
|
f.slider.thumb = f.slider:GetThumbTexture()
|
||||||
|
f.slider.thumb:SetHeight(50)
|
||||||
|
f.slider.thumb:SetTexture(.3,1,.8,.5)
|
||||||
|
|
||||||
|
f.slider:SetScript("OnValueChanged", function()
|
||||||
|
f:SetVerticalScroll(this:GetValue())
|
||||||
|
f.UpdateScrollState()
|
||||||
|
end)
|
||||||
|
|
||||||
|
f.UpdateScrollState = function()
|
||||||
|
f.slider:SetMinMaxValues(0, f:GetVerticalScrollRange())
|
||||||
|
f.slider:SetValue(f:GetVerticalScroll())
|
||||||
|
|
||||||
|
local m = f:GetHeight()+f:GetVerticalScrollRange()
|
||||||
|
local v = f:GetHeight()
|
||||||
|
local ratio = v / m
|
||||||
|
|
||||||
|
if ratio < 1 then
|
||||||
|
local size = math.floor(v * ratio)
|
||||||
|
f.slider.thumb:SetHeight(size)
|
||||||
|
f.slider:Show()
|
||||||
|
else
|
||||||
|
f.slider:Hide()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
f.Scroll = function(self, step)
|
||||||
|
local step = step or 0
|
||||||
|
|
||||||
|
local current = f:GetVerticalScroll()
|
||||||
|
local max = f:GetVerticalScrollRange()
|
||||||
|
local new = current - step
|
||||||
|
|
||||||
|
if new >= max then
|
||||||
|
f:SetVerticalScroll(max)
|
||||||
|
elseif new <= 0 then
|
||||||
|
f:SetVerticalScroll(0)
|
||||||
|
else
|
||||||
|
f:SetVerticalScroll(new)
|
||||||
|
end
|
||||||
|
|
||||||
|
f:UpdateScrollState()
|
||||||
|
end
|
||||||
|
|
||||||
|
f:EnableMouseWheel(1)
|
||||||
|
f:SetScript("OnMouseWheel", function()
|
||||||
|
this:Scroll(arg1*10)
|
||||||
|
end)
|
||||||
|
|
||||||
|
return f
|
||||||
|
end
|
||||||
|
|
||||||
|
local f = CreateFrame("Frame")
|
||||||
|
f:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||||
|
f:SetScript("OnEvent", function()
|
||||||
|
local combat = {}
|
||||||
|
|
||||||
|
for i=1, _G.NUM_CHAT_WINDOWS do
|
||||||
|
local frame = _G["ChatFrame"..i]
|
||||||
|
local name = frame:GetName()
|
||||||
|
|
||||||
|
local combat = 0
|
||||||
|
for i, msg in pairs(frame.messageTypeList) do
|
||||||
|
if strfind(msg, "SPELL", 1) or strfind(msg, "COMBAT", 1) then
|
||||||
|
combat = combat + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if combat < 5 then
|
||||||
|
-- initialize message cache
|
||||||
|
local history = {}
|
||||||
|
local AddMessage = frame.AddMessage
|
||||||
|
frame.AddMessage = function(self,msg,r,g,b)
|
||||||
|
if r and g and b then
|
||||||
|
local col = string.format("|cff%02x%02x%02x", r*255, g*255, b*255)
|
||||||
|
table.insert(history, 1, col..string.gsub(msg, "|r", col))
|
||||||
|
else
|
||||||
|
table.insert(history, 1, "|cffffffff"..msg)
|
||||||
|
end
|
||||||
|
|
||||||
|
if history[50] then
|
||||||
|
table.remove(history, 50)
|
||||||
|
end
|
||||||
|
AddMessage(self,msg,r,g,b)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- read chat defaults
|
||||||
|
local font, size, flags = frame:GetFont()
|
||||||
|
|
||||||
|
-- build the frames
|
||||||
|
local scroll = CreateScrollFrame(nil, frame)
|
||||||
|
scroll:SetAllPoints(frame)
|
||||||
|
scroll.tex = scroll:CreateTexture(nil, "BACKGROUND")
|
||||||
|
scroll.tex:SetTexture(0,0,0,.95)
|
||||||
|
scroll.tex:SetPoint("TOPLEFT", -3, 3)
|
||||||
|
scroll.tex:SetPoint("BOTTOMRIGHT", 3, -3)
|
||||||
|
scroll:Hide()
|
||||||
|
|
||||||
|
local editbox = CreateFrame("EditBox", "pfChatCopyBox" .. i, scroll)
|
||||||
|
editbox:SetHeight(frame:GetHeight())
|
||||||
|
editbox:SetWidth(frame:GetWidth())
|
||||||
|
editbox:SetAllPoints(scroll)
|
||||||
|
editbox:SetTextColor(1,1,1,1)
|
||||||
|
editbox:SetFontObject(ChatFontNormal)
|
||||||
|
editbox:SetFont(font, size, flags)
|
||||||
|
editbox:SetMaxLetters(99999)
|
||||||
|
editbox:SetAutoFocus(true)
|
||||||
|
editbox:SetMultiLine(true)
|
||||||
|
|
||||||
|
editbox:SetScript("OnEscapePressed", function ()
|
||||||
|
this:ClearFocus()
|
||||||
|
this:GetParent():Hide()
|
||||||
|
end)
|
||||||
|
|
||||||
|
scroll:SetScrollChild(editbox)
|
||||||
|
scroll:SetScript("OnShow", function()
|
||||||
|
editbox:SetText("")
|
||||||
|
for i=50,0,-1 do
|
||||||
|
if history[i] then
|
||||||
|
editbox:Insert("\n" .. history[i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
editbox:SetScript("OnUpdate", function()
|
||||||
|
if not this.count then this.count = 0 end
|
||||||
|
|
||||||
|
scroll:UpdateScrollChildRect()
|
||||||
|
scroll:SetVerticalScroll(scroll:GetVerticalScrollRange())
|
||||||
|
scroll:Scroll()
|
||||||
|
this.count = this.count + 1
|
||||||
|
|
||||||
|
-- the scroll frame takes a while to update
|
||||||
|
if this.count >= 3 then
|
||||||
|
this:SetScript("OnUpdate", nil)
|
||||||
|
this.count = 0
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
local button = CreateFrame("Button", nil, frame)
|
||||||
|
button:RegisterForClicks("LeftButtonUp", "RightButtonUp")
|
||||||
|
if pfUI.chat then
|
||||||
|
button:SetPoint("TOPRIGHT", 0, 24)
|
||||||
|
else
|
||||||
|
button:SetPoint("TOPRIGHT", -3, -3)
|
||||||
|
end
|
||||||
|
|
||||||
|
button:SetFrameStrata("TOOLTIP")
|
||||||
|
button:SetWidth(16)
|
||||||
|
button:SetHeight(16)
|
||||||
|
button:SetAlpha(.25)
|
||||||
|
button.icon = button:CreateTexture(nil,"BACKGROUND")
|
||||||
|
button.icon:SetTexture("Interface\\Buttons\\UI-GuildButton-PublicNote-Disabled")
|
||||||
|
button.icon:SetAllPoints()
|
||||||
|
|
||||||
|
button:SetScript("OnClick", function()
|
||||||
|
if arg1 == "LeftButton" then
|
||||||
|
if scroll:IsShown() then
|
||||||
|
scroll:Hide()
|
||||||
|
button.icon:SetTexture("Interface\\Buttons\\UI-GuildButton-PublicNote-Disabled")
|
||||||
|
else
|
||||||
|
scroll:Show()
|
||||||
|
button.icon:SetTexture("Interface\\Buttons\\UI-GuildButton-PublicNote-Up")
|
||||||
|
end
|
||||||
|
elseif arg1 == "RightButton" then
|
||||||
|
if ChatMenu:IsShown() then
|
||||||
|
ChatMenu:Hide()
|
||||||
|
else
|
||||||
|
ChatMenu:Show()
|
||||||
|
ChatMenu:ClearAllPoints()
|
||||||
|
ChatMenu:SetPoint("BOTTOMLEFT", this, "TOPRIGHT", 0, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
button:SetScript("OnEnter", function()
|
||||||
|
this:SetAlpha(1)
|
||||||
|
end)
|
||||||
|
|
||||||
|
button:SetScript("OnLeave", function()
|
||||||
|
this:SetAlpha(.4)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end)
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
pfUI:RegisterModule("whisperproxy", function ()
|
||||||
|
if not pfUI.chat then return end
|
||||||
|
|
||||||
|
local proxy = CreateFrame("Button", "pfWhisperProxy", pfUI.chat.left.panelTop)
|
||||||
|
proxy:SetPoint("TOPRIGHT", pfUI.chat.left, "TOPRIGHT", -22, -5)
|
||||||
|
proxy:SetWidth(12)
|
||||||
|
proxy:SetHeight(12)
|
||||||
|
proxy.tex = proxy:CreateTexture(nil, "OVERLAY")
|
||||||
|
proxy.tex:SetAllPoints()
|
||||||
|
proxy.tex:SetTexture("Interface\\AddOns\\pfUI\\img\\proxy")
|
||||||
|
proxy.tex:SetVertexColor(.5,.5,.5,1)
|
||||||
|
proxy:SetAlpha(0.4)
|
||||||
|
|
||||||
|
proxy.enabled = false
|
||||||
|
proxy.forwardto = ""
|
||||||
|
|
||||||
|
proxy:SetScript("OnEnter", function()
|
||||||
|
this:SetAlpha(1)
|
||||||
|
end)
|
||||||
|
|
||||||
|
proxy:SetScript("OnLeave", function()
|
||||||
|
this:SetAlpha(.4)
|
||||||
|
end)
|
||||||
|
|
||||||
|
local function ToggleProxy()
|
||||||
|
if proxy.enabled == true then
|
||||||
|
-- redirect inactive
|
||||||
|
proxy.enabled = false
|
||||||
|
proxy.tex:SetVertexColor(.5,.5,.5,1)
|
||||||
|
DEFAULT_CHAT_FRAME:AddMessage(T["Messages are no longer forwarded to:"] .. " |cff33ffcc" .. proxy.forwardto)
|
||||||
|
elseif proxy.forwardto ~= "" then
|
||||||
|
-- redirect active
|
||||||
|
proxy.enabled = true
|
||||||
|
proxy.tex:SetVertexColor(1,.8,0,1)
|
||||||
|
DEFAULT_CHAT_FRAME:AddMessage(T["All messages will be forwarded to:"] .. " |cff33ffcc" .. proxy.forwardto)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
proxy:RegisterForClicks("LeftButtonUp", "RightButtonUp")
|
||||||
|
proxy:SetScript("OnClick", function()
|
||||||
|
if proxy.forwardto == "" or arg1 == "RightButton" then
|
||||||
|
CreateQuestionDialog(T["Please enter a name of a character who should receive your whispers:"],
|
||||||
|
function()
|
||||||
|
pfUI.chat.whisperproxy.forwardto = this:GetParent().input:GetText()
|
||||||
|
ToggleProxy()
|
||||||
|
end,
|
||||||
|
function()
|
||||||
|
pfUI.chat.whisperproxy.forwardto = ""
|
||||||
|
end, true)
|
||||||
|
else
|
||||||
|
ToggleProxy()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
proxy:RegisterEvent("CHAT_MSG_WHISPER")
|
||||||
|
proxy:SetScript("OnEvent", function()
|
||||||
|
local forwardto = proxy.forwardto
|
||||||
|
if proxy.enabled == false then return end
|
||||||
|
|
||||||
|
if arg2 ~= UnitName("player") and arg2 ~= forwardto and forwardto ~= UnitName("player") then
|
||||||
|
SendChatMessage("[" .. arg2 .. "]: " .. arg1, "WHISPER", nil, forwardto)
|
||||||
|
end
|
||||||
|
|
||||||
|
if arg2 == forwardto then
|
||||||
|
local isForward, _, name, message = string.find(arg1, "(.*): (.*)")
|
||||||
|
if isForward then
|
||||||
|
SendChatMessage(message, "WHISPER", nil, name)
|
||||||
|
SendChatMessage("-> " .. name, "WHISPER", nil, forwardto)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- attach module to the pfUI tree
|
||||||
|
pfUI.chat.whisperproxy = proxy
|
||||||
|
end)
|
||||||
@@ -65,6 +65,8 @@ modules\updatenotify.lua
|
|||||||
modules\actionbar.lua
|
modules\actionbar.lua
|
||||||
modules\hunterbar.lua
|
modules\hunterbar.lua
|
||||||
modules\chat.lua
|
modules\chat.lua
|
||||||
|
modules\whisperproxy.lua
|
||||||
|
modules\chatcopy.lua
|
||||||
modules\bubbles.lua
|
modules\bubbles.lua
|
||||||
modules\addons.lua
|
modules\addons.lua
|
||||||
modules\minimap.lua
|
modules\minimap.lua
|
||||||
|
|||||||
Reference in New Issue
Block a user