Commit 419dc602 authored by Azilroka's avatar Azilroka

Try this @Merathilis

parent 0eef1145
......@@ -224,13 +224,18 @@ function lib:SendPluginVersionCheck(message)
return
end
local ChatType
local ChatType, Channel
if IsInRaid() then
ChatType = (not IsInRaid(LE_PARTY_CATEGORY_HOME) and IsInRaid(LE_PARTY_CATEGORY_INSTANCE)) and 'INSTANCE_CHAT' or 'RAID'
elseif IsInGroup() then
ChatType = (not IsInGroup(LE_PARTY_CATEGORY_HOME) and IsInGroup(LE_PARTY_CATEGORY_INSTANCE)) and 'INSTANCE_CHAT' or 'PARTY'
elseif IsInGuild() then
ChatType = 'GUILD'
else
local ElvUIGVC = GetChannelName('ElvUIGVC')
if ElvUIGVC and ElvUIGVC > 0 then
ChatType, Channel = 'CHANNEL', ElvUIGVC
elseif IsInGuild() then
ChatType = 'GUILD'
end
end
if not ChatType then
......@@ -245,14 +250,14 @@ function lib:SendPluginVersionCheck(message)
splitMessage = strmatch(strsub(message, 1, maxChar), '.+;')
if splitMessage then -- incase the string is over 250 but doesnt contain `;`
message = gsub(message, '^'..gsub(splitMessage, '([%(%)%.%%%+%-%*%?%[%^%$])','%%%1'), '')
E:Delay(delay, C_ChatInfo_SendAddonMessage, lib.prefix, splitMessage, ChatType)
E:Delay(delay, C_ChatInfo_SendAddonMessage, lib.prefix, splitMessage, ChatType, Channel)
delay = delay + 1
end
end
E:Delay(delay, lib.ClearSendMessageWait)
else
C_ChatInfo_SendAddonMessage(lib.prefix, message, ChatType)
C_ChatInfo_SendAddonMessage(lib.prefix, message, ChatType, Channel)
lib.ClearSendMessageWait()
end
end
......
......@@ -29,10 +29,9 @@ local C_ChatInfo_SendAddonMessage = C_ChatInfo.SendAddonMessage
local UnitGroupRolesAssigned = UnitGroupRolesAssigned
local UnitHasVehicleUI = UnitHasVehicleUI
local GetChannelName = GetChannelName
local JoinPermanentChannel = JoinPermanentChannel
local JoinChannelByName = JoinChannelByName
local UnitLevel, UnitStat, UnitAttackPower = UnitLevel, UnitStat, UnitAttackPower
local UnitFactionGroup = UnitFactionGroup
local GetChannelList = GetChannelList
local IsInRaid, IsInGroup = IsInRaid, IsInGroup
local GetNumGroupMembers = GetNumGroupMembers
local LE_PARTY_CATEGORY_HOME = LE_PARTY_CATEGORY_HOME
......@@ -914,8 +913,13 @@ function E:SendMessage()
C_ChatInfo_SendAddonMessage("ELVUI_VERSIONCHK", E.version, (not IsInRaid(LE_PARTY_CATEGORY_HOME) and IsInRaid(LE_PARTY_CATEGORY_INSTANCE)) and "INSTANCE_CHAT" or "RAID")
elseif IsInGroup() then
C_ChatInfo_SendAddonMessage("ELVUI_VERSIONCHK", E.version, (not IsInGroup(LE_PARTY_CATEGORY_HOME) and IsInGroup(LE_PARTY_CATEGORY_INSTANCE)) and "INSTANCE_CHAT" or "PARTY")
elseif IsInGuild() then
C_ChatInfo_SendAddonMessage("ELVUI_VERSIONCHK", E.version, "GUILD")
else
local ElvUIGVC = GetChannelName('ElvUIGVC')
if ElvUIGVC and ElvUIGVC > 0 then
C_ChatInfo_SendAddonMessage("ELVUI_VERSIONCHK", E.version, "CHANNEL", ElvUIGVC)
elseif IsInGuild() then
C_ChatInfo_SendAddonMessage("ELVUI_VERSIONCHK", E.version, "GUILD")
end
end
SendMessageWaiting = nil
......@@ -939,7 +943,7 @@ local function SendRecieve(_, event, prefix, message, _, sender)
E.recievedOutOfDateMessage = true
end
elseif msg and (msg < ver) then -- Send Message Back if you intercept and are higher revision
elseif msg and (msg < ver) then -- Send Message Back
if not SendMessageWaiting then
SendMessageWaiting = E:Delay(10, E.SendMessage)
end
......@@ -959,6 +963,8 @@ local function SendRecieve(_, event, prefix, message, _, sender)
if not SendMessageWaiting then
SendMessageWaiting = E:Delay(10, E.SendMessage)
end
elseif event == "PLAYER_LOGOUT" then
LeaveChannelByName("ElvUIGVC")
end
end
......@@ -968,8 +974,20 @@ local f = CreateFrame("Frame")
f:RegisterEvent("CHAT_MSG_ADDON")
f:RegisterEvent("GROUP_ROSTER_UPDATE")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:RegisterEvent("PLAYER_LOGOUT")
f:SetScript("OnEvent", SendRecieve)
hooksecurefunc("CreateChatChannelList", function()
if #CHAT_CONFIG_CHANNEL_LIST >= 1 then
if GetChannelName('ElvUIGVC') == 0 and ChatFrame_CanAddChannel() == true then
JoinChannelByName('ElvUIGVC', nil, nil, true)
if not SendMessageWaiting then
SendMessageWaiting = E:Delay(10, E.SendMessage)
end
end
end
end)
function E:UpdateAll(ignoreInstall)
if not self.initialized then
C_Timer_After(1, function() E:UpdateAll(ignoreInstall) end)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment