changeset 25:e0a1917e571f v0.65

Simple filters, minor bug fixes, and reuploading
author ShadowTheAge
date Sat, 26 Sep 2015 13:21:55 +0300
parents ecff6ee4b36e
children 521897e5e0b9
files CrossRealmAssist.lua
diffstat 1 files changed, 42 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/CrossRealmAssist.lua	Sat Jun 27 23:59:50 2015 +0300
+++ b/CrossRealmAssist.lua	Sat Sep 26 13:21:55 2015 +0300
@@ -9,6 +9,7 @@
 local homeRealm, realmSep, gui, btRefresh, btSettings, btQuick, btManual, lbRealm, lbStatus, playerName, lfgui, lfgTabSelected, lfgTable, lbThrottle, curLfgGroup, sheduledScan, wasInGroup, inInstance
 local settingsMenu
 local hintShown
+local cbHideGroups, cbHideRaids, cbHideNoAutoinv
 
 local tabs = {}
 local curRealmStat, curPartyStat
@@ -186,7 +187,7 @@
 
     local countWeight = 4 -- count weight
     if pcount >= 39 or pcount <= 1 then countWeight = 1
-    elseif pcount >= 35 or pcount <= 4 then countWeight = 2
+    elseif pcount >= 35 or pcount <= 5 then countWeight = 2
     elseif pcount >= 30 or pcount <= 10 then countWeight = 3
     else countWeight = 4 end
 
@@ -277,8 +278,12 @@
 end
 
 local function filterTable(self, row)
-    local delisted = select(11, C_LFGList.GetSearchResultInfo(row.id))
-    return not delisted;
+    local _, _, _, _, _, _, _, _, _, _, delisted, _, pcount, autoinv = C_LFGList.GetSearchResultInfo(row.id)
+    if delisted then return false end;
+    if pcount > 5 and cbHideRaids:GetChecked() then return false end;
+    if pcount <= 5 and cbHideGroups:GetChecked() then return false end;
+    if not autoinv and cbHideNoAutoinv:GetChecked() then return false end;
+    return true;
 end
 
 function addon:UpdateResponseData(event, result)
@@ -314,8 +319,9 @@
 
 local function JoinGroup(rid)
     local tank, heal, dd = C_LFGList.GetAvailableRoles()
+    local noHealTank = not db.global.applyAsDD;
     addon:SetGroupJoinStatus(rid, "_init")
-    C_LFGList.ApplyToGroup(rid, "", tank, heal, dd)
+    C_LFGList.ApplyToGroup(rid, "", tank and noHealTank, heal and noHealTank, dd)
 end
 
 local function TableCellClick(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...)
@@ -418,7 +424,7 @@
 end
 
 function addon:CreateUI()
-    gui = setupWidget(CreateFrame("Frame","CrossRealmAssistMainUI",nil,"InsetFrameTemplate3"), {SetFrameStrata="LOW",SetWidth=208,SetHeight=60,EnableMouse=true,SetMovable=true})
+    gui = setupWidget(CreateFrame("Frame","CrossRealmAssistMainUI",nil,"InsetFrameTemplate3"), {SetFrameStrata="LOW",SetWidth=208,SetHeight=60,EnableMouse=true,SetMovable=true,SetClampedToScreen=true})
     local title = setupWidget(CreateFrame("Frame",nil,gui), {SetWidth=190,SetHeight=18,EnableMouse=true,RegisterForDrag="LeftButton"}, 0, 6);
     title:SetScript("OnDragStart", function() gui:StartMoving() end)
     title:SetScript("OnDragStop", stopMovingWidget)
@@ -468,8 +474,12 @@
     end
 end
 
+function addon.refreshList()
+    lfgTable:SetFilter(filterTable)
+end
+
 function addon:CreateLFGUI()
-    lfgui = setupWidget(CreateFrame("Frame","CrossRealmAssistJoinUI",nil,"UIPanelDialogTemplate"), {SetFrameStrata="DIALOG",SetWidth=405,SetHeight=300,EnableMouse=true,SetMovable=true})
+    lfgui = setupWidget(CreateFrame("Frame","CrossRealmAssistJoinUI",nil,"UIPanelDialogTemplate"), {SetFrameStrata="DIALOG",SetWidth=405,SetHeight=323,EnableMouse=true,SetMovable=true})
     lfgui.title:SetText("Click to join group")
     lfgui:SetScript("OnUpdate",addon.lfgUpdate)
     local titlereg = lfgui:CreateTitleRegion()
