From c96bfc4f9983804dd6d5669f3c5fafc943562e82 Mon Sep 17 00:00:00 2001 From: Pretzel Date: Wed, 10 Nov 2021 15:19:57 +1100 Subject: [PATCH] Update TOC & Implement Region Specific Colours --- RegionFilter.toc | 4 ++-- Servers.lua | 27 ++++++++++++++++----------- main.lua | 30 ++++++++---------------------- utils.lua | 19 +++---------------- 4 files changed, 29 insertions(+), 51 deletions(-) diff --git a/RegionFilter.toc b/RegionFilter.toc index f629b17..205f69b 100644 --- a/RegionFilter.toc +++ b/RegionFilter.toc @@ -1,7 +1,7 @@ -## Interface: 80300 +## Interface: 90105 ## Title: Region Filter ## Notes: Tags groups in the native LFG search if they are from your server and data-centre -## Version: 1.4.0 +## Version: 1.5.0 utils.lua servers.lua diff --git a/Servers.lua b/Servers.lua index f962794..6240bf8 100644 --- a/Servers.lua +++ b/Servers.lua @@ -2,13 +2,18 @@ local RF = select(2, ...) RF.servers = {} -local na_east = {"NA", "EAST"} -local na_west = {"NA", "WEST"} -local br = {"BR", nil} -local la = {"LA", nil} -local oc = {"OC", nil} -local postColour = ' |cffFF6EB4' +local na_east_colour = '|cff00FF98' +local na_west_colour = '|cffAAD372' +local br_colour = '|cffFFFFFF' +local la_colour = '|cffFF7D0A' +local oc_colour = '|cffC79C6E' + +local na_east = {"NA", "EAST", na_east_colour} +local na_west = {"NA", "WEST", na_west_colour} +local br = {"BR", nil, br_colour} +local la = {"LA", nil, la_colour} +local oc = {"OC", nil, oc_colour} RF.servers = { -- North America: Old New York City @@ -270,8 +275,8 @@ RF.servers = { ---- Posts ---- RF.posts = {} -- NA posts -RF.posts.na_east_post = RF.consolePrefix..'You are an on an'..postColour..'NA-EAST|r Server' -RF.posts.na_west_post = RF.consolePrefix..'You are an on an'..postColour..'NA-WEST|r Server' -RF.posts.oc_post = RF.consolePrefix..'You are an on an'..postColour..'OC|r Server' -RF.posts.la_post = RF.consolePrefix..'You are an on an'..postColour..'LA|r Server' -RF.posts.br_post = RF.consolePrefix..'You are an on a'..postColour..'BR|r Server' \ No newline at end of file +RF.posts.na_east_post = RF.consolePrefix..'You are an on an '..na_east_colour..'NA-EAST|r Server' +RF.posts.na_west_post = RF.consolePrefix..'You are an on an '..na_west_colour..'NA-WEST|r Server' +RF.posts.oc_post = RF.consolePrefix..'You are an on an '..oc_colour..'OC|r Server' +RF.posts.la_post = RF.consolePrefix..'You are an on an '..la_colour..'LA|r Server' +RF.posts.br_post = RF.consolePrefix..'You are an on a '..br_colour..'BR|r Server' \ No newline at end of file diff --git a/main.lua b/main.lua index c9d01ea..aacdd9b 100644 --- a/main.lua +++ b/main.lua @@ -1,7 +1,7 @@ local RF = select(2, ...) local servers = RF.servers local posts = RF.posts -RF.version = "1.4.0" +RF.version = "1.5.0" RF.togRemove = false local spaced_realm = string.gsub(GetRealmName(), "%s+", "") @@ -60,35 +60,22 @@ function RF.updateEntries(results) local name, realm = RF:sanitiseName(leaderName) local info = servers[realm] if info then - local region, dataCentre = info[1], info[2] + local region, dataCentre, regionColour = info[1], info[2], info[3] if region == "NA" then - results.ActivityName:SetText( - RF:regionTag( - RF.region, - region, - region..'-'..dataCentre, - activityName, - RF.dataCentre, - dataCentre - ) - ) - results.ActivityName:SetTextColor( - RF:dungeonText(RF.region, region) - ) + regionLabel = region..'-'..dataCentre; else + regionLabel = region + end results.ActivityName:SetText( RF:regionTag( - RF.region, - region, - region, + regionLabel, activityName, - nil, nil + regionColour ) ) results.ActivityName:SetTextColor( RF:dungeonText(RF.region, region) ) - end end end end @@ -112,10 +99,9 @@ welcomePrompt:RegisterEvent("PLAYER_LOGIN") welcomePrompt:SetScript("OnEvent", function(_, event) if event == "PLAYER_LOGIN" then print("|cff00ffff[Region Filter]|r |cffffcc00Version "..RF.version.."|r. If there any bugs please report them at https://github.com/jamesb93/RegionFilter") - print("|cff00ffff[Region Filter]|r If possible, stop using CurseForge (soon/now to be Overwolf) and try CurseBreaker https://www.github.com/AcidWeb/CurseBreaker.") print(RF.postType) end end) -- hooksecurefunc("LFGListUtil_SortSearchResults", RF.sortEntries) -hooksecurefunc("LFGListSearchEntry_Update", RF.updateEntries) \ No newline at end of file +hooksecurefunc("LFGListSearchEntry_Update", RF.updateEntries) \ No newline at end of file diff --git a/utils.lua b/utils.lua index bc5c332..cd642b8 100644 --- a/utils.lua +++ b/utils.lua @@ -2,23 +2,10 @@ local RF = select(2, ...) RF.consolePrefix = "|cff00ffff[Region Filter]:|r " -function RF:regionTag(playerRegion, listRegion, label, activity, playerDC, listDC) +function RF:regionTag(label, activity, regionColour) -- Creates and colours the REGION tag - local colour = '|cFFA9A9A9[' - - if playerDC ~= nil and listDC ~= nil then -- if we're talking murican - if playerRegion == listRegion and playerDC == listDC then - colour = '|cFFFF69B4[' - elseif playerRegion == listRegion and playerDC ~= listDC then - colour = '|cFFFF0000[' - end - else - if playerRegion == listRegion then - colour = '|cFFFF69B4[' - end - end - return colour..label..']|r '..activity -end + return regionColour..'['..label..']|r '..activity +en function RF:dungeonText(playerRegion, listRegion) -- Colours the activity name if its in an ideal region