Mercurial > wow > crossrealmassist
comparison CrossRealmAssist.lua @ 32:7b7b3ca996fd
CrossRealmAssist beta 0.75 release-candidate
| author | ShadowTheAge |
|---|---|
| date | Mon, 26 Oct 2015 00:47:27 +0300 |
| parents | 7267ae761cb9 |
| children | f39b5803b4c1 |
comparison
equal
deleted
inserted
replaced
| 31:efecddd638fc | 32:7b7b3ca996fd |
|---|---|
| 1 CrossRealmAssist = LibStub("AceAddon-3.0"):NewAddon("CrossRealmAssist", "AceEvent-3.0", "AceConsole-3.0", "AceTimer-3.0") | 1 CrossRealmAssist = LibStub("AceAddon-3.0"):NewAddon("CrossRealmAssist", "AceEvent-3.0", "AceConsole-3.0", "AceTimer-3.0") |
| 2 local addon = CrossRealmAssist; | 2 local addon = CrossRealmAssist; |
| 3 local wholib = LibStub:GetLibrary('LibWho-2.0'):Library() | 3 local wholib = LibStub:GetLibrary('LibWho-2.0'):Library() |
| 4 local realmInfo = LibStub:GetLibrary('LibRealmInfo') | |
| 4 local ScrollingTable = LibStub("ScrollingTable"); | 5 local ScrollingTable = LibStub("ScrollingTable"); |
| 5 local ldb = LibStub("LibDataBroker-1.1") | 6 local ldb = LibStub("LibDataBroker-1.1") |
| 6 local minimapIcon = LibStub("LibDBIcon-1.0") | 7 local minimapIcon = LibStub("LibDBIcon-1.0") |
| 7 local db | 8 local db |
| 8 | 9 |
| 9 local homeRealm, realmSep, gui, btRefresh, btSettings, btQuick, btManual, lbRealm, lbStatus, playerName, lfgui, lfgTabSelected, lfgTable, lbThrottle, curLfgGroup, sheduledScan, wasInGroup, inInstance | 10 local homeRealm, realmSep, gui, btRefresh, btSettings, btQuick, btManual, lbRealm, lbStatus, playerName, lfgui, lfgTabSelected, lfgTable, lbThrottle, curLfgGroup, sheduledScan, wasInGroup, inInstance |
| 10 local settingsMenu | 11 local settingsMenu |
| 11 local hintShown | 12 local hintShown |
| 12 local cbHideGroups, cbHideRaids, cbHideNoAutoinv | 13 local btFilterCount, cbHideNoAutoinv, edFilterText |
| 13 | 14 |
| 14 local tabs = {} | 15 local tabs = {} |
| 15 local curRealmStat | 16 local curRealmStat |
| 16 local scanstate=0 | 17 local scanstate=0 |
| 17 local recentRealms={} | 18 local recentRealms={} |
| 18 local recentgroups={} | 19 local recentgroups={} |
| 19 local autoScanGroups={} | 20 local autoScanGroups={} |
| 20 local active=false | 21 local active=false |
| 21 local allLanguageTable={} | 22 local allLanguageTable={} |
| 22 | 23 local extraColumns |
| 23 local lfgGroups={ | 24 local tableTemplate |
| 25 local filterString | |
| 26 local filterByCountId=1 | |
| 27 | |
| 28 addon.lfgGroups={ | |
| 24 6, -- Custom | 29 6, -- Custom |
| 25 10, -- Ashran | 30 10, -- Ashran |
| 26 1, -- Quests | 31 1, -- Quests |
| 27 3, -- Raids | 32 3, -- Raids |
| 28 8 -- BGs | 33 8 -- BGs |
| 44 minimap = {}, | 49 minimap = {}, |
| 45 widgetPos=DefaultWidgetPos, | 50 widgetPos=DefaultWidgetPos, |
| 46 quickJoinHint = true, | 51 quickJoinHint = true, |
| 47 quickJoin={[6]=1}, | 52 quickJoin={[6]=1}, |
| 48 allLanguages = true, | 53 allLanguages = true, |
| 49 stoplist = {"no hop","kick"} | 54 stoplist = {"no hop","nohop","no realm","kick"}, |
| 55 priorityList = {"realm hop","realmhop","garrison"}, | |
| 56 lfgPanelScale = 1.0, uiScale = 1.0, listItemCount=15, | |
| 57 extraColumns = {} | |
| 50 } | 58 } |
| 51 } | 59 } |
| 60 local filterByCountList = { | |
| 61 {text="Any number of players",min=1,max=40}, | |
| 62 {text="Groups (1-5)",min=1,max=5}, | |
| 63 {text="Raids (6-40)",min=6,max=40}, | |
| 64 {text="Non-full groups (1-4)",min=1,max=4}, | |
| 65 {text="Non-full raids (6-35)",min=6,max=35} | |
| 66 } | |
| 52 | 67 |
| 53 | 68 |
| 54 -- Utils functions | 69 -- Utils functions |
| 70 | |
| 71 | |
| 72 local function searchInList(name, list) | |
| 73 if list and name then | |
| 74 local lname = string.lower(name); | |
| 75 for i=1, #list do | |
| 76 if string.find(lname, list[i], 1, true) then return true end | |
| 77 end | |
| 78 end | |
| 79 return false; | |
| 80 end | |
| 55 | 81 |
| 56 local function PlayerName(fullname) | 82 local function PlayerName(fullname) |
| 57 fullname = fullname or "???-???" | 83 fullname = fullname or "???-???" |
| 58 local name, realm = strsplit(realmSep, fullname) | 84 local name, realm = strsplit(realmSep, fullname) |
| 59 realm = realm or homeRealm; | 85 realm = realm or homeRealm; |
| 62 | 88 |
| 63 local function canJoinGroup() | 89 local function canJoinGroup() |
| 64 return (not IsInGroup()) or (UnitIsGroupLeader('player') and not IsInRaid()) | 90 return (not IsInGroup()) or (UnitIsGroupLeader('player') and not IsInRaid()) |
| 65 end | 91 end |
| 66 | 92 |
| 67 local function sortByWeight(a,b) | 93 local function sortByTypeAndName(a,b) |
| 68 return b.weight < a.weight | 94 if a.type == b.type then |
| 95 return a.name < b.name | |
| 96 else | |
| 97 return a.type < b.type; | |
| 98 end | |
| 69 end | 99 end |
| 70 | 100 |
| 71 | 101 |
| 72 -- UI functions | 102 -- UI functions |
| 73 | 103 |
| 160 GameTooltip:AddLine(text, r, g, b, wrap) | 190 GameTooltip:AddLine(text, r, g, b, wrap) |
| 161 if icon then GameTooltip:AddTexture(icon) end | 191 if icon then GameTooltip:AddTexture(icon) end |
| 162 end | 192 end |
| 163 end | 193 end |
| 164 | 194 |
| 195 local function getJoinedAgo(name) | |
| 196 if recentgroups[name] then | |
| 197 return GetTime() - recentgroups[name].time | |
| 198 end | |
| 199 end | |
| 200 | |
| 165 local function WeightLfgItem(id, forAutoJoin) | 201 local function WeightLfgItem(id, forAutoJoin) |
| 166 local _, action, caption, desc, voice, ilvl, time, bnetfr, charfr, guild, delisted, fullname, pcount, autoinv = C_LFGList.GetSearchResultInfo(id) | 202 local _, action, caption, desc, voice, ilvl, time, bnetfr, charfr, guild, delisted, fullname, pcount, autoinv = C_LFGList.GetSearchResultInfo(id) |
| 167 if delisted then return 0 end | 203 if delisted then return 0 end |
| 168 local name,realm = PlayerName(fullname); | 204 local name,realm = PlayerName(fullname); |
| 169 local stoplist = db.global.stoplist or {} | 205 local ldesc = caption .. "|" .. desc; |
| 170 local ldesc = string.lower(caption) .. "|" .. string.lower(desc); | 206 if searchInList(ldesc, db.global.stoplist) then return 0 end |
| 171 local isHopGroup = string.find(ldesc, "realm hop") | 207 local isHopGroup = searchInList(ldesc, db.global.priorityList); |
| 172 for i=1, #stoplist do | |
| 173 if string.find(ldesc, stoplist[i], 1, true) then return 0 end | |
| 174 end | |
| 175 if forAutoJoin then | 208 if forAutoJoin then |
| 176 if not autoinv or recentgroups[fullname] or (not isHopGroup and (pcount >= 35 or pcount <= 5)) then return 0 end | 209 if not autoinv or recentgroups[fullname] or (not isHopGroup and (pcount >= 35 or pcount <= 5)) then return 0 end |
| 177 end | 210 end |
| 178 | 211 |
| 179 local autoinvWeight = autoinv and 5 or 2 | 212 local autoinvWeight = autoinv and 5 or 2 |
| 180 local hopCoef = isHopGroup and 3 or 1 | 213 local hopCoef = isHopGroup and 3 or 1 |
| 181 | 214 |
| 182 local visCoef = 1 | 215 local visCoef = 1 |
| 183 if recentgroups[fullname] then | 216 if recentgroups[fullname] then |
| 184 local ago = GetTime() - recentgroups[fullname].time; | 217 local ago = getJoinedAgo(fullname) |
| 185 visCoef = math.min(1,ago/600) | 218 visCoef = math.min(1,ago/600) |
| 186 end | 219 end |
| 187 | 220 |
| 188 local leaderRealm = 3 -- recently visited realms | 221 local leaderRealm = 3 -- recently visited realms |
| 189 local realmVis = recentRealms[realm] | 222 local realmVis = recentRealms[realm] |
| 225 end | 258 end |
| 226 if not short then | 259 if not short then |
| 227 addTooltipLineIcon(ilvl > 0, "Min. ilvl: "..ilvl, READY_CHECK_WAITING_TEXTURE, 1, 1, 0) | 260 addTooltipLineIcon(ilvl > 0, "Min. ilvl: "..ilvl, READY_CHECK_WAITING_TEXTURE, 1, 1, 0) |
| 228 addTooltipLineIcon(voice ~= "", "Voice: "..voice, READY_CHECK_WAITING_TEXTURE, 1, 1, 0) | 261 addTooltipLineIcon(voice ~= "", "Voice: "..voice, READY_CHECK_WAITING_TEXTURE, 1, 1, 0) |
| 229 addTooltipLineIcon(friends > 0, "Friends: "..friends, READY_CHECK_WAITING_TEXTURE, 1, 1, 0) | 262 addTooltipLineIcon(friends > 0, "Friends: "..friends, READY_CHECK_WAITING_TEXTURE, 1, 1, 0) |
| 230 addTooltipLineIcon(autoinv, "Autoinvite!", READY_CHECK_READY_TEXTURE, 0, 1, 0) | 263 addTooltipLineIcon(autoinv, "Autoaccept!", READY_CHECK_READY_TEXTURE, 0, 1, 0) |
| 231 local visitinfo = recentgroups[fullname] | 264 local visitinfo = recentgroups[fullname] |
| 232 if visitinfo then | 265 if visitinfo then |
| 233 local ago = GetTime() - visitinfo.time; | 266 local ago = GetTime() - visitinfo.time; |
| 234 GameTooltip:AddDoubleLine(StatusTable[visitinfo.status] or visitinfo.status,SecondsToTime(ago, false, false, 1, false).." ago",1,0,0,1,0,0) | 267 GameTooltip:AddDoubleLine(StatusTable[visitinfo.status] or visitinfo.status,SecondsToTime(ago, false, false, 1, false).." ago",1,0,0,1,0,0) |
| 235 GameTooltip:AddTexture(READY_CHECK_NOT_READY_TEXTURE) | 268 GameTooltip:AddTexture(READY_CHECK_NOT_READY_TEXTURE) |
| 266 | 299 |
| 267 local function updateGroupName(id) | 300 local function updateGroupName(id) |
| 268 return select(3, C_LFGList.GetSearchResultInfo(id)) | 301 return select(3, C_LFGList.GetSearchResultInfo(id)) |
| 269 end | 302 end |
| 270 | 303 |
| 304 local function updateRealmType(id) | |
| 305 local name = select(12, C_LFGList.GetSearchResultInfo(id)) | |
| 306 local pname, realm = PlayerName(name); | |
| 307 return select(4, realmInfo:GetRealmInfo(realm)) or "???" | |
| 308 end | |
| 309 | |
| 310 local function updateGroupAge(id) | |
| 311 local age = select(7, C_LFGList.GetSearchResultInfo(id)) | |
| 312 return SecondsToTime(age, false, false, 1, false) | |
| 313 end | |
| 314 | |
| 315 local function sortBase(col, value) | |
| 316 local column = lfgTable.cols[col]; | |
| 317 local direction = column.sort or column.defaultsort or "asc" | |
| 318 if direction == "asc" then | |
| 319 return value | |
| 320 else | |
| 321 return not value; | |
| 322 end | |
| 323 end | |
| 324 | |
| 325 | |
| 326 local function sortByAge(self, rowa, rowb, sortbycol) | |
| 327 if rowa == nil or rowb == nil then return false end; -- wtf ScrollingTable??? | |
| 328 local row1 = lfgTable:GetRow(rowa); | |
| 329 local row2 = lfgTable:GetRow(rowb); | |
| 330 local age1 = select(7, C_LFGList.GetSearchResultInfo(row1.id)); | |
| 331 local age2 = select(7, C_LFGList.GetSearchResultInfo(row2.id)); | |
| 332 return sortBase(sortbycol, age1<age2); | |
| 333 end | |
| 334 | |
| 335 local function updateJoinAge(id) | |
| 336 local name = select(12, C_LFGList.GetSearchResultInfo(id)) | |
| 337 local ago = getJoinedAgo(name); | |
| 338 if ago then | |
| 339 return SecondsToTime(ago, false, false, 1, false) | |
| 340 else | |
| 341 return "" | |
| 342 end | |
| 343 end | |
| 344 | |
| 345 local function sortByJoinAge(self, rowa, rowb, sortbycol) | |
| 346 if rowa == nil or rowb == nil then return false end; -- wtf ScrollingTable??? | |
| 347 local row1 = lfgTable:GetRow(rowa); | |
| 348 local row2 = lfgTable:GetRow(rowb); | |
| 349 local joinAge1 = getJoinedAgo(select(12, C_LFGList.GetSearchResultInfo(row1.id))) or 1e10; | |
| 350 local joinAge2 = getJoinedAgo(select(12, C_LFGList.GetSearchResultInfo(row2.id))) or 1e10; | |
| 351 return sortBase(sortbycol, joinAge1<joinAge2); | |
| 352 end | |
| 353 | |
| 354 local function sortByScore(self, rowa, rowb, sortbycol) | |
| 355 if rowa == nil or rowb == nil then return false end; -- wtf ScrollingTable??? | |
| 356 local row1 = lfgTable:GetRow(rowa); | |
| 357 local row2 = lfgTable:GetRow(rowb); | |
| 358 return row1.weight > row2.weight; | |
| 359 end | |
| 360 | |
| 271 local function updateGroupCount(id) | 361 local function updateGroupCount(id) |
| 272 return select(13, C_LFGList.GetSearchResultInfo(id)) | 362 return select(13, C_LFGList.GetSearchResultInfo(id)) |
| 273 end | 363 end |
| 274 | 364 |
| 275 local function updateGroupRealm(id) | 365 local function updateGroupRealm(id) |
| 276 local name = select(12, C_LFGList.GetSearchResultInfo(id)) | 366 local name = select(12, C_LFGList.GetSearchResultInfo(id)) |
| 277 local pname, realm = PlayerName(name); | 367 local pname, realm = PlayerName(name); |
| 278 return realm | 368 return realm; |
| 279 end | 369 end |
| 280 | 370 |
| 281 local COLOR_YELLOW = {r=1,g=1,b=0,a=1} | 371 local COLOR_YELLOW = {r=1,g=1,b=0,a=1} |
| 372 local COLOR_WHITE = {r=1,g=1,b=1,a=1} | |
| 282 local COLOR_GREEN = {r=0,g=1,b=0,a=1} | 373 local COLOR_GREEN = {r=0,g=1,b=0,a=1} |
| 374 local COLOR_RED = {r=1,g=0,b=0,a=1} | |
| 375 local COLOR_GREY = {r=0.5,g=0.5,b=0.5,a=1} | |
| 283 local function updateRealmColor(id) | 376 local function updateRealmColor(id) |
| 284 local name = select(12, C_LFGList.GetSearchResultInfo(id)) | 377 local name = select(12, C_LFGList.GetSearchResultInfo(id)) |
| 285 local pname, realm = PlayerName(name); | 378 local pname, realm = PlayerName(name); |
| 286 return recentRealms[realm] and COLOR_YELLOW or COLOR_GREEN; | 379 return recentRealms[realm] and COLOR_YELLOW or COLOR_GREEN; |
| 287 end | 380 end |
| 288 | 381 |
| 382 local function updateNameColor(id) | |
| 383 local name = select(3, C_LFGList.GetSearchResultInfo(id)) | |
| 384 if searchInList(name, db.global.highlightList) then return COLOR_GREEN end; | |
| 385 if searchInList(name, db.global.stoplist) then return COLOR_GREY end; | |
| 386 if searchInList(name, db.global.priorityList) then return COLOR_YELLOW end; | |
| 387 return COLOR_WHITE; | |
| 388 end | |
| 389 | |
| 289 local function filterTable(self, row) | 390 local function filterTable(self, row) |
| 290 local _, _, _, _, _, _, _, _, _, _, delisted, _, pcount, autoinv = C_LFGList.GetSearchResultInfo(row.id) | 391 local _, _, caption, desc, _, _, _, _, _, _, delisted, _, pcount, autoinv = C_LFGList.GetSearchResultInfo(row.id) |
| 291 if delisted then return false end; | 392 if delisted then return false end; |
| 292 if pcount > 5 and cbHideRaids:GetChecked() then return false end; | 393 if filterByCountId > 1 then |
| 293 if pcount <= 5 and cbHideGroups:GetChecked() then return false end; | 394 local fobj = filterByCountList[filterByCountId]; |
| 395 if pcount < fobj.min or pcount > fobj.max then return false end; | |
| 396 end | |
| 294 if not autoinv and cbHideNoAutoinv:GetChecked() then return false end; | 397 if not autoinv and cbHideNoAutoinv:GetChecked() then return false end; |
| 398 if filterString then | |
| 399 caption = string.lower(caption); | |
| 400 desc = string.lower(desc); | |
| 401 if not (string.find(caption, filterString, 1, true) or string.find(desc, filterString, 1, true))then return false end | |
| 402 end | |
| 295 return true; | 403 return true; |
| 296 end | 404 end |
| 297 | 405 |
| 298 function addon:UpdateResponseData(event, result) | 406 function addon:UpdateResponseData(event, result) |
| 299 if not lfgTable then return end | 407 if not lfgTable then return end |
| 305 | 413 |
| 306 local function refreshLFGList() | 414 local function refreshLFGList() |
| 307 if lfgScanInProgress or not lfgTable then return end | 415 if lfgScanInProgress or not lfgTable then return end |
| 308 local count, list = C_LFGList.GetSearchResults() | 416 local count, list = C_LFGList.GetSearchResults() |
| 309 local tableData = {} | 417 local tableData = {} |
| 418 local extraColumnId = 4; | |
| 419 | |
| 310 for i = 1,count do | 420 for i = 1,count do |
| 311 local rid = list[i]; | 421 local rid = list[i]; |
| 312 if not rid then break end | 422 if not rid then break end |
| 313 local data = list[i]; | 423 local data = list[i]; |
| 314 local cols = {} | 424 local cols = {} |
| 315 local row = {rid} | 425 local row = {rid} |
| 316 cols[1] = {value=updateGroupName,args=row} | 426 for i=1, #tableTemplate do |
| 317 cols[2] = {value=updateGroupCount,args=row} | 427 local item = tableTemplate[i]; |
| 318 cols[3] = {value=updateGroupRealm,args=row,color=updateRealmColor,colorargs=row} | 428 local cell = {value=item.value, args=row } |
| 319 cols[4] = {} | 429 if item.color then |
| 430 cell.color = item.color; | |
| 431 cell.colorargs = row; | |
| 432 end | |
| 433 cols[i] = cell | |
| 434 end | |
| 320 table.insert(tableData, {cols=cols,id=rid,weight=WeightLfgItem(rid)}) | 435 table.insert(tableData, {cols=cols,id=rid,weight=WeightLfgItem(rid)}) |
| 321 end | 436 end |
| 322 table.sort(tableData, sortByWeight); | |
| 323 lfgTable:SetData(tableData) | 437 lfgTable:SetData(tableData) |
| 324 if #tableData == 0 then | 438 if #tableData == 0 then |
| 325 lbThrottle:SetText("No groups found") | 439 lbThrottle:SetText("No groups found") |
| 326 end | 440 end |
| 327 end | 441 end |
| 332 addon:SetGroupJoinStatus(rid, "_init") | 446 addon:SetGroupJoinStatus(rid, "_init") |
| 333 C_LFGList.ApplyToGroup(rid, "", tank and noHealTank, heal and noHealTank, dd) | 447 C_LFGList.ApplyToGroup(rid, "", tank and noHealTank, heal and noHealTank, dd) |
| 334 end | 448 end |
| 335 | 449 |
| 336 local function TableCellClick(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...) | 450 local function TableCellClick(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...) |
| 337 if not realrow or not canJoinGroup() then return end | 451 if not realrow then return end |
| 338 local rowdata = scrollingTable:GetRow(realrow); | 452 local rowdata = scrollingTable:GetRow(realrow); |
| 339 JoinGroup(rowdata.id) | 453 if canJoinGroup() then |
| 454 JoinGroup(rowdata.id) | |
| 455 else | |
| 456 LeaveParty() | |
| 457 end | |
| 340 end | 458 end |
| 341 | 459 |
| 342 | 460 |
| 343 | 461 |
| 344 | 462 |
| 351 tooltip:Show() | 469 tooltip:Show() |
| 352 end | 470 end |
| 353 | 471 |
| 354 function addon:OnInitialize() | 472 function addon:OnInitialize() |
| 355 db = LibStub("AceDB-3.0"):New("CrossRealmAssistDB", SettingsDefaults) | 473 db = LibStub("AceDB-3.0"):New("CrossRealmAssistDB", SettingsDefaults) |
| 474 addon.db = db; | |
| 356 local minimapData = ldb:NewDataObject("CrossRealmAssistMinimapIcon",{ | 475 local minimapData = ldb:NewDataObject("CrossRealmAssistMinimapIcon",{ |
| 357 type = "data source", | 476 type = "data source", |
| 358 text = "Cross Realm Assist", | 477 text = "Cross Realm Assist", |
| 359 icon = "Interface/Icons/INV_Misc_GroupNeedMore", | 478 icon = "Interface/Icons/INV_Misc_GroupNeedMore", |
| 360 OnClick = addon.Activate, | 479 OnClick = addon.Activate, |
| 426 local point,_,_,x,y = gui:GetPoint(1); | 545 local point,_,_,x,y = gui:GetPoint(1); |
| 427 db.global.widgetPos = {x=x,y=y,to=point} | 546 db.global.widgetPos = {x=x,y=y,to=point} |
| 428 end | 547 end |
| 429 | 548 |
| 430 function addon:CreateUI() | 549 function addon:CreateUI() |
| 431 gui = setupWidget(CreateFrame("Frame","CrossRealmAssistMainUI",nil,"InsetFrameTemplate3"), {SetFrameStrata="LOW",SetWidth=208,SetHeight=60,EnableMouse=true,SetMovable=true,SetClampedToScreen=true}) | 550 local scale = db.global.uiScale or 1.0; |
| 551 gui = setupWidget(CreateFrame("Frame","CrossRealmAssistMainUI",nil,"InsetFrameTemplate3"), {SetFrameStrata="LOW",SetWidth=208,SetHeight=60,EnableMouse=true,SetMovable=true,SetClampedToScreen=true,SetScale=scale}) | |
| 432 local title = setupWidget(CreateFrame("Frame",nil,gui), {SetWidth=190,SetHeight=18,EnableMouse=true,RegisterForDrag="LeftButton"}, 0, 6); | 552 local title = setupWidget(CreateFrame("Frame",nil,gui), {SetWidth=190,SetHeight=18,EnableMouse=true,RegisterForDrag="LeftButton"}, 0, 6); |
| 433 title:SetScript("OnDragStart", function() gui:StartMoving() end) | 553 title:SetScript("OnDragStart", function() gui:StartMoving() end) |
| 434 title:SetScript("OnDragStop", stopMovingWidget) | 554 title:SetScript("OnDragStop", stopMovingWidget) |
| 435 gui:SetScript("OnHide", addon.Deactivate) | 555 gui:SetScript("OnHide", addon.Deactivate) |
| 436 setupTooltip(title, "ANCHOR_TOP", realmToolip) | 556 setupTooltip(title, "ANCHOR_TOP", realmToolip) |
| 480 | 600 |
| 481 function addon.refreshList() | 601 function addon.refreshList() |
| 482 lfgTable:SetFilter(filterTable) | 602 lfgTable:SetFilter(filterTable) |
| 483 end | 603 end |
| 484 | 604 |
| 605 local function updateFilter(self) | |
| 606 SearchBoxTemplate_OnTextChanged(self) | |
| 607 filterString = string.lower(edFilterText:GetText()); | |
| 608 if filterString == "" then filterString = nil end; | |
| 609 addon.refreshList() | |
| 610 end | |
| 611 | |
| 612 local function updateFilterByCount(btn, arg1, arg2, checked) | |
| 613 filterByCountId = arg1; | |
| 614 local filterObj = filterByCountList[arg1]; | |
| 615 UIDropDownMenu_SetText(btFilterCount, "Count: "..filterObj.min.."-"..filterObj.max); | |
| 616 addon.refreshList() | |
| 617 end | |
| 618 | |
| 619 local function numberFilter(self, level, menuList) | |
| 620 for i=1,#filterByCountList do | |
| 621 UIDropDownMenu_AddButton({text=filterByCountList[i].text, arg1=i,checked=(i==filterByCountId), func=updateFilterByCount}, level) | |
| 622 end | |
| 623 end | |
| 624 | |
| 485 function addon:CreateLFGUI() | 625 function addon:CreateLFGUI() |
| 486 lfgui = setupWidget(CreateFrame("Frame","CrossRealmAssistJoinUI",nil,"UIPanelDialogTemplate"), {SetFrameStrata="DIALOG",SetWidth=405,SetHeight=323,EnableMouse=true,SetMovable=true}) | 626 local scale = db.global.lfgPanelScale or 1.0; |
| 627 local itemCount = db.global.listItemCount; | |
| 628 local shift = itemCount * 16; | |
| 629 | |
| 630 tableTemplate = { | |
| 631 {name="Title",width=160, value = updateGroupName, color = updateNameColor}, | |
| 632 {name="#",width=30,align="CENTER",value = updateGroupCount}, | |
| 633 {name="Realm",width=120,align="RIGHT",value = updateGroupRealm, color = updateRealmColor} | |
| 634 } | |
| 635 | |
| 636 extraColumns = db.global.extraColumns; | |
| 637 if extraColumns.rtype then table.insert(tableTemplate, {name="Type",width=40,align="CENTER", value = updateRealmType}) end; | |
| 638 if extraColumns.groupAge then table.insert(tableTemplate, {name="Age",width=45,align="CENTER",comparesort=sortByAge, value = updateGroupAge}) end; | |
| 639 if extraColumns.joinTime then table.insert(tableTemplate, {name="Joined",width=45,align="CENTER",comparesort=sortByJoinAge, value = updateJoinAge}) end; | |
| 640 table.insert(tableTemplate, {name="Misc",width=50,DoCellUpdate=updateTableData,comparesort=sortByScore,align="RIGHT",sort="asc"}) | |
| 641 | |
| 642 local tableWidth = 0; | |
| 643 for i=1,#tableTemplate do | |
| 644 tableWidth = tableWidth + tableTemplate[i].width; | |
| 645 end | |
| 646 | |
| 647 | |
| 648 lfgui = setupWidget(CreateFrame("Frame","CrossRealmAssistJoinUI",nil,"UIPanelDialogTemplate"), {SetFrameStrata="DIALOG",SetWidth=tableWidth+45,SetHeight=shift+95,EnableMouse=true,SetMovable=true,SetScale=scale}) | |
| 487 lfgui.title:SetText("Click to join group") | 649 lfgui.title:SetText("Click to join group") |
| 488 lfgui:SetScript("OnUpdate",addon.lfgUpdate) | 650 lfgui:SetScript("OnUpdate",addon.lfgUpdate) |
| 489 local titlereg = lfgui:CreateTitleRegion() | 651 local titlereg = lfgui:CreateTitleRegion() |
| 490 titlereg:SetAllPoints(lfgui.title) | 652 titlereg:SetAllPoints(lfgui.title) |
| 491 addon:CreateTabs() | 653 addon:CreateTabs() |
| 492 | 654 |
| 493 lfgTable = ScrollingTable:CreateST({ | 655 lfgTable = ScrollingTable:CreateST(tableTemplate,itemCount,16,nil,lfgui); |
| 494 {name="Title",width=160}, | |
| 495 {name="#",width=30,align="CENTER"}, | |
| 496 {name="Realm",width=120,align="RIGHT"}, | |
| 497 {name="",width=50,DoCellUpdate=updateTableData} | |
| 498 },15,16,nil,lfgui); | |
| 499 | 656 |
| 500 lfgTable:RegisterEvents({OnEnter=ShowLfgInfo,OnLeave=HideTooltip,OnClick=TableCellClick}) | 657 lfgTable:RegisterEvents({OnEnter=ShowLfgInfo,OnLeave=HideTooltip,OnClick=TableCellClick}) |
| 501 | 658 |
| 502 setupWidget(lfgTable.frame, nil, 10, 45); | 659 setupWidget(lfgTable.frame, nil, 10, 45); |
| 503 lfgTable.frame:SetBackdrop(nil) | 660 lfgTable.frame:SetBackdrop(nil) |
| 504 lfgui:SetPoint("CENTER",0,0) | 661 lfgui:SetPoint("CENTER",0,0) |
| 505 refreshLFGList() | 662 refreshLFGList() |
| 506 | 663 |
| 507 lbThrottle = setupWidget(lfgui:CreateFontString(nil,"BACKGROUND", "GameFontHighlightSmall"), {SetWidth=300}, 50, 100) | 664 lbThrottle = setupWidget(lfgui:CreateFontString(nil,"BACKGROUND", "GameFontHighlightSmall"), {SetWidth=tableWidth}, 0, 100) |
| 508 lbThrottle:Hide(); | 665 lbThrottle:Hide(); |
| 509 | 666 |
| 510 local btRefresh = setupWidget(CreateFrame("Button",nil,lfgui,"UIPanelSquareButton"),{SetWidth=22,SetHeight=22},379,27) | 667 local btRefresh = setupWidget(CreateFrame("Button",nil,lfgui,"UIPanelSquareButton"),{SetWidth=22,SetHeight=22},tableWidth+19,27) |
| 511 btRefresh.icon:SetTexture("Interface/BUTTONS/UI-RefreshButton") | 668 btRefresh.icon:SetTexture("Interface/BUTTONS/UI-RefreshButton") |
| 512 btRefresh.icon:SetTexCoord(0,1,0,1); | 669 btRefresh.icon:SetTexCoord(0,1,0,1); |
| 513 btRefresh:SetScript("OnClick",addon.refreshLfgCurrent) | 670 btRefresh:SetScript("OnClick",addon.refreshLfgCurrent) |
| 514 | 671 |
| 515 setupWidget(CreateFrame("Frame",nil,lfgui,"HorizontalBarTemplate"),{SetWidth=392,SetHeight=2}, 8, 294) | 672 setupWidget(CreateFrame("Frame",nil,lfgui,"HorizontalBarTemplate"),{SetWidth=tableWidth+32,SetHeight=2}, 8, shift+54) |
| 516 local text = setupWidget(lfgui:CreateFontString(nil,"BACKGROUND", "GameFontHighlightSmall"), {SetText="Hide:"}, 20, 302) | 673 local text = setupWidget(lfgui:CreateFontString(nil,"BACKGROUND", "GameFontHighlightSmall"), {SetText="Filters:"}, 20, shift+68) |
| 517 | 674 |
| 518 cbHideGroups = setupWidget(CreateFrame("CheckButton",nil,lfgui,"UICheckButtonTemplate"),{SetWidth=22,SetHeight=22}) | 675 btFilterCount = CreateFrame("FRAME", "CrossRealmAssistCountFilter", lfgui, "UIDropDownMenuTemplate") |
| 519 cbHideGroups:SetPoint("TOPLEFT",text,"TOPRIGHT",5,7) | 676 UIDropDownMenu_SetWidth(btFilterCount, 90) |
| 677 UIDropDownMenu_SetText(btFilterCount, "By count") | |
| 678 UIDropDownMenu_Initialize(btFilterCount, numberFilter) | |
| 679 btFilterCount:SetPoint("TOPLEFT",text,"TOPRIGHT",-10,10) | |
| 680 | |
| 681 cbHideNoAutoinv = setupWidget(CreateFrame("CheckButton",nil,lfgui,"UICheckButtonTemplate"),{SetWidth=22,SetHeight=22}) | |
| 682 cbHideNoAutoinv:SetPoint("TOPLEFT",btFilterCount,"TOPRIGHT",-10,-3) | |
| 683 cbHideNoAutoinv:SetScript("OnClick",addon.refreshList) | |
| 684 text = setupWidget(lfgui:CreateFontString(nil,"BACKGROUND", "GameFontHighlightSmall"), {SetText="Autoaccept only"}) | |
| 685 text:SetPoint("TOPLEFT",cbHideNoAutoinv,"TOPRIGHT",0,-7) | |
| 686 | |
| 687 edFilterText = setupWidget(CreateFrame("EditBox",nil,lfgui,"SearchBoxTemplate"),{SetHeight=22}) | |
| 688 edFilterText:SetPoint("TOPLEFT",text,"TOPRIGHT",10,7) | |
| 689 edFilterText:SetPoint("TOPRIGHT",lfgui,"BOTTOMRIGHT",-10,0) | |
| 690 edFilterText:SetScript("OnTextChanged",updateFilter) | |
| 691 | |
| 692 --[[cbHideGroups = setupWidget(CreateFrame("CheckButton",nil,lfgui,"UICheckButtonTemplate"),{SetWidth=22,SetHeight=22}) | |
| 693 cbHideGroups:SetPoint("TOPLEFT",btFilterCount,"TOPRIGHT",5,7) | |
| 520 cbHideGroups:SetScript("OnClick",addon.refreshList) | 694 cbHideGroups:SetScript("OnClick",addon.refreshList) |
| 521 text = setupWidget(lfgui:CreateFontString(nil,"BACKGROUND", "GameFontHighlightSmall"), {SetText="5p Groups"}) | 695 text = setupWidget(lfgui:CreateFontString(nil,"BACKGROUND", "GameFontHighlightSmall"), {SetText="5p Groups"}) |
| 522 text:SetPoint("TOPLEFT",cbHideGroups,"TOPRIGHT",0,-7) | 696 text:SetPoint("TOPLEFT",cbHideGroups,"TOPRIGHT",0,-7) |
| 523 | 697 |
| 524 cbHideRaids = setupWidget(CreateFrame("CheckButton",nil,lfgui,"UICheckButtonTemplate"),{SetWidth=22,SetHeight=22}) | 698 cbHideRaids = setupWidget(CreateFrame("CheckButton",nil,lfgui,"UICheckButtonTemplate"),{SetWidth=22,SetHeight=22}) |
| 529 | 703 |
| 530 cbHideNoAutoinv = setupWidget(CreateFrame("CheckButton",nil,lfgui,"UICheckButtonTemplate"),{SetWidth=22,SetHeight=22}) | 704 cbHideNoAutoinv = setupWidget(CreateFrame("CheckButton",nil,lfgui,"UICheckButtonTemplate"),{SetWidth=22,SetHeight=22}) |
| 531 cbHideNoAutoinv:SetPoint("TOPLEFT",text,"TOPRIGHT",5,7) | 705 cbHideNoAutoinv:SetPoint("TOPLEFT",text,"TOPRIGHT",5,7) |
| 532 cbHideNoAutoinv:SetScript("OnClick",addon.refreshList) | 706 cbHideNoAutoinv:SetScript("OnClick",addon.refreshList) |
| 533 text = setupWidget(lfgui:CreateFontString(nil,"BACKGROUND", "GameFontHighlightSmall"), {SetText="Groups w/o Autoinvite"}) | 707 text = setupWidget(lfgui:CreateFontString(nil,"BACKGROUND", "GameFontHighlightSmall"), {SetText="Groups w/o Autoinvite"}) |
| 534 text:SetPoint("TOPLEFT",cbHideNoAutoinv,"TOPRIGHT",0,-7) | 708 text:SetPoint("TOPLEFT",cbHideNoAutoinv,"TOPRIGHT",0,-7)]] |
| 535 end | 709 end |
| 536 | 710 |
| 537 function addon:CreateTabs() | 711 function addon:CreateTabs() |
| 538 local prevTab | 712 local prevTab |
| 539 for i=1,#lfgGroups do | 713 for i=1,#addon.lfgGroups do |
| 540 local tab = CreateFrame("Button","$parentTab"..i,lfgui,"CharacterFrameTabButtonTemplate") | 714 local tab = CreateFrame("Button","$parentTab"..i,lfgui,"CharacterFrameTabButtonTemplate") |
| 541 tab:SetText((C_LFGList.GetCategoryInfo(lfgGroups[i]))); | 715 tab:SetText((C_LFGList.GetCategoryInfo(addon.lfgGroups[i]))); |
| 542 tab.searchID = i; | 716 tab.searchID = i; |
| 543 tab:SetID(i); | 717 tab:SetID(i); |
| 544 PanelTemplates_TabResize(tab, 0) | 718 PanelTemplates_TabResize(tab, 0) |
| 545 if i == 1 then | 719 if i == 1 then |
| 546 tab:SetPoint("TOPLEFT", lfgui, "BOTTOMLEFT", 10, 7) | 720 tab:SetPoint("TOPLEFT", lfgui, "BOTTOMLEFT", 10, 7) |
| 564 function addon.refreshLfgCurrent() | 738 function addon.refreshLfgCurrent() |
| 565 addon.LfgScan(curLfgGroup) | 739 addon.LfgScan(curLfgGroup) |
| 566 end | 740 end |
| 567 | 741 |
| 568 function addon.GetNextAutoScanCategory() | 742 function addon.GetNextAutoScanCategory() |
| 569 for i=1,#lfgGroups do | 743 for i=1,#addon.lfgGroups do |
| 570 if not autoScanGroups[i] and db.global.quickJoin[lfgGroups[i]] and i ~= curLfgGroup then return i end | 744 if not autoScanGroups[i] and db.global.quickJoin[addon.lfgGroups[i]] and i ~= curLfgGroup then return i end |
| 571 end | 745 end |
| 572 return nil | 746 return nil |
| 573 end | 747 end |
| 574 | 748 |
| 575 function addon.LfgScan(group) | 749 function addon.LfgScan(group) |
| 578 changeTab(tabs[group]) | 752 changeTab(tabs[group]) |
| 579 end | 753 end |
| 580 lfgScanInProgress = true | 754 lfgScanInProgress = true |
| 581 curLfgGroup = group | 755 curLfgGroup = group |
| 582 local languages = db.global.allLanguages and allLanguageTable or C_LFGList.GetLanguageSearchFilter(); | 756 local languages = db.global.allLanguages and allLanguageTable or C_LFGList.GetLanguageSearchFilter(); |
| 583 C_LFGList.Search(lfgGroups[curLfgGroup],"",nil,nil,languages) | 757 C_LFGList.Search(addon.lfgGroups[curLfgGroup],"",nil,nil,languages) |
| 584 end | 758 end |
| 585 | 759 |
| 586 function addon:LfgScanFailed(event, reason) | 760 function addon:LfgScanFailed(event, reason) |
| 587 reason = reason or "Unknown reason"; | 761 reason = reason or "Unknown reason"; |
| 588 if reason == "throttled" then | 762 if reason == "throttled" then |
| 852 func = function(self) | 1026 func = function(self) |
| 853 autoScanGroups[curLfgGroup] = 1 | 1027 autoScanGroups[curLfgGroup] = 1 |
| 854 addon.LfgScan(self.category) | 1028 addon.LfgScan(self.category) |
| 855 end, | 1029 end, |
| 856 tooltip = function(self) | 1030 tooltip = function(self) |
| 857 GameTooltip:AddLine("Scan "..(C_LFGList.GetCategoryInfo(lfgGroups[self.category]))) | 1031 GameTooltip:AddLine("Scan "..(C_LFGList.GetCategoryInfo(addon.lfgGroups[self.category]))) |
| 858 end, | 1032 end, |
| 859 text = "Scan more" | 1033 text = "Scan more" |
| 860 } | 1034 } |
| 861 | 1035 |
| 862 local NeedReset = { | 1036 local NeedReset = { |
| 879 local ShowQuickHint = { | 1053 local ShowQuickHint = { |
| 880 tooltip = "Quick Join", | 1054 tooltip = "Quick Join", |
| 881 text = "Quick Join", | 1055 text = "Quick Join", |
| 882 func = function() | 1056 func = function() |
| 883 StaticPopupDialogs["CROSS_REALM_ASSIST"] = { | 1057 StaticPopupDialogs["CROSS_REALM_ASSIST"] = { |
| 884 text = "Quick Join button will automatically join you to a random group with autoinvite and medium number of players. You never join same group twice, you need to clear join history to do so. This message can be disabled in options.", | 1058 text = "Quick Join button will automatically join you to a random group with autoaccept and medium number of players. You never join same group twice, you need to clear join history to do so. This message can be disabled in options.", |
| 885 button1 = OKAY, | 1059 button1 = OKAY, |
| 886 hideOnEscape = true, | 1060 hideOnEscape = true, |
| 887 preferredIndex = 3, | 1061 preferredIndex = 3, |
| 888 } | 1062 } |
| 889 StaticPopup_Show("CROSS_REALM_ASSIST") | 1063 StaticPopup_Show("CROSS_REALM_ASSIST") |
| 958 end | 1132 end |
| 959 end | 1133 end |
| 960 | 1134 |
| 961 -- Settings | 1135 -- Settings |
| 962 | 1136 |
| 963 local function toggleMinimapIcon(btn, arg1, arg2, checked) | 1137 function addon.toggleMinimapIcon(hidden) |
| 964 local hidden = not checked; | |
| 965 db.global.minimap.hide = hidden; | |
| 966 if hidden then | 1138 if hidden then |
| 967 DEFAULT_CHAT_FRAME:AddMessage("|cffff0000Type |cffffffff/cra |cffff0000in chat to open Cross Realm Assist without minimap button"); | 1139 DEFAULT_CHAT_FRAME:AddMessage("|cffff0000Type |cffffffff/cra |cffff0000in chat to open Cross Realm Assist without minimap button"); |
| 968 minimapIcon:Hide("CrossRealmAssistMinimapIcon") | 1140 minimapIcon:Hide("CrossRealmAssistMinimapIcon") |
| 969 else | 1141 else |
| 970 minimapIcon:Show("CrossRealmAssistMinimapIcon") | 1142 minimapIcon:Show("CrossRealmAssistMinimapIcon") |
| 971 end | 1143 end |
| 972 end | 1144 end |
| 973 | 1145 |
| 1146 function addon.updateLfgScale(scale) | |
| 1147 if lfgui then lfgui:SetScale(scale) end; | |
| 1148 end | |
| 1149 | |
| 1150 function addon.updateUIScale(scale) | |
| 1151 if gui then gui:SetScale(scale) end; | |
| 1152 end | |
| 1153 | |
| 974 local function toggleQuickJoinHint(btn, arg1, arg2, checked) | 1154 local function toggleQuickJoinHint(btn, arg1, arg2, checked) |
| 975 db.global.quickJoinHint = checked | 1155 db.global.quickJoinHint = checked |
| 976 end | 1156 end |
| 977 | 1157 |
| 978 local function toggleQuickJoin(btn, arg1, arg2, checked) | 1158 local function toggleQuickJoin(btn, arg1, arg2, checked) |
| 988 end | 1168 end |
| 989 | 1169 |
| 990 local function toggleCreateHopGroup(btn, arg1, arg2, checked) | 1170 local function toggleCreateHopGroup(btn, arg1, arg2, checked) |
| 991 db.global.autoCreateHopGroup = checked | 1171 db.global.autoCreateHopGroup = checked |
| 992 if checked then addon:RegisterEvent("PLAYER_FLAGS_CHANGED", "PlayerFlagsUpdate") end | 1172 if checked then addon:RegisterEvent("PLAYER_FLAGS_CHANGED", "PlayerFlagsUpdate") end |
| 1173 end | |
| 1174 | |
| 1175 local function joinFriendGroup(btn, rid) | |
| 1176 JoinGroup(rid); | |
| 993 end | 1177 end |
| 994 | 1178 |
| 995 local function ClearJoinHistory() | 1179 local function ClearJoinHistory() |
| 996 recentgroups = {} | 1180 recentgroups = {} |
| 997 addon:UpdateAutoButtonStatus() | 1181 addon:UpdateAutoButtonStatus() |
| 1022 end | 1206 end |
| 1023 | 1207 |
| 1024 local function initMenu(self, level) | 1208 local function initMenu(self, level) |
| 1025 if not level then return end | 1209 if not level then return end |
| 1026 if level == 1 then | 1210 if level == 1 then |
| 1211 UIDropDownMenu_AddButton({text="Clear join history",notCheckable=1,func=ClearJoinHistory}, level) | |
| 1027 UIDropDownMenu_AddButton({text="Clear realm history",notCheckable=1,func=ClearRealmHistory}, level) | 1212 UIDropDownMenu_AddButton({text="Clear realm history",notCheckable=1,func=ClearRealmHistory}, level) |
| 1028 UIDropDownMenu_AddButton({text="Clear join history",notCheckable=1,func=ClearJoinHistory}, level) | 1213 UIDropDownMenu_AddButton({disabled=1,notCheckable=1}, level) |
| 1029 | 1214 |
| 1030 if canJoinGroup() then | 1215 UIDropDownMenu_AddButton({text="Cross Realm Assist Toolbox",notCheckable=1,func=CreateHopGroup,isTitle=1}, level) |
| 1031 UIDropDownMenu_AddButton({disabled=1,notCheckable=1}, level) | 1216 UIDropDownMenu_AddButton({text="Show Quick Join Hint",checked=db.global.quickJoinHint, func=toggleQuickJoinHint,keepShownOnClick=true,isNotRadio=true}, level) |
| 1217 if canJoinGroup() then | |
| 1032 UIDropDownMenu_AddButton({text="Create a group for realm hoppers",notCheckable=1,func=CreateHopGroup}, level) | 1218 UIDropDownMenu_AddButton({text="Create a group for realm hoppers",notCheckable=1,func=CreateHopGroup}, level) |
| 1219 UIDropDownMenu_AddButton({text="Join to a friend",notCheckable=1,hasArrow=1,value="jtf",keepShownOnClick=true}, level) | |
| 1033 end | 1220 end |
| 1034 | 1221 |
| 1035 UIDropDownMenu_AddButton({disabled=1,notCheckable=1}, level) | 1222 UIDropDownMenu_AddButton({disabled=1,notCheckable=1}, level) |
| 1036 UIDropDownMenu_AddButton({text="Show Quick Join Hint",checked=db.global.quickJoinHint, func=toggleQuickJoinHint,keepShownOnClick=true,isNotRadio=true}, level) | 1223 UIDropDownMenu_AddButton({text="Settings...",notCheckable=1,func=addon.showSettings}, level) |
| 1037 UIDropDownMenu_AddButton({text="Settings",notCheckable=1,hasArrow=1,value="settings",keepShownOnClick=true}, level) | |
| 1038 elseif level == 2 then | 1224 elseif level == 2 then |
| 1039 if UIDROPDOWNMENU_MENU_VALUE == "settings" then | 1225 if UIDROPDOWNMENU_MENU_VALUE == "jtf" then |
| 1040 UIDropDownMenu_AddButton({text="Show Minimap Button",checked=not db.global.minimap.hide, func=toggleMinimapIcon,keepShownOnClick=true,isNotRadio=true}, level) | 1226 local count, list = C_LFGList.GetSearchResults() |
| 1041 UIDropDownMenu_AddButton({text="All language groups",checked=db.global.allLanguages, func=toggleAllLanguages,keepShownOnClick=true,isNotRadio=true}, level) | 1227 local friends = {} |
| 1042 UIDropDownMenu_AddButton({text="Apply to groups as DD only",checked=db.global.applyAsDD, func=toggleApplyAsDD,keepShownOnClick=true,isNotRadio=true}, level) | 1228 for i = 1,count do |
| 1043 UIDropDownMenu_AddButton({disabled=1,notCheckable=1}, level) | 1229 local rid = list[i]; |
| 1044 UIDropDownMenu_AddButton({text="Quick join categories",notCheckable=1,hasArrow=1,value="qjc",keepShownOnClick=true}, level) | 1230 if not rid then break end |
| 1045 UIDropDownMenu_AddButton({text="Edit Quick Join Stoplist",notCheckable=1,func=QuickJoinStoplist}, level) | 1231 local bnf, chf, gf = C_LFGList.GetSearchResultFriends(rid) |
| 1046 UIDropDownMenu_AddButton({disabled=1,notCheckable=1}, level) | 1232 for j=1,#bnf do table.insert(friends,{name="|cFF00B1F0"..bnf[j],type=0,id=rid}) end |
| 1047 UIDropDownMenu_AddButton({text="Experimental features",notCheckable=1,hasArrow=1,value="experimental",keepShownOnClick=true}, level) | 1233 for j=1,#chf do table.insert(friends,{name="|cFFFF80FF"..chf[j],type=1,id=rid}) end |
| 1048 end | 1234 for j=1,#gf do table.insert(friends,{name="|cFF40FF40"..gf[j],type=2,id=rid}) end |
| 1049 elseif level == 3 then | 1235 end |
| 1050 if UIDROPDOWNMENU_MENU_VALUE == "qjc" then | 1236 if #friends==0 then |
| 1051 for i=1,#lfgGroups do | 1237 UIDropDownMenu_AddButton({text="No friends found (click to refresh)",notCheckable=1,func=addon.refreshLfgCurrent}, level) |
| 1052 local groupId = lfgGroups[i] | 1238 else |
| 1053 UIDropDownMenu_AddButton({text=(C_LFGList.GetCategoryInfo(groupId)),checked=db.global.quickJoin[groupId],arg1=groupId,func=toggleQuickJoin,keepShownOnClick=true,isNotRadio=true}, level) | 1239 UIDropDownMenu_AddButton({text="Refresh",notCheckable=1,func=addon.refreshLfgCurrent}, level) |
| 1054 end | 1240 table.sort(friends, sortByTypeAndName); |
| 1055 elseif UIDROPDOWNMENU_MENU_VALUE == "experimental" then | 1241 for i=1,#friends do |
| 1056 UIDropDownMenu_AddButton({isTitle=1,text="Use at your own risk!",notCheckable=1}, level) | 1242 UIDropDownMenu_AddButton({text=friends[i].name,notCheckable=1,func=joinFriendGroup,arg1=friends[i].id}, level) |
| 1057 UIDropDownMenu_AddButton({text="Auto create group for realm hopping when AFK at garrison",checked=db.global.autoCreateHopGroup,keepShownOnClick=true,isNotRadio=true,func=toggleCreateHopGroup}, level) | 1243 end |
| 1058 end | 1244 end |
| 1245 end | |
| 1059 end | 1246 end |
| 1060 end | 1247 end |
| 1061 | 1248 |
| 1062 function addon.ShowSettings(frame) | 1249 function addon.ShowSettings(frame) |
| 1063 if not settingsMenu then | 1250 if not settingsMenu then |
