diff --git a/CHANGES.txt b/CHANGES.txt index 109289d..ae34417 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -50,4 +50,9 @@ Version 1.3.7 - Slim down code Version 1.3.8 - - Auto releasing so CurseBreaker likes me \ No newline at end of file + - Auto releasing so CurseBreaker likes me + +Version 1.4.0 + - Cleaned up some of the server listings + - Reflect changes in the datacentre merges + - New colour scheme (feedback wanted for this) diff --git a/Servers.lua b/Servers.lua index c5929a1..f962794 100644 --- a/Servers.lua +++ b/Servers.lua @@ -2,245 +2,245 @@ local RF = select(2, ...) RF.servers = {} -local na_nyc = {"NA", "NYC"} -local na_chi = {"NA", "CHI"} -local na_phx = {"NA", "PHX"} -local na_la = {"NA", "LA"} +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' + RF.servers = { - -- North America: New York City - AeriePeak = na_nyc, - AltarofStorms = na_nyc, - AlteracMountains = na_nyc, - Andorhal = na_nyc, - Anetheron = na_nyc, - Anvilmar = na_nyc, - Archimonde = na_nyc, - Area52 = na_nyc, - Arygos = na_nyc, - Auchindoun = na_nyc, - Azuremyst = na_nyc, - BlackDragonflight = na_nyc, - BlackwingLair = na_nyc, - BladesEdge = na_nyc, - BloodFurnace = na_nyc, - Coilfang = na_nyc, - Dalaran = na_nyc, - Dalvengyr = na_nyc, - Dawnbringer = na_nyc, - Deathwing = na_nyc, - DemonSoul = na_nyc, - Dentarg = na_nyc, - Doomhammer = na_nyc, - Duskwood = na_nyc, - Executus = na_nyc, - Exodar = na_nyc, - Fizzcrank = na_nyc, - Galakrond = na_nyc, - Ghostlands = na_nyc, - Gnomeregan = na_nyc, - GrizzlyHills = na_nyc, - Haomarush = na_nyc, - Icecrown = na_nyc, - Jaedenar = na_nyc, - KelThuzad = na_nyc, - Khadgar = na_nyc, - Lethon = na_nyc, - MalGanis = na_nyc, - Norgannon = na_nyc, - Onyxia = na_nyc, - Scilla = na_nyc, - Sentinels = na_nyc, - ShatteredHalls = na_nyc, - SteamwheedleCartel = na_nyc, - Tanaris = na_nyc, - Terokkar = na_nyc, - TheScryers = na_nyc, - TheUnderbog = na_nyc, - TheVentureCo = na_nyc, - Thrall = na_nyc, - Turalyon = na_nyc, - Uldaman = na_nyc, - Undermine = na_nyc, - Velen = na_nyc, - Ysera = na_nyc, - Ysondre = na_nyc, - Zangarmarsh = na_nyc, - Zuluhed = na_nyc, - -- North America: Chicago - Agamaggan = na_chi, - Aggramar = na_chi, - Alexstrasza = na_chi, - Alleria = na_chi, - ArgentDawn = na_chi, - Arthas = na_chi, - Azgalor = na_chi, - Azshara = na_chi, - Baelgun = na_chi, - Balnazzar = na_chi, - Blackhand = na_chi, - BleedingHollow = na_chi, - Bloodhoof = na_chi, - BurningBlade = na_chi, - BurningLegion = na_chi, - Chogall = na_chi, - DarkIron = na_chi, - Destromath = na_chi, - Dethecus = na_chi, - Detheroc = na_chi, - Durotan = na_chi, - EarthenRing = na_chi, - Elune = na_chi, - EmeraldDream = na_chi, - Eonar = na_chi, - Eredar = na_chi, - Garona = na_chi, - Gilneas = na_chi, - Gorefiend = na_chi, - Gorgonnash = na_chi, - Greymane = na_chi, - Guldan = na_chi, - Hellscream = na_chi, - Illidan = na_chi, - Kaelthas = na_chi, - Kalecgos = na_chi, - Kargath = na_chi, - KirinTor = na_chi, - LaughingSkull = na_chi, - Lightninghoof = na_chi, - LightningsBlade = na_chi, - Llane = na_chi, - Lothar = na_chi, - Madoran = na_chi, - Maelstrom = na_chi, - Magtheridon = na_chi, - Malfurion = na_chi, - Malygos = na_chi, - Mannoroth = na_chi, - Medivh = na_chi, - Moonrunner = na_chi, - Nazjatar = na_chi, - Ravencrest = na_chi, - Sargeras = na_chi, - Shadowmoon = na_chi, - ShatteredHand = na_chi, - Skullcrusher = na_chi, - Spinebreaker = na_chi, - Staghelm = na_chi, - Stormrage = na_chi, - Stormreaver = na_chi, - Thunderhorn = na_chi, - Thunderlord = na_chi, - Trollbane = na_chi, - TwistingNether = na_chi, - Ursin = na_chi, - Warsong = na_chi, - Whisperwind = na_chi, - Wildhammer = na_chi, - Zuljin = na_chi, - -- North America: Phoenix - Antonidas = na_phx, - Anubarak = na_phx, - BlackwaterRaiders = na_phx, - Bladefist = na_phx, - BoreanTundra = na_phx, - Cairne = na_phx, - CenarionCircle = na_phx, - Cenarius = na_phx, - Darrowmere = na_phx, - DrakTharon = na_phx, - Drenden = na_phx, - EchoIsles = na_phx, - Farstriders = na_phx, - Fenris = na_phx, - Garrosh = na_phx, - Hydraxis = na_phx, - Hyjal = na_phx, - Korialstrasz = na_phx, - Lightbringer = na_phx, - Maiev = na_phx, - Misha = na_phx, - MokNathal = na_phx, - MoonGuard = na_phx, - Nazgrel = na_phx, - Nesingwary = na_phx, - Nordrassil = na_phx, - Queldorei = na_phx, - Ravenholdt = na_phx, - Rivendare = na_phx, - Shandris = na_phx, - Shuhalo = na_phx, - SistersofElune = na_phx, - TheForgottenCoast = na_phx, - Tortheldrin = na_phx, - Uther = na_phx, - Vashj = na_phx, - Winterhoof = na_phx, - WyrmrestAccord = na_phx, - -- North America: Los Angeles - Aegwynn = na_la, - Akama = na_la, - Arathor = na_la, - AzjolNerub = na_la, - Blackrock = na_la, - Bloodscalp = na_la, - Bonechewer = na_la, - Boulderfist = na_la, - Bronzebeard = na_la, - Chromaggus = na_la, - Crushridge = na_la, - Daggerspine = na_la, - Darkspear = na_la, - Draenor = na_la, - Dragonblight = na_la, - Dragonmaw = na_la, - Draka = na_la, - Drakthul = na_la, - Dunemaul = na_la, - Eitrigg = na_la, - EldreThalas = na_la, - Feathermoon = na_la, - Firetree = na_la, - Frostmane = na_la, - Frostwolf = na_la, - Garithos = na_la, - Gurubashi = na_la, - Hakkar = na_la, - KhazModan = na_la, - Kiljaeden = na_la, - Kilrogg = na_la, - Korgath = na_la, - KulTiras = na_la, - Malorne = na_la, - Mugthol = na_la, - Muradin = na_la, - Nathrezim = na_la, - Nerzhul = na_la, - Perenolde = na_la, - Proudmoore = na_la, - Rexxar = na_la, - Runetotem = na_la, - ScarletCrusade = na_la, - Senjin = na_la, - ShadowCouncil = na_la, - Shadowsong = na_la, - SilverHand = na_la, - Sivlermoon = na_la, - Skywall = na_la, - Smolderthorn = na_la, - Spirestone = na_la, - Stonemaul = na_la, - Stormscale = na_la, - Suramar = na_la, - Terenas = na_la, - ThoriumBrotherhood = na_la, - Tichondrius = na_la, - Uldum = na_la, - Veknilash = na_la, - Windrunner = na_la, + -- North America: Old New York City + AeriePeak = na_east, + AltarofStorms = na_east, + AlteracMountains = na_east, + Andorhal = na_east, + Anetheron = na_east, + Anvilmar = na_east, + Archimonde = na_east, + Area52 = na_east, + Arygos = na_east, + Auchindoun = na_east, + Azuremyst = na_east, + BlackDragonflight = na_east, + BlackwingLair = na_east, + BladesEdge = na_east, + BloodFurnace = na_east, + Coilfang = na_east, + Dalaran = na_east, + Dalvengyr = na_east, + Dawnbringer = na_east, + Deathwing = na_east, + DemonSoul = na_east, + Dentarg = na_east, + Doomhammer = na_east, + Duskwood = na_east, + Executus = na_east, + Exodar = na_east, + Fizzcrank = na_east, + Galakrond = na_east, + Ghostlands = na_east, + Gnomeregan = na_east, + GrizzlyHills = na_east, + Haomarush = na_east, + Icecrown = na_east, + Jaedenar = na_east, + KelThuzad = na_east, + Khadgar = na_east, + Lethon = na_east, + MalGanis = na_east, + Norgannon = na_east, + Onyxia = na_east, + Scilla = na_east, + Sentinels = na_east, + ShatteredHalls = na_east, + SteamwheedleCartel = na_east, + Tanaris = na_east, + Terokkar = na_east, + TheScryers = na_east, + TheUnderbog = na_east, + TheVentureCo = na_east, + Thrall = na_east, + Turalyon = na_east, + Uldaman = na_east, + Undermine = na_east, + Velen = na_east, + Ysera = na_east, + Ysondre = na_east, + Zangarmarsh = na_east, + Zuluhed = na_east, + -- North America: Old Chicago + Agamaggan = na_east, + Aggramar = na_east, + Alexstrasza = na_east, + Alleria = na_east, + ArgentDawn = na_east, + Arthas = na_east, + Azgalor = na_east, + Azshara = na_east, + Baelgun = na_east, + Balnazzar = na_east, + Blackhand = na_east, + BleedingHollow = na_east, + Bloodhoof = na_east, + BurningBlade = na_east, + BurningLegion = na_east, + Chogall = na_east, + DarkIron = na_east, + Destromath = na_east, + Dethecus = na_east, + Detheroc = na_east, + Durotan = na_east, + EarthenRing = na_east, + Elune = na_east, + EmeraldDream = na_east, + Eonar = na_east, + Eredar = na_east, + Garona = na_east, + Gilneas = na_east, + Gorefiend = na_east, + Gorgonnash = na_east, + Greymane = na_east, + Guldan = na_east, + Hellscream = na_east, + Illidan = na_east, + Kaelthas = na_east, + Kalecgos = na_east, + Kargath = na_east, + KirinTor = na_east, + LaughingSkull = na_east, + Lightninghoof = na_east, + LightningsBlade = na_east, + Llane = na_east, + Lothar = na_east, + Madoran = na_east, + Maelstrom = na_east, + Magtheridon = na_east, + Malfurion = na_east, + Malygos = na_east, + Mannoroth = na_east, + Medivh = na_east, + Moonrunner = na_east, + Nazjatar = na_east, + Ravencrest = na_east, + Sargeras = na_east, + Shadowmoon = na_east, + ShatteredHand = na_east, + Skullcrusher = na_east, + Spinebreaker = na_east, + Staghelm = na_east, + Stormrage = na_east, + Stormreaver = na_east, + Thunderhorn = na_east, + Thunderlord = na_east, + Trollbane = na_east, + TwistingNether = na_east, + Ursin = na_east, + Warsong = na_east, + Whisperwind = na_east, + Wildhammer = na_east, + Zuljin = na_east, + -- North America: Old Phoenix + Antonidas = na_west, + Anubarak = na_west, + BlackwaterRaiders = na_west, + Bladefist = na_west, + BoreanTundra = na_west, + Cairne = na_west, + CenarionCircle = na_west, + Cenarius = na_west, + Darrowmere = na_west, + DrakTharon = na_west, + Drenden = na_west, + EchoIsles = na_west, + Farstriders = na_west, + Fenris = na_west, + Garrosh = na_west, + Hydraxis = na_west, + Hyjal = na_west, + Korialstrasz = na_west, + Lightbringer = na_west, + Maiev = na_west, + Misha = na_west, + MokNathal = na_west, + MoonGuard = na_west, + Nazgrel = na_west, + Nesingwary = na_west, + Nordrassil = na_west, + Queldorei = na_west, + Ravenholdt = na_west, + Rivendare = na_west, + Shandris = na_west, + Shuhalo = na_west, + SistersofElune = na_west, + TheForgottenCoast = na_west, + Tortheldrin = na_west, + Uther = na_west, + Vashj = na_west, + Winterhoof = na_west, + WyrmrestAccord = na_west, + -- North America: Old Los Angeles + Aegwynn = na_west, + Akama = na_west, + Arathor = na_west, + AzjolNerub = na_west, + Blackrock = na_west, + Bloodscalp = na_west, + Bonechewer = na_west, + Boulderfist = na_west, + Bronzebeard = na_west, + Chromaggus = na_west, + Crushridge = na_west, + Daggerspine = na_west, + Darkspear = na_west, + Draenor = na_west, + Dragonblight = na_west, + Dragonmaw = na_west, + Draka = na_west, + Drakthul = na_west, + Dunemaul = na_west, + Eitrigg = na_west, + EldreThalas = na_west, + Feathermoon = na_west, + Firetree = na_west, + Frostmane = na_west, + Frostwolf = na_west, + Garithos = na_west, + Gurubashi = na_west, + Hakkar = na_west, + KhazModan = na_west, + Kiljaeden = na_west, + Kilrogg = na_west, + Korgath = na_west, + KulTiras = na_west, + Malorne = na_west, + Mugthol = na_west, + Muradin = na_west, + Nathrezim = na_west, + Nerzhul = na_west, + Perenolde = na_west, + Proudmoore = na_west, + Rexxar = na_west, + Runetotem = na_west, + ScarletCrusade = na_west, + Senjin = na_west, + ShadowCouncil = na_west, + Shadowsong = na_west, + SilverHand = na_west, + Sivlermoon = na_west, + Skywall = na_west, + Smolderthorn = na_west, + Spirestone = na_west, + Stonemaul = na_west, + Stormscale = na_west, + Suramar = na_west, + Terenas = na_west, + ThoriumBrotherhood = na_west, + Tichondrius = na_west, + Uldum = na_west, + Veknilash = na_west, + Windrunner = na_west, -- Brazillian Azralon = br, Nemesis = br, @@ -270,272 +270,8 @@ RF.servers = { ---- Posts ---- RF.posts = {} -- NA posts -RF.posts.na_nyc_post = "|cff00ffff[Region Filter]:|r You are an on an |cffFF6EB4NA-NYC|r Server" -RF.posts.na_la_post = "|cff00ffff[Region Filter]:|r You are an on an |cffFF6EB4NA-LA|r Server" -RF.posts.na_chicago_post = "|cff00ffff[Region Filter]:|r You are an on an |cffFF6EB4NA-CHI|r Server" -RF.posts.na_phoenix_post = "|cff00ffff[Region Filter]:|r You are an on an |cffFF6EB4NA-PHX|r Server" -RF.posts.oc_post = "|cff00ffff[Region Filter]:|r You are an on an |cffFF6EB4OC|r Server" -RF.posts.br_post = "|cff00ffff[Region Filter]:|r You are an on a |cffFF6EB4BR|r Server" -RF.posts.la_post = "|cff00ffff[Region Filter]:|r You are an on an |cffFF6EB4LA|r Server" - ----- Categorisation Strings ---- --- These are used to differentiate the data centres and regions in the text labels for each LFG entry -RF.cat = {} -RF.cat.home = 'HOME' -RF.cat.na_nyc_id = 'NA-NYC' -RF.cat.na_la_id = 'NA-LA' -RF.cat.na_phx_id = 'NA-PHX' -RF.cat.na_chi_id = 'NA-CHI' -RF.cat.br = 'BR' -RF.cat.la = 'LA' -RF.cat.oc = 'OC' - --- -- EU posts --- RF.posts.en_post = |cff00ffff[Region Filter]:|r You are an on an |cffFF6EB4EN|r Server --- RF.posts.de_post = |cff00ffff[Region Filter]:|r You are an on a |cffFF6EB4DE|r Server --- RF.posts.fr_post = |cff00ffff[Region Filter]:|r You are an on an |cffFF6EB4FR|r Server --- RF.posts.it_post = |cff00ffff[Region Filter]:|r You are an on an |cffFF6EB4IT|r Server --- RF.posts.ru_post = |cff00ffff[Region Filter]:|r You are an on an |cffFF6EB4RU|r Server --- RF.posts.es_post = |cff00ffff[Region Filter]:|r You are an on an |cffFF6EB4ES|r Server - --- RF.servers.eu_en_realms = { --- KulTiras, --- Alonsus, --- Anachronos, --- Bronzebeard, --- AeriePeak, --- BladesEdge, --- Veknilash, --- Eonar, --- Wildhammer, --- Thunderhorn, --- Kilrogg, --- Runetotem, --- Nagrand, --- Aggramar, --- Hellscream, --- Hellfire, --- Arathor, --- AzjolNerub, --- QuelThalas, --- Ghostlands, --- Dragonblight, --- Darkspear, --- Terokkar, --- Saurfang, --- Aszune, --- Shadowsong, --- Khadgar, --- Bloodhoof, --- BronzeDragonflight, --- Nordrassil, --- Lightbringer, --- Mazrigos, --- Azuremyst, --- Stormrage, --- Doomhammer, --- Turalyon, --- EmeraldDream, --- Terenas, --- Korgall, --- Bloodfeather, --- Executus, --- BurningSteppes, --- ShatteredHand, --- ShatteredHalls, --- Balnazzar, --- AhnQiraj, --- Trollbane, --- Talnivarr, --- Chromaggus, --- Boulderfist, --- Daggerspine, --- LaughingSkull, --- Sunstrider, --- Emeriss, --- Agamaggan, --- Hakkar, --- Crushridge, --- Bloodscalp, --- TwilightsHammer, --- GrimBatol, --- Aggra, --- Karazhan, --- LightningsBlade, --- Deathwing, --- TheMaesltrom, --- Auchindoun, --- Dunemaul, --- Jaedenar, --- Dragonmaw, --- Spinebreaker, --- Haomarush, --- Vashj, --- Stormreaver, --- Zenedar, --- Bladefist, --- Frostwhisper, --- Xavius, --- Skullcrusher, --- AlAkir, --- Darksorrow, --- Genjuros, --- Neptulon, --- Drakthul, --- BurningBlade, --- Dentarg, --- TarrenMill, --- Moonglade, --- TheShatar, --- SteamwheedleCartel, --- DarkmoonFaire, --- EarthenRing, --- ScarshieldLegion, --- Ravenholdt, --- TheVentureCo, --- Sporeggar, --- DefiasBrotherhood, --- } - --- RF.servers.eu_fr_realms = { --- Chantséternels, --- Voljin, --- Elune, --- Varimathras, --- MarécagedeZangar, --- Dalaran, --- Eitrigg, --- Krasus, --- Suramar, --- Medivh, --- Uldaman, --- DrekThar, --- Arakarahm, --- ThrokFeroth, --- Rashgarroth, --- KaelThas, --- Naxxramas, --- Arathi, --- TemplerNoir, --- Illidan, --- Sargeras, --- Garona, --- Nerzhul, --- EldreThalas, --- Chogall, --- Sinstralis, --- ConfrerieduThorium, --- LesClairvoyants, --- LesSentinelles, --- LaCroisadeécarlate, --- CultedelaRivenoire, --- ConseildesOmbres, --- } - --- RF.servers.eu_de_realms = { --- Gilneas, --- Ulduar, --- Garrosh, --- Shattrath, --- Nozdormu, --- Nethersturm, --- Alextrasza, --- UnGoro, --- Area52, --- Senjin, --- Ambossar, --- Kargath, --- Ysera, --- Malorne, --- Malygos, --- Malfurion, --- Tichondrius, --- Lordaeron, --- Arygos, --- KhazGoroth, --- Teldrassil, --- Perenolde, --- Durotan, --- Tirion, --- Lothar, --- Baelgun, --- Norgannon, --- DunMorogh, --- Rexxar, --- Alleria, --- Proudmoore, --- Madmortem, --- Nazjatar, --- Dalvengyr, --- Frostmourne, --- Zuluhed, --- Anubarak, --- Arthas, --- Veklor, --- Blutkessel, --- KelThuzad, --- Wrathbringer, --- Dethecus, --- Terrordar, --- Mugthol, --- Theradras, --- Onyxia, --- Echsenkessel, --- Taerar, --- MalGanas, --- Anetheron, --- FestungderStürme, --- Rajaxx, --- Guldan, --- Nathrezim, --- Kiljaeden, --- Nefarian, --- Nerathor, --- Mannoroth, --- Destromath, --- Gorgonnash, --- Azshara, --- Kragjin, --- DieewigeWacht, --- DieSilberneHand, --- Todeswache, --- ZirkeldesCenarius, --- DerMithrilorden, --- DerRatvonDalaran, --- Forscherliga, --- DieNachtwache, --- DieArguswacht, --- DieTodeskrallen, --- DasSyndikat, --- DerAbyssischeRat, --- KultderVerdammten, --- DasKonsortium, --- } - --- RF.servers.eu_es_realms = { --- Exodar, --- Minahonda, --- ColinasPardas, --- Tyrande, --- LosErrantes, --- Zuljin, --- Sanguino, --- Shendralar, --- Uldum, --- } - --- RF.servers.eu_ru_realms = { --- Подземье, --- Разувий, --- Корольлич, --- Седогрив, --- Пиратскаябухта, --- Ткачсмерти, --- Гром, --- Термоштепсел, --- } - --- RF.servers.eu_it_realms = { --- WellofEternity, --- Nemsis, --- } \ No newline at end of file +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 diff --git a/main.lua b/main.lua index 18e57d1..c9d01ea 100644 --- a/main.lua +++ b/main.lua @@ -1,44 +1,54 @@ local RF = select(2, ...) local servers = RF.servers local posts = RF.posts -local cat = RF.cat +RF.version = "1.4.0" +RF.togRemove = false --- TODO make the removeEntries subcomponents functions for simpler code --- TODO GUI --- By default filter outside data centers to yes -- -RF.togRemove = true - -local realm_unsubbed = GetRealmName() -local spaced_realm = string.gsub(realm_unsubbed, "%s+", "") +local spaced_realm = string.gsub(GetRealmName(), "%s+", "") RF.myRealm = string.gsub(spaced_realm, "'", "") ---- Set variables for realm/data-centre info ---- +RF.info = servers[RF.myRealm] +RF.region, RF.dataCentre = RF.info[1], RF.info[2] -RF:setRegionRealmLabel(RF.myRealm) - ----- Removing Enrties when togRemove is enabled -function RF.removeEntries(results) - if RF.togRemove then - for idx=1, #results do - local resultID = results[idx] - local searchResults = C_LFGList.GetSearchResultInfo(resultID) - local activitiyID1 = searchResults.activityID - local leaderName = searchResults.leaderName +if RF.region == 'NA' then + if RF.dataCentre == 'EAST' then + RF.postType = posts.na_east_post + end - if leaderName ~= nil then -- Filter out nil entries from LFG Pane - local name, realm = RF:sanitiseName(leaderName) - local info = servers[realm] - if info ~= nil then - local region = info[1] - if RF.region ~= region then - table.remove(results, idx) - end - end - end - table.sort(results) - end + if RF.dataCentre == 'WEST' then + RF.postType = posts.na_west_post end end +if RF.region == 'OC' then RF.postType = posts.oc_post end +if RF.region == 'LA' then RF.postType = posts.la_post end +if RF.region == 'BR' then RF.postType = posts.br_post end +---- Removing Enrties when togRemove is enabled +-- function RF.removeEntries(results) +-- if RF.togRemove then +-- for i=1, #results do +-- local resultID = results[i] +-- local searchResults = C_LFGList.GetSearchResultInfo(resultID) + +-- local leaderName = searchResults.leaderName + +-- if leaderName ~= nil then -- Filter out nil entries from LFG Pane +-- local name, realm = RF:sanitiseName(leaderName) +-- local info = servers[realm] +-- if info ~= nil then +-- local region = info[1] +-- if RF.region ~= region then +-- table.remove(results, i) +-- end +-- end +-- end +-- end +-- end +-- table.sort(results) +-- LFGListFrame.SearchPanel.totalResults = #results +-- return true +-- end + ---- Updating the text of entries function RF.updateEntries(results) local searchResults = C_LFGList.GetSearchResultInfo(results.resultID) @@ -49,92 +59,63 @@ function RF.updateEntries(results) if leaderName ~= nil then -- Filter out nil entries from LFG Pane local name, realm = RF:sanitiseName(leaderName) local info = servers[realm] - if info ~= nil then + if info then local region, dataCentre = info[1], info[2] - - if RF.region == 'NA' then -- if your own region is NA colour code NA servers appropriately - if region == 'NA' then - if dataCentre == 'NYC' then - if RF.dataCentre == dataCentre then -- if your personal data centre matches the queried leader/realm name (colour coding for home data centres) - results.ActivityName:SetText("|cFF00CCFF["..cat.na_nyc_id.."]|r " .. activityName) - else - results.ActivityName:SetText("|cFFFFFF00["..cat.na_nyc_id.."]|r " .. activityName) - end - results.ActivityName:SetTextColor(0, 1, 0) - end - - if dataCentre == 'PHX' then - if RF.dataCentre == dataCentre then - results.ActivityName:SetText("|cFF00CCFF["..cat.na_phx_id.."]|r " .. activityName) - else - results.ActivityName:SetText("|cFFFFFF00["..cat.na_phx_id.."]|r " .. activityName) - end - results.ActivityName:SetTextColor(0, 1, 0) - end - - if dataCentre == 'LA' then - if RF.dataCentre == dataCentre then - results.ActivityName:SetText ("|cFF00CCFF["..cat.na_la_id.."]|r " .. activityName) - else - results.ActivityName:SetText ("|cFFFFFF00["..cat.na_la_id.."]|r " .. activityName) - end - results.ActivityName:SetTextColor(0, 1, 0) - end - - if dataCentre == 'CHI' then - if RF.dataCentre == dataCentre then - results.ActivityName:SetText("|cFF00CCFF["..cat.na_chi_id.."]|r " .. activityName) - else - results.ActivityName:SetText("|cFFFFFF00["..cat.na_chi_id.."]|r " .. activityName) - end - results.ActivityName:SetTextColor(0, 1, 0) - end - end - end - - -- non-NA realms - if RF.region == 'BR' and region == 'BR' then - results.ActivityName:SetText("|cFFFFFF00["..cat.br.."]|r " .. activityName) - results.ActivityName:SetTextColor(0, 1, 0) - end - - if RF.region == 'LA' and region == 'LA' then - results.ActivityName:SetText("|cFFFFFF00["..cat.la.."]|r " .. activityName) - results.ActivityName:SetTextColor(0, 1, 0) - end - - if RF.region == 'OC' and region == 'OC' then - results.ActivityName:SetText("|cFFFFFF00["..cat.oc.."]|r " .. activityName) - results.ActivityName:SetTextColor(0, 1, 0) + 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) + ) + else + results.ActivityName:SetText( + RF:regionTag( + RF.region, + region, + region, + activityName, + nil, nil + ) + ) + results.ActivityName:SetTextColor( + RF:dungeonText(RF.region, region) + ) end end end end -SLASH_RFILTER1 = "/rfilter" -SlashCmdList["RFILTER"] = function(msg) - if RF.togRemove == true then - RF.togRemove = false - print('|cff00ffff[Region Filter]: |cffFF6EB4 Not filtering outside regions') - else - RF.togRemove = true - print('|cff00ffff[Region Filter]: |cffFF6EB4 Filtering outside regions') - end - LFGListSearchPanel_UpdateResultList (LFGListFrame.SearchPanel) - LFGListSearchPanel_UpdateResults (LFGListFrame.SearchPanel) -end +-- SLASH_RFILTER1 = "/rfilter" +-- SlashCmdList["RFILTER"] = function(msg) +-- if RF.togRemove then +-- print('|cff00ffff[Region Filter]: |cffFF6EB4 Not filtering outside regions') +-- else +-- print('|cff00ffff[Region Filter]: |cffFF6EB4 Filtering outside regions') +-- end +-- RF.togRemove = not RF.togRemove +-- LFGListSearchPanel_UpdateResultList (LFGListFrame.SearchPanel) +-- LFGListSearchPanel_UpdateResults (LFGListFrame.SearchPanel) +-- end ---- Print When Loaded ---- local welcomePrompt = CreateFrame("Frame") welcomePrompt:RegisterEvent("PLAYER_LOGIN") welcomePrompt:SetScript("OnEvent", function(_, event) if event == "PLAYER_LOGIN" then - print("|cff00ffff[Region Filter]|r |cffffcc00Version 1.3.9|r. If there any bugs please report them at https://github.com/jamesb93/RegionFilter") + 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.removeEntries) +-- hooksecurefunc("LFGListUtil_SortSearchResults", RF.sortEntries) hooksecurefunc("LFGListSearchEntry_Update", RF.updateEntries) \ No newline at end of file diff --git a/utils.lua b/utils.lua index 1becb25..bc5c332 100644 --- a/utils.lua +++ b/utils.lua @@ -1,5 +1,34 @@ local RF = select(2, ...) +RF.consolePrefix = "|cff00ffff[Region Filter]:|r " + +function RF:regionTag(playerRegion, listRegion, label, activity, playerDC, listDC) + -- 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 + +function RF:dungeonText(playerRegion, listRegion) + -- Colours the activity name if its in an ideal region + if playerRegion == listRegion then + return 0, 1, 1 + else + return 0.75, 0.75, 0.75 + end +end + function RF:sanitiseName(leaderName) -- returns name, realm when passed a name-realm full name if string.match(leaderName, "-") then