Skip to content

Commit

Permalink
Merge pull request #3 from Pretzellent/master
Browse files Browse the repository at this point in the history
Update TOC & Implement Region Specific Colours
  • Loading branch information
James Bradbury authored Nov 10, 2021
2 parents a1c19b5 + c96bfc4 commit 2fc3ef7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 51 deletions.
4 changes: 2 additions & 2 deletions RegionFilter.toc
Original file line number Diff line number Diff line change
@@ -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
Expand Down
27 changes: 16 additions & 11 deletions Servers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
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'
30 changes: 8 additions & 22 deletions main.lua
Original file line number Diff line number Diff line change
@@ -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+", "")
Expand Down Expand Up @@ -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
Expand All @@ -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)
hooksecurefunc("LFGListSearchEntry_Update", RF.updateEntries)
19 changes: 3 additions & 16 deletions utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2fc3ef7

Please sign in to comment.