@@ -497,6 +507,27 @@
     btRefresh.icon:SetTexture("Interface/BUTTONS/UI-RefreshButton")
     btRefresh.icon:SetTexCoord(0,1,0,1);
     btRefresh:SetScript("OnClick",addon.refreshLfgCurrent)
+
+    setupWidget(CreateFrame("Frame",nil,lfgui,"HorizontalBarTemplate"),{SetWidth=392,SetHeight=2}, 8, 294)
+    local text = setupWidget(lfgui:CreateFontString(nil,"BACKGROUND", "GameFontHighlightSmall"), {SetText="Hide:"}, 20, 302)
+
+    cbHideGroups = setupWidget(CreateFrame("CheckButton",nil,lfgui,"UICheckButtonTemplate"),{SetWidth=22,SetHeight=22})
+    cbHideGroups:SetPoint("TOPLEFT",text,"TOPRIGHT",5,7)
+    cbHideGroups:SetScript("OnClick",addon.refreshList)
+    text = setupWidget(lfgui:CreateFontString(nil,"BACKGROUND", "GameFontHighlightSmall"), {SetText="5p Groups"})
+    text:SetPoint("TOPLEFT",cbHideGroups,"TOPRIGHT",0,-7)
+
+    cbHideRaids = setupWidget(CreateFrame("CheckButton",nil,lfgui,"UICheckButtonTemplate"),{SetWidth=22,SetHeight=22})
+    cbHideRaids:SetPoint("TOPLEFT",text,"TOPRIGHT",5,7)
+    cbHideRaids:SetScript("OnClick",addon.refreshList)
+    text = setupWidget(lfgui:CreateFontString(nil,"BACKGROUND", "GameFontHighlightSmall"), {SetText="Raids"})
+    text:SetPoint("TOPLEFT",cbHideRaids,"TOPRIGHT",0,-7)
+
+    cbHideNoAutoinv = setupWidget(CreateFrame("CheckButton",nil,lfgui,"UICheckButtonTemplate"),{SetWidth=22,SetHeight=22})
+    cbHideNoAutoinv:SetPoint("TOPLEFT",text,"TOPRIGHT",5,7)
+    cbHideNoAutoinv:SetScript("OnClick",addon.refreshList)
+    text = setupWidget(lfgui:CreateFontString(nil,"BACKGROUND", "GameFontHighlightSmall"), {SetText="Groups w/o Autoinvite"})
+    text:SetPoint("TOPLEFT",cbHideNoAutoinv,"TOPRIGHT",0,-7)
 end
 
 function addon:CreateTabs()
@@ -932,6 +963,10 @@
     db.global.allLanguages = checked
 end
 
+local function toggleApplyAsDD(btn, arg1, arg2, checked)
+    db.global.applyAsDD = checked
+end
+
 local function ClearJoinHistory()
     recentgroups = {}
     addon:UpdateAutoButtonStatus()
@@ -955,6 +990,7 @@
         UIDropDownMenu_AddButton({isTitle=1,text="Settings",notCheckable=1}, level)
         UIDropDownMenu_AddButton({text="Show Minimap Button",checked=not db.global.minimap.hide, func=toggleMinimapIcon,keepShownOnClick=true,isNotRadio=true}, level)
         UIDropDownMenu_AddButton({text="All language groups",checked=db.global.allLanguages, func=toggleAllLanguages,keepShownOnClick=true,isNotRadio=true}, level)
+        UIDropDownMenu_AddButton({text="Apply to groups as DD only",checked=db.global.applyAsDD, func=toggleApplyAsDD,keepShownOnClick=true,isNotRadio=true}, level)
         UIDropDownMenu_AddButton({text="Show Quick Join Hint",checked=db.global.quickJoinHint, func=toggleQuickJoinHint,keepShownOnClick=true,isNotRadio=true}, level)
         UIDropDownMenu_AddButton({text="Quick join categories",notCheckable=1,hasArrow=1,value="qjc",keepShownOnClick=true}, level)
     elseif level == 2 then