diff --git a/LookingForGuildBrowseSort/LookingForGuildBrowseSort.lua b/LookingForGuildBrowseSort/LookingForGuildBrowseSort.lua index 0ae7d48..74deac7 100755 --- a/LookingForGuildBrowseSort/LookingForGuildBrowseSort.lua +++ b/LookingForGuildBrowseSort/LookingForGuildBrowseSort.lua @@ -10,6 +10,10 @@ local LFGBSPrivate = SizeStat = {}, }; +local function Message(s) + DEFAULT_CHAT_FRAME:AddMessage(s); +end + -- -- @@ -50,8 +54,8 @@ local GUILDSORT = "SCORE"; local Cmd; -- forward declaration -local function MapReset() - -- DEFAULT_CHAT_FRAME:AddMessage("Recruiting guilds: preparing for list update..."); +local function MapReset(sSrc) + -- Message("Recruiting guilds: preparing for list update... (" .. tostring(sSrc) .. ")"); if ((GUILDSORT or "SCORE") == "SCORE") then GUILDNAMESOLD = GUILDNAMES; GUILDSCOREOLD = GUILDSCORE; @@ -83,7 +87,7 @@ function LFGBSPrivate.CommentPlayer.Show() if (sOption) then -- roles are not in CHOICES_SHORTLONG local sTextKey = _G["GUILD_INTEREST_" .. sOption] or _G["GUILD_AVAILABILITY_" .. sOption]; if (not sTextKey) then - DEFAULT_CHAT_FRAME:AddMessage("LFGBS::CPS: " .. sOption .. " => !Group"); + Message("LFGBS::CPS: " .. sOption .. " => !Group"); else local sOptionCamel = strupper(strsub(sOption, 1, 1)) .. strlower(strsub(sOption, 2)); local iLen = strlen(sOptionCamel); @@ -94,7 +98,7 @@ function LFGBSPrivate.CommentPlayer.Show() local oButton = _G["LookingForGuild" .. sOptionCamel .. "Text"] or _G["LookingForGuild" .. sOptionCamel .. "ButtonText"]; if (not oButton) then - DEFAULT_CHAT_FRAME:AddMessage("LFGBS::CPS: " .. sOptionCamel .. " => !Button"); + Message("LFGBS::CPS: " .. sOptionCamel .. " => !Button"); else local sText = oButton:GetText(); if (oMUST[sOption]) then @@ -297,14 +301,20 @@ function LFGBSPrivate.CommentPlayer.Update() end end -function LFGBSPrivate.CommentPlayer.ButtonToggle(self) - if (not self:GetChecked()) then - -- checkboxes: autotoggle MUST|MUSTN'T on transition on->off +function LFGBSPrivate.CommentPlayer.ButtonToggle(self, btn, holding) + -- hooked, so called after default handler + -- Message("Btn:OnClick(" .. btn .. ")"); + if (btn == "RightButton") then + -- checkboxes: toggle MUST|MUSTN'T local sName = self:GetName(); local sLong = strsub(sName, 16, -7); - -- DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] CPU: " .. sLong); sLong = strupper(sLong); Cmd("toggle " .. sLong, true); + + -- undo change from regular handler + self:Click("LeftButton"); + SetLookingForGuildSettings(self:GetID(), self:GetChecked()); + MapReset(); end end @@ -631,7 +641,7 @@ local function MapCreateByScore() sTotals = sTotals .. " - tracked unlisted: " .. (iTrackedMax - nTrackedTotal); end - DEFAULT_CHAT_FRAME:AddMessage(sTotals); + Message(sTotals); end end @@ -742,12 +752,12 @@ end local function GetRecruitingGuildSettings_ordered(iNum) local _iNum = MapDo(iNum); if (not _iNum) then - DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] GRGS: Index " .. iNum .. " -> nil"); + Message("[LFGBS] GRGS: Index " .. iNum .. " -> nil"); return GetRecruitingGuildSettings_original(iNum); else local bQuetes = GetRecruitingGuildSettings_original(_iNum); if (bQuetes == nil) then - DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] GRGS: Index " .. _iNum .. " (from " .. iNum .. ") -> nil"); + Message("[LFGBS] GRGS: Index " .. _iNum .. " (from " .. iNum .. ") -> nil"); return GetRecruitingGuildSettings_original(iNum); end end @@ -758,12 +768,12 @@ end local function GetRecruitingGuildInfo_ordered(iNum) local _iNum = MapDo(iNum); if (not _iNum) then - DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] GRGI: Index " .. iNum .. " -> nil"); + Message("[LFGBS] GRGI: Index " .. iNum .. " -> nil"); return GetRecruitingGuildInfo_original(iNum); else local sName = GetRecruitingGuildInfo_original(_iNum); if (sName == nil) then - DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] GRGI: Index " .. _iNum .. " (from " .. iNum .. ") -> nil"); + Message("[LFGBS] GRGI: Index " .. _iNum .. " (from " .. iNum .. ") -> nil"); return GetRecruitingGuildInfo_original(iNum); end end @@ -809,7 +819,7 @@ local function GuildnameColorize() if (oFrame and (type(oFrame) == "table") and (type(oFrame.GetName) == "function")) then local sName = oFrame:GetName(); if (strsub(sName, 1, 41) == "LookingForGuildBrowseFrameContainerButton") then - -- DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] Refreshing tooltip..."); + -- Message("[LFGBS] Refreshing tooltip..."); local OnLeave = oFrame:GetScript("OnLeave"); if (type(OnLeave) == "function") then OnLeave(oFrame); @@ -822,7 +832,7 @@ local function GuildnameColorize() end end - -- DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] GnC -> " .. strsub(sIndices, 2)); + -- Message("[LFGBS] GnC -> " .. strsub(sIndices, 2)); end local bLookingForGuildGuild_ShowTooltip_Hooked; @@ -881,7 +891,7 @@ local function LookingForGuildGuild_ShowTooltip_Hook(self) HIGHLIGHT_FONT_COLOR_CODE .. strsub(sLine, iPosB + 1); end else - -- DEFAULT_CHAT_FRAME:AddMessage("LFGBS::LFGG_ST: " .. sPrefix .. "::" .. sSub .. " !€ " .. sLine); + -- Message("LFGBS::LFGG_ST: " .. sPrefix .. "::" .. sSub .. " !€ " .. sLine); -- if (LookingForGuildBrowseSortListLocal.Debug) then -- LookingForGuildBrowseSortListLocal.Tip[100] = { sSub = sSub, sLine = sLine }; -- end @@ -943,7 +953,7 @@ local function LookingForGuildGuild_ShowTooltip_Hook(self) local name, rank, members, achieved, infotext, cached, requestPending = GetRecruitingGuildInfo(self.index); if (infotext ~= "") then - -- DEFAULT_CHAT_FRAME:AddMessage("Infotext: " .. infotext); + -- Message("Infotext: " .. infotext); GameTooltip:AddLine("Information\n"..HIGHLIGHT_FONT_COLOR_CODE..infotext, nil, nil, nil, true); bShow = true; end @@ -1022,24 +1032,24 @@ function Cmd(sCmd, bSilent) if (iCnt > 0) then if (args[1] == "help") then if ((args[2] == "quick") or (args[2] == "short")) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Valid commands are help (sic!), status, toggle, size, findname, findcomment, sort, days, size."); + Message("LookingForGuildBrowseSort: Valid commands are help (sic!), status, toggle, size, findname, findcomment, sort, days, size."); elseif (args[2] == "info") then - DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] The server checks your selections in the settings tab and lists you all the guilds which offer at least one of your choices. But the list isn't ordered in any way, shape or form, nor are better matching guilds which do *exactly* what you want listed before dead guilds which happen to *also* pvp. [LFGBS] is secretly sneaking behind the scenes and reorders the guild list, so better matches are coming before worse. It also allows a more fine-grained matching by marking options as mandatory (MUST/MUSTN'T) vs. optional (default). It allows string search in names and comments, jumping from match to match. And it allows to sort by name or size, should you really feel the urge to."); + Message("[LFGBS] The server checks your selections in the settings tab and lists you all the guilds which offer at least one of your choices. But the list isn't ordered in any way, shape or form, nor are better matching guilds which do *exactly* what you want listed before dead guilds which happen to *also* pvp. [LFGBS] is secretly sneaking behind the scenes and reorders the guild list, so better matches are coming before worse. It also allows a more fine-grained matching by marking options as mandatory (MUST/MUSTN'T) vs. optional (default). It allows string search in names and comments, jumping from match to match. And it allows to sort by name or size, should you really feel the urge to."); else - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: LFGBS brings additional sort/search/filter functionality to the guild browser."); - DEFAULT_CHAT_FRAME:AddMessage("[LFBGS] 'help' accepts as option 'quick' or 'short' for just a list of the valid commands, and 'info' for why"); - DEFAULT_CHAT_FRAME:AddMessage("[LFBGS] 'status' shows your current MUST/MUSTN'T information (in your comment) in a readable form"); - DEFAULT_CHAT_FRAME:AddMessage("[LFBGS] 'toggle' allows you to modify your MUST/MUSTN'T information"); - DEFAULT_CHAT_FRAME:AddMessage("[LFBGS] 'days' allows you to modify the list of days you plan to play with a guild"); - DEFAULT_CHAT_FRAME:AddMessage("[LFBGS] 'times' allows you to modify the time window you plan to play with a guild"); - DEFAULT_CHAT_FRAME:AddMessage("[LFBGS] 'size' allows you to define a minimum acceptable guild size for top listing."); - DEFAULT_CHAT_FRAME:AddMessage("[LFBGS] 'rank' allows you to define a minimum acceptable guild rank for top listing."); - DEFAULT_CHAT_FRAME:AddMessage("[LFBGS] 'findname' and 'findcomment' accept a search string and jump to the next guild name/comment containing that string"); - DEFAULT_CHAT_FRAME:AddMessage("[LFBGS] 'sort' allows you to choose a different way of sorting"); - DEFAULT_CHAT_FRAME:AddMessage("[LFBGS] 'tracktoggle[full]' toggles tracking status of the currently selected guild (full generates more data)"); - DEFAULT_CHAT_FRAME:AddMessage("[LFBGS] 'tracklist' lists all currently tracked guilds and their max. actually seen size"); - DEFAULT_CHAT_FRAME:AddMessage("[LFBGS] 'trackreset [<guild name>]' resets the data tracked from the given guild or all guilds if none given"); - DEFAULT_CHAT_FRAME:AddMessage("[LFBGS] 'hideredgrey' toggles if the list of guilds (sorted by score) hides red/grey guilds (default: show all)"); + Message("LookingForGuildBrowseSort: LFGBS brings additional sort/search/filter functionality to the guild browser."); + Message("[LFBGS] 'help' accepts as option 'quick' or 'short' for just a list of the valid commands, and 'info' for why"); + Message("[LFBGS] 'status' shows your current MUST/MUSTN'T information (in your comment) in a readable form"); + Message("[LFBGS] 'toggle' allows you to modify your MUST/MUSTN'T information"); + Message("[LFBGS] 'days' allows you to modify the list of days you plan to play with a guild"); + Message("[LFBGS] 'times' allows you to modify the time window you plan to play with a guild"); + Message("[LFBGS] 'size' allows you to define a minimum acceptable guild size for top listing."); + Message("[LFBGS] 'rank' allows you to define a minimum acceptable guild rank for top listing."); + Message("[LFBGS] 'findname' and 'findcomment' accept a search string and jump to the next guild name/comment containing that string"); + Message("[LFBGS] 'sort' allows you to choose a different way of sorting"); + Message("[LFBGS] 'tracktoggle[full]' toggles tracking status of the currently selected guild (full generates more data)"); + Message("[LFBGS] 'tracklist' lists all currently tracked guilds and their max. actually seen size"); + Message("[LFBGS] 'trackreset [<guild name>]' resets the data tracked from the given guild or all guilds if none given"); + Message("[LFBGS] 'hideredgrey' toggles if the list of guilds (sorted by score) hides red/grey guilds (default: show all)"); end return @@ -1064,9 +1074,9 @@ function Cmd(sCmd, bSilent) end end - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Status = { " .. strsub(sSub, 2) .. " }"); + Message("LookingForGuildBrowseSort: Status = { " .. strsub(sSub, 2) .. " }"); else - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Didn't find a valid MUST|N'T marker in your comment (yet)."); + Message("LookingForGuildBrowseSort: Didn't find a valid MUST|N'T marker in your comment (yet)."); end return @@ -1074,7 +1084,7 @@ function Cmd(sCmd, bSilent) if (args[1] == "sort") then if (iCnt == 1) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Missing option to sort. Valid options are { NAME, SIZE, RANK, SCORE (default) }"); + Message("LookingForGuildBrowseSort: Missing option to sort. Valid options are { NAME, SIZE, RANK, SCORE (default) }"); return end @@ -1084,7 +1094,7 @@ function Cmd(sCmd, bSilent) LookingForGuild_Update(); end - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Sort routine used now is <" .. GUILDSORT .. ">"); + Message("LookingForGuildBrowseSort: Sort routine used now is <" .. GUILDSORT .. ">"); return end @@ -1098,7 +1108,7 @@ function Cmd(sCmd, bSilent) end if (strlen(x) < 3) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Pattern to find* must be 3+ characters long."); + Message("LookingForGuildBrowseSort: Pattern to find* must be 3+ characters long."); return end x = strlower(x); @@ -1121,7 +1131,7 @@ function Cmd(sCmd, bSilent) end if (#oFound == 0) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: No guild " .. sIs .. " with that pattern found."); + Message("LookingForGuildBrowseSort: No guild " .. sIs .. " with that pattern found."); return end @@ -1140,16 +1150,16 @@ function Cmd(sCmd, bSilent) if (iPos) then if (#oFound > 1) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: " .. #oFound .. " guild " .. sIs .. "s with that pattern found. Scrolling to next..."); + Message("LookingForGuildBrowseSort: " .. #oFound .. " guild " .. sIs .. "s with that pattern found. Scrolling to next..."); end else iPos = oFound[1]; if (#oFound > 1) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: " .. #oFound .. " guild " .. sIs .. "s with that pattern found. Scrolling to first..."); + Message("LookingForGuildBrowseSort: " .. #oFound .. " guild " .. sIs .. "s with that pattern found. Scrolling to first..."); end end - -- DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Trying to scroll to guild named <" .. GUILDNAMES[iPos] .. "> (" .. iPos .. ")"); + -- Message("LookingForGuildBrowseSort: Trying to scroll to guild named <" .. GUILDNAMES[iPos] .. "> (" .. iPos .. ")"); LookingForGuildBrowseFrameContainerScrollBar:SetValue((iPos - 1) * 84); HybridScrollFrame_SetOffset(LookingForGuildBrowseFrameContainer, (iPos - 1) * 84); @@ -1164,7 +1174,7 @@ function Cmd(sCmd, bSilent) sOptions = sOptions .. ", " .. v; end - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Missing option to toggle. Valid options are { " .. strsub(sOptions, 2) .. " }"); + Message("LookingForGuildBrowseSort: Missing option to toggle. Valid options are { " .. strsub(sOptions, 2) .. " }"); return end @@ -1177,7 +1187,7 @@ function Cmd(sCmd, bSilent) if (not choice) then if (not bSilent) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Unknown choice to toggle."); + Message("LookingForGuildBrowseSort: Unknown choice to toggle."); end return @@ -1208,7 +1218,7 @@ function Cmd(sCmd, bSilent) if (args[1] == "days") then if (not args[2] or strlen(args[2]) ~= 7) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: This command must be followed by a 7-letter argument, one for each day either upper-case for yes or lower-case for no. (E.g.: mtwtFSs for only on Fridays/Saturdays)"); + Message("LookingForGuildBrowseSort: This command must be followed by a 7-letter argument, one for each day either upper-case for yes or lower-case for no. (E.g.: mtwtFSs for only on Fridays/Saturdays)"); return end @@ -1222,7 +1232,7 @@ function Cmd(sCmd, bSilent) if (c == strsub(sDaysUpper, i, i)) then iDays = iDays + iMulti; elseif (c ~= strsub(sDaysLower, i, i)) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Unknown letter <" .. c .. "> for day " .. i .. ". Correct sequence is [" .. sDaysUpper .. "]"); + Message("LookingForGuildBrowseSort: Unknown letter <" .. c .. "> for day " .. i .. ". Correct sequence is [" .. sDaysUpper .. "]"); return end @@ -1249,12 +1259,12 @@ function Cmd(sCmd, bSilent) if (bChanged) then if (iDays) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Updated comment to include days [" .. DaysNum2Str(iDays) .. "]"); + Message("LookingForGuildBrowseSort: Updated comment to include days [" .. DaysNum2Str(iDays) .. "]"); else - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Updated comment to not include days any longer."); + Message("LookingForGuildBrowseSort: Updated comment to not include days any longer."); end else - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Days remain unchanged [" .. DaysNum2Str(iDays) .. "]"); + Message("LookingForGuildBrowseSort: Days remain unchanged [" .. DaysNum2Str(iDays) .. "]"); end return @@ -1269,7 +1279,7 @@ function Cmd(sCmd, bSilent) args[5] = ""; else if (not args[3] or args[4]) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: This command must be followed by two time arguments in the format HH:MM, MM (minutes) may only be 00 or 30 (e.g. \"/LFGBS times 19:00 23:30\"), or by one argument to reset: --"); + Message("LookingForGuildBrowseSort: This command must be followed by two time arguments in the format HH:MM, MM (minutes) may only be 00 or 30 (e.g. \"/LFGBS times 19:00 23:30\"), or by one argument to reset: --"); return end @@ -1320,7 +1330,7 @@ function Cmd(sCmd, bSilent) end if (not ok) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: This command must be followed by two time arguments in the format HH:MM, MM (minutes) may only be 00 or 30 (e.g. \"/LFGBS times 19:00 23:30\")."); + Message("LookingForGuildBrowseSort: This command must be followed by two time arguments in the format HH:MM, MM (minutes) may only be 00 or 30 (e.g. \"/LFGBS times 19:00 23:30\")."); return end end @@ -1328,7 +1338,7 @@ function Cmd(sCmd, bSilent) local sOld = "--:-- -> --:--"; if ((type(oMUST) == "table") and (next(oMUST) ~= nil)) then if (type(oMUST.TIME) == "table") then - DEFAULT_CHAT_FRAME:AddMessage("[LFGBS][DEBUG] TIME was set."); + Message("[LFGBS][DEBUG] TIME was set."); sOld = format("%02d:%02d -> %02d:%02d", floor(oMUST.TIME.FROM), 60 * (oMUST.TIME.FROM - floor(oMUST.TIME.FROM)), floor(oMUST.TIME.TO ), 60 * (oMUST.TIME.TO - floor(oMUST.TIME.TO ))); @@ -1349,12 +1359,12 @@ function Cmd(sCmd, bSilent) if (bChanged) then if (oTIMES) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Updated comment to include times " .. args[2] .. " - " .. args[3] .. " (from " .. (sOld or "<??>") .. ")."); + Message("LookingForGuildBrowseSort: Updated comment to include times " .. args[2] .. " - " .. args[3] .. " (from " .. (sOld or "<??>") .. ")."); else - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Updated comment to not include times any longer (times were " .. (sOld or "<??>") .. ")."); + Message("LookingForGuildBrowseSort: Updated comment to not include times any longer (times were " .. (sOld or "<??>") .. ")."); end else - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Times remain unchanged: " .. args[2] .. " - " .. args[3] .. "."); + Message("LookingForGuildBrowseSort: Times remain unchanged: " .. args[2] .. " - " .. args[3] .. "."); end return @@ -1363,7 +1373,7 @@ function Cmd(sCmd, bSilent) if (args[1] == "size") then local iSize = tonumber(args[2] or "0"); if (((iSize == 0) and (args[2] ~= "0")) or (iSize > 0) and (iSize < 5) or (iSize > 55)) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Size argument must be 0 (zero, to clear/reset) or between 5 and 55 (odd, inclusive)."); + Message("LookingForGuildBrowseSort: Size argument must be 0 (zero, to clear/reset) or between 5 and 55 (odd, inclusive)."); return end @@ -1391,12 +1401,12 @@ function Cmd(sCmd, bSilent) if (bChanged) then if (iSize) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Updated comment to include min. size " .. iSize .. "."); + Message("LookingForGuildBrowseSort: Updated comment to include min. size " .. iSize .. "."); else - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Updated comment to not include a min. size any longer."); + Message("LookingForGuildBrowseSort: Updated comment to not include a min. size any longer."); end else - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Min. size remains unchanged: " .. iSize .. "."); + Message("LookingForGuildBrowseSort: Min. size remains unchanged: " .. iSize .. "."); end return @@ -1405,7 +1415,7 @@ function Cmd(sCmd, bSilent) if (args[1] == "rank") then local iRank = tonumber(args[2] or "0"); if (((iRank == 0) and (args[2] ~= "0")) or (iRank < 1) or (iRank > 30)) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Rank argument must be 0 (zero, to clear/reset) or between 1 and 30."); + Message("LookingForGuildBrowseSort: Rank argument must be 0 (zero, to clear/reset) or between 1 and 30."); return end @@ -1429,12 +1439,12 @@ function Cmd(sCmd, bSilent) if (bChanged) then if (iRank) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Updated comment to include min. guild rank " .. iRank .. "."); + Message("LookingForGuildBrowseSort: Updated comment to include min. guild rank " .. iRank .. "."); else - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Updated comment to not include a min. guild rank any longer."); + Message("LookingForGuildBrowseSort: Updated comment to not include a min. guild rank any longer."); end else - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Min. guild rank remains unchanged: " .. iRank .. "."); + Message("LookingForGuildBrowseSort: Min. guild rank remains unchanged: " .. iRank .. "."); end return @@ -1443,19 +1453,19 @@ function Cmd(sCmd, bSilent) if (strsub(args[1], 1, 11) == "tracktoggle") then local iSelected = GetRecruitingGuildSelection(); if (not iSelected) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: No guild selected to toggle tracking status."); + Message("LookingForGuildBrowseSort: No guild selected to toggle tracking status."); return end local sName = GetRecruitingGuildInfo(iSelected); if (not sName) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Failed to find name of selected guild. Hm!"); + Message("LookingForGuildBrowseSort: Failed to find name of selected guild. Hm!"); else local oTracker = LookingForGuildBrowseSortListLocal.Tracker; local iMax, i, bFound, bData = #oTracker; for i = 1, iMax do if (oTracker[i].Name == sName) then - DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] Cmd::tt: " .. sName .. " => " .. i); + Message("[LFGBS] Cmd::tt: " .. sName .. " => " .. i); bFound = true; if (args[1] == "tracktogglefull") then oTracker[i].SeenCount = 0; @@ -1504,7 +1514,7 @@ function Cmd(sCmd, bSilent) end end - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Tracking status for guild <" .. sName .. "> toggled to " .. sStatus .. "."); + Message("LookingForGuildBrowseSort: Tracking status for guild <" .. sName .. "> toggled to " .. sStatus .. "."); end return @@ -1527,7 +1537,7 @@ function Cmd(sCmd, bSilent) sSub = " none."; end - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Tracked guilds are " .. strsub(sSub, 2)); + Message("LookingForGuildBrowseSort: Tracked guilds are " .. strsub(sSub, 2)); return end @@ -1562,7 +1572,7 @@ function Cmd(sCmd, bSilent) end end - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Tracking statistics haben been re-initialized."); + Message("LookingForGuildBrowseSort: Tracking statistics haben been re-initialized."); return end @@ -1575,14 +1585,14 @@ function Cmd(sCmd, bSilent) LookingForGuild_Update(); end - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Hiding red/grey guilds (in the score-list) is now " + Message("LookingForGuildBrowseSort: Hiding red/grey guilds (in the score-list) is now " .. (LookingForGuildBrowseSortListLocal.Config.HideRedGrey and "on." or "off.")); return end end - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Missing or unknown command. Try '/LFGBS help'"); + Message("LookingForGuildBrowseSort: Missing or unknown command. Try '/LFGBS help'"); end local function LookingForGuildBrowseSortButton_OnClick(self) @@ -1605,8 +1615,8 @@ local function GetRecruitingGuildSettings_Overwrite() if (not bGetRecruitingGuildSettings_Hooked) then bGetRecruitingGuildSettings_Hooked = true; - hooksecurefunc("RequestRecruitingGuildsList", MapReset); - hooksecurefunc("SetLookingForGuildComment", MapReset); + -- hooksecurefunc("RequestRecruitingGuildsList", MapReset); + -- hooksecurefunc("SetLookingForGuildComment", MapReset); LookingForGuildCommentEditBox:HookScript("OnEditFocusLost", LFGBSPrivate.CommentPlayer.Parse); MapReset(); end @@ -1660,6 +1670,7 @@ local function GetRecruitingGuildSettings_Overwrite() local oButton = _G["LookingForGuild" .. sCamel .. "Button"]; if (oButton) then oButton:HookScript("OnClick", LFGBSPrivate.CommentPlayer.ButtonToggle); + oButton:RegisterForClicks("LeftButtonUp", "RightButtonUp"); end end end @@ -1677,7 +1688,7 @@ local function GetRecruitingGuildSettings_Overwrite() bSlashCommand_Added = true; SLASH_LFGBS1 = "/LFGBS"; SlashCmdList["LFGBS"] = Cmd; - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort initialized. Try '/LFGBS help' for a list of commands."); + Message("LookingForGuildBrowseSort initialized. Try '/LFGBS help' for a list of commands."); end if (not bLookingForGuild_Update_Hooked) then @@ -1700,9 +1711,9 @@ local iFrequency = 1200; function LFGBSFrequencySet(iValue) if ((type(iValue) == "number") and (iValue > 60) and (iValue <= 1200)) then iFrequency = iValue; - DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] Frequency set to " .. iValue .. "."); + Message("[LFGBS] Frequency set to " .. iValue .. "."); else - DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] Frequency not set to [" .. tostring(iValue) .. "]."); + Message("[LFGBS] Frequency NOT set to [" .. tostring(iValue) .. "] - invalid input."); end end @@ -1730,14 +1741,14 @@ function LFGBSPrivate.TrackerFrame.OnUpdate(oFrame, iElapsed) -- 20:30 - 0:30 => 20.5 - 0.5 if ((tTo < iHoursNow) and (tFrom > iHoursNow)) then oFrame.At = iFrequency / 2; - -- DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] Current time outside preferred raid time (" .. format("%.1f - %.1f", tFrom, tTo) .. ") - no tracking."); + -- Message("[LFGBS] Current time outside preferred raid time (" .. format("%.1f - %.1f", tFrom, tTo) .. ") - no tracking."); return end else -- 20:30 - 23:30 => 20.5 - 23.5 if ((tTo < iHoursNow) or (tFrom > iHoursNow)) then oFrame.At = iFrequency / 2; - -- DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] Current time outside preferred raid time (" .. format("%.1f - %.1f", tFrom, tTo) .. ") - no tracking."); + -- Message("[LFGBS] Current time outside preferred raid time (" .. format("%.1f - %.1f", tFrom, tTo) .. ") - no tracking."); return end end @@ -1762,7 +1773,7 @@ function LFGBSPrivate.TrackerFrame.OnUpdate(oFrame, iElapsed) FriendsFrame:UnregisterEvent("WHO_LIST_UPDATE"); SetWhoToUI(1); - -- DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] TF::OU: Sent [" .. sWho .. "]"); + -- Message("[LFGBS] TF::OU: Sent [" .. sWho .. "]"); end else oFrame.At = iFrequency / 4; @@ -1771,7 +1782,9 @@ function LFGBSPrivate.TrackerFrame.OnUpdate(oFrame, iElapsed) end function LFGBSPrivate.TrackerFrame.OnEvent(oFrame, sEvent, arg1, ...) - if (sEvent == "WHO_LIST_UPDATE") then + if (sEvent == "LF_GUILD_BROWSE_UPDATED") then + MapReset("OnEvent:" .. sEvent); + elseif (sEvent == "WHO_LIST_UPDATE") then FriendsFrame:RegisterEvent("WHO_LIST_UPDATE"); if (FriendsFrame:IsVisible()) then SetWhoToUI(1); @@ -1866,9 +1879,9 @@ function LFGBSPrivate.TrackerFrame.OnEvent(oFrame, sEvent, arg1, ...) end if (bWrong) then - -- DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] TF::OE(WLU) - " .. strsub(sOut, 3) .. " == {" .. tostring(sGuildOops) .. "}"); + -- Message("[LFGBS] TF::OE(WLU) - " .. strsub(sOut, 3) .. " == {" .. tostring(sGuildOops) .. "}"); else - DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] TF::OE(WLU) + " .. strsub(sOut, 3)); + Message("[LFGBS] TF::OE(WLU) + " .. strsub(sOut, 3)); end end @@ -1949,10 +1962,11 @@ function LFGBSPrivate.TrackerFrame.OnEvent(oFrame, sEvent, arg1, ...) oFrame:UnregisterEvent("ADDON_LOADED"); oFrame:RegisterEvent("WHO_LIST_UPDATE"); + oFrame:RegisterEvent("LF_GUILD_BROWSE_UPDATED"); oFrame:SetScript("OnUpdate", LFGBSPrivate.TrackerFrame.OnUpdate); if (#LookingForGuildBrowseSortListLocal.Tracker > 0) then - DEFAULT_CHAT_FRAME:AddMessage("LookingForGuildBrowseSort: Tracker initialized with " .. #LookingForGuildBrowseSortListLocal.Tracker .. " guilds to look for."); + Message("LookingForGuildBrowseSort: Tracker initialized with " .. #LookingForGuildBrowseSortListLocal.Tracker .. " guilds to look for."); end end end @@ -1988,30 +2002,13 @@ end function LFGBSPrivate.TrackerFrame.SendWhoHook(sWho) local oFrame = LFGBSPrivate.TrackerFrame.oFrame; if (not sWho or (sWho ~= oFrame.sWho)) then - oFrame.At = math.max(oFrame.At, 8); - end -end - -do - local oFrame = CreateFrame("Frame", nil, UIParent); - oFrame:SetScript("OnEvent", LFGBSPrivate.TrackerFrame.OnEvent); - oFrame:RegisterEvent("ADDON_LOADED"); - hooksecurefunc("SendWho", LFGBSPrivate.TrackerFrame.SendWhoHook); - - LFGBSPrivate.TrackerFrame.oFrame = oFrame; - - LFGBSPrivate.SizeStat.Sizes = { [0] = 0 }; - local oSizes, i, j = LFGBSPrivate.SizeStat.Sizes; - for i = 1, 10 do - for j = 1, 5 do - oSizes[(i - 1) * 5 + j] = oSizes[(i - 1) * 5 + j - 1 ] + i; - end + oFrame.At = math.max(oFrame.At, 7); end end function LFGBSPrivate.SizeStat.NumToSlot(iNum, iFirst, iLast) if (iNum == nil) then - DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] Oops in P:SS:NTS(nil)."); + Message("[LFGBS] Oops in P:SS:NTS(nil)."); end local oSizes = LFGBSPrivate.SizeStat.Sizes; @@ -2027,17 +2024,17 @@ function LFGBSPrivate.SizeStat.NumToSlot(iNum, iFirst, iLast) end end if (not iContainer or not oSizes[iContainer]) then - DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] Oops in P:SS:NTS(" .. iNum .. ") =?> " .. (iContainer or "<nil>")); + Message("[LFGBS] Oops in P:SS:NTS(" .. iNum .. ") =?> " .. (iContainer or "<nil>")); end if ((oSizes[iContainer] > iNum) or ((oSizes[iContainer + 1] ~= nil) and (oSizes[iContainer + 1] <= iNum))) then - DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] Oops in P:SS:NTS(" .. iNum .. ") =!> " .. iContainer); + Message("[LFGBS] Oops in P:SS:NTS(" .. iNum .. ") =!> " .. iContainer); end return iContainer; else iMiddle = math.floor(iFirst + (iLast - iFirst) / 3); if (oSizes[iMiddle] == nil) then - DEFAULT_CHAT_FRAME:AddMessage("[LFGBS] Oops in P:SS:NTS(" .. iNum .. ") =^ { " .. iMiddle .. " }"); + Message("[LFGBS] Oops in P:SS:NTS(" .. iNum .. ") =^ { " .. iMiddle .. " }"); end if (oSizes[iMiddle] > iNum) then @@ -2135,3 +2132,20 @@ function LFGBSPrivate.SizeStat.SeenMaxUpdate(oGuild, oCollisions, iMax) end end end + +do + local oFrame = CreateFrame("Frame", nil, UIParent); + oFrame:SetScript("OnEvent", LFGBSPrivate.TrackerFrame.OnEvent); + oFrame:RegisterEvent("ADDON_LOADED"); + hooksecurefunc("SendWho", LFGBSPrivate.TrackerFrame.SendWhoHook); + + LFGBSPrivate.TrackerFrame.oFrame = oFrame; + + LFGBSPrivate.SizeStat.Sizes = { [0] = 0 }; + local oSizes, i, j = LFGBSPrivate.SizeStat.Sizes; + for i = 1, 10 do + for j = 1, 5 do + oSizes[(i - 1) * 5 + j] = oSizes[(i - 1) * 5 + j - 1 ] + i; + end + end +end