comparison CrossRealmAssist.lua @ 38:616d67ff7543 beta-0.8

* Patch 7.0 update
author ShadowTheAge
date Wed, 20 Jul 2016 10:40:16 +0300
parents f39b5803b4c1
children d12ccf325b4b
comparison
equal deleted inserted replaced
37:df9724d38109 38:616d67ff7543
197 return GetTime() - recentgroups[name].time 197 return GetTime() - recentgroups[name].time
198 end 198 end
199 end 199 end
200 200
201 local function WeightLfgItem(id, forAutoJoin) 201 local function WeightLfgItem(id, forAutoJoin)
202 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, unk1, time, bnetfr, charfr, guild, delisted, fullname, pcount, autoinv = C_LFGList.GetSearchResultInfo(id)
203 if delisted then return 0 end 203 if delisted then return 0 end
204 local name,realm = PlayerName(fullname); 204 local name,realm = PlayerName(fullname);
205 local ldesc = caption .. "|" .. desc; 205 local ldesc = caption .. "|" .. desc;
206 if searchInList(ldesc, db.global.stoplist) then return 0 end 206 if searchInList(ldesc, db.global.stoplist) then return 0 end
207 local isHopGroup = searchInList(ldesc, db.global.priorityList); 207 local isHopGroup = searchInList(ldesc, db.global.priorityList);
239 239
240 return leaderRealm * countWeight * visCoef * autoinvWeight * ageWeight * hopCoef; 240 return leaderRealm * countWeight * visCoef * autoinvWeight * ageWeight * hopCoef;
241 end 241 end
242 242
243 local function AddLfgGroupInfo(id, short) 243 local function AddLfgGroupInfo(id, short)
244 local _, action, caption, desc, voice, ilvl, time, bnetfr, charfr, guild, delisted, fullname, pcount, autoinv = C_LFGList.GetSearchResultInfo(id) 244 local _, action, caption, desc, voice, ilvl, unk1, time, bnetfr, charfr, guild, delisted, fullname, pcount, autoinv = C_LFGList.GetSearchResultInfo(id)
245 local friends = bnetfr+charfr+guild 245 local friends = bnetfr+charfr+guild
246 GameTooltip:ClearLines() 246 GameTooltip:ClearLines()
247 GameTooltip:AddLine(caption,1,1,1) 247 GameTooltip:AddLine(caption,1,1,1)
248 addTooltipLineIcon(desc ~= "", desc, nil, 0.5, 0.5, 0.5, true) 248 addTooltipLineIcon(desc ~= "", desc, nil, 0.5, 0.5, 0.5, true)
249 local name, realm = PlayerName(fullname) 249 local name, realm = PlayerName(fullname)
280 280
281 local function updateTableData(rowFrame, cellFrame, data, cols, row, realrow, column, fShow, table, ...) 281 local function updateTableData(rowFrame, cellFrame, data, cols, row, realrow, column, fShow, table, ...)
282 if fShow then 282 if fShow then
283 local rowdata = table:GetRow(realrow); 283 local rowdata = table:GetRow(realrow);
284 local icons = cellFrame.icons 284 local icons = cellFrame.icons
285 local _, action, caption, desc, voice, ilvl, time, bnetfr, charfr, guild, delisted, fullname, pcount, autoinv = C_LFGList.GetSearchResultInfo(rowdata.id) 285 local _, action, caption, desc, voice, ilvl, unk1, time, bnetfr, charfr, guild, delisted, fullname, pcount, autoinv = C_LFGList.GetSearchResultInfo(rowdata.id)
286 if not icons then 286 if not icons then
287 local miscdata = createIcon(cellFrame,READY_CHECK_WAITING_TEXTURE,0) 287 local miscdata = createIcon(cellFrame,READY_CHECK_WAITING_TEXTURE,0)
288 local autoinv = createIcon(cellFrame,READY_CHECK_READY_TEXTURE, 1) 288 local autoinv = createIcon(cellFrame,READY_CHECK_READY_TEXTURE, 1)
289 local visited = createIcon(cellFrame,READY_CHECK_NOT_READY_TEXTURE, 2) 289 local visited = createIcon(cellFrame,READY_CHECK_NOT_READY_TEXTURE, 2)
290 icons = {misc=miscdata, autoinv=autoinv, visited=visited} 290 icons = {misc=miscdata, autoinv=autoinv, visited=visited}
300 local function updateGroupName(id) 300 local function updateGroupName(id)
301 return select(3, C_LFGList.GetSearchResultInfo(id)) 301 return select(3, C_LFGList.GetSearchResultInfo(id))
302 end 302 end
303 303
304 local function updateRealmType(id) 304 local function updateRealmType(id)
305 local name = select(12, C_LFGList.GetSearchResultInfo(id)) 305 local name = select(13, C_LFGList.GetSearchResultInfo(id))
306 local pname, realm = PlayerName(name); 306 local pname, realm = PlayerName(name);
307 return select(4, realmInfo:GetRealmInfo(realm)) or "???" 307 return select(4, realmInfo:GetRealmInfo(realm)) or "???"
308 end 308 end
309 309
310 local function updateGroupAge(id) 310 local function updateGroupAge(id)
311 local age = select(7, C_LFGList.GetSearchResultInfo(id)) 311 local age = select(8, C_LFGList.GetSearchResultInfo(id))
312 return SecondsToTime(age, false, false, 1, false) 312 return SecondsToTime(age, false, false, 1, false)
313 end 313 end
314 314
315 local function sortBase(col, value) 315 local function sortBase(col, value)
316 local column = lfgTable.cols[col]; 316 local column = lfgTable.cols[col];
325 325
326 local function sortByAge(self, rowa, rowb, sortbycol) 326 local function sortByAge(self, rowa, rowb, sortbycol)
327 if rowa == nil or rowb == nil then return false end; -- wtf ScrollingTable??? 327 if rowa == nil or rowb == nil then return false end; -- wtf ScrollingTable???
328 local row1 = lfgTable:GetRow(rowa); 328 local row1 = lfgTable:GetRow(rowa);
329 local row2 = lfgTable:GetRow(rowb); 329 local row2 = lfgTable:GetRow(rowb);
330 local age1 = select(7, C_LFGList.GetSearchResultInfo(row1.id)); 330 local age1 = select(8, C_LFGList.GetSearchResultInfo(row1.id));
331 local age2 = select(7, C_LFGList.GetSearchResultInfo(row2.id)); 331 local age2 = select(8, C_LFGList.GetSearchResultInfo(row2.id));
332 return sortBase(sortbycol, age1<age2); 332 return sortBase(sortbycol, age1<age2);
333 end 333 end
334 334
335 local function updateJoinAge(id) 335 local function updateJoinAge(id)
336 local name = select(12, C_LFGList.GetSearchResultInfo(id)) 336 local name = select(13, C_LFGList.GetSearchResultInfo(id))
337 local ago = getJoinedAgo(name); 337 local ago = getJoinedAgo(name);
338 if ago then 338 if ago then
339 return SecondsToTime(ago, false, false, 1, false) 339 return SecondsToTime(ago, false, false, 1, false)
340 else 340 else
341 return "" 341 return ""
344 344
345 local function sortByJoinAge(self, rowa, rowb, sortbycol) 345 local function sortByJoinAge(self, rowa, rowb, sortbycol)
346 if rowa == nil or rowb == nil then return false end; -- wtf ScrollingTable??? 346 if rowa == nil or rowb == nil then return false end; -- wtf ScrollingTable???
347 local row1 = lfgTable:GetRow(rowa); 347 local row1 = lfgTable:GetRow(rowa);
348 local row2 = lfgTable:GetRow(rowb); 348 local row2 = lfgTable:GetRow(rowb);
349 local joinAge1 = getJoinedAgo(select(12, C_LFGList.GetSearchResultInfo(row1.id))) or 1e10; 349 local joinAge1 = getJoinedAgo(select(13, C_LFGList.GetSearchResultInfo(row1.id))) or 1e10;
350 local joinAge2 = getJoinedAgo(select(12, C_LFGList.GetSearchResultInfo(row2.id))) or 1e10; 350 local joinAge2 = getJoinedAgo(select(13, C_LFGList.GetSearchResultInfo(row2.id))) or 1e10;
351 return sortBase(sortbycol, joinAge1<joinAge2); 351 return sortBase(sortbycol, joinAge1<joinAge2);
352 end 352 end
353 353
354 local function sortByScore(self, rowa, rowb, sortbycol) 354 local function sortByScore(self, rowa, rowb, sortbycol)
355 if rowa == nil or rowb == nil then return false end; -- wtf ScrollingTable??? 355 if rowa == nil or rowb == nil then return false end; -- wtf ScrollingTable???
357 local row2 = lfgTable:GetRow(rowb); 357 local row2 = lfgTable:GetRow(rowb);
358 return row1.weight > row2.weight; 358 return row1.weight > row2.weight;
359 end 359 end
360 360
361 local function updateGroupCount(id) 361 local function updateGroupCount(id)
362 return select(13, C_LFGList.GetSearchResultInfo(id)) 362 return select(14, C_LFGList.GetSearchResultInfo(id))
363 end 363 end
364 364
365 local function updateGroupRealm(id) 365 local function updateGroupRealm(id)
366 local name = select(12, C_LFGList.GetSearchResultInfo(id)) 366 local name = select(13, C_LFGList.GetSearchResultInfo(id))
367 local pname, realm = PlayerName(name); 367 local pname, realm = PlayerName(name);
368 return realm; 368 return realm;
369 end 369 end
370 370
371 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} 372 local COLOR_WHITE = {r=1,g=1,b=1,a=1}
373 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} 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} 375 local COLOR_GREY = {r=0.5,g=0.5,b=0.5,a=1}
376 local function updateRealmColor(id) 376 local function updateRealmColor(id)
377 local name = select(12, C_LFGList.GetSearchResultInfo(id)) 377 local name = select(13, C_LFGList.GetSearchResultInfo(id))
378 local pname, realm = PlayerName(name); 378 local pname, realm = PlayerName(name);
379 return recentRealms[realm] and COLOR_YELLOW or COLOR_GREEN; 379 return recentRealms[realm] and COLOR_YELLOW or COLOR_GREEN;
380 end 380 end
381 381
382 local function updateNameColor(id) 382 local function updateNameColor(id)
386 if searchInList(name, db.global.priorityList) then return COLOR_YELLOW end; 386 if searchInList(name, db.global.priorityList) then return COLOR_YELLOW end;
387 return COLOR_WHITE; 387 return COLOR_WHITE;
388 end 388 end
389 389
390 local function filterTable(self, row) 390 local function filterTable(self, row)
391 local _, _, caption, desc, _, _, _, _, _, _, delisted, _, pcount, autoinv = C_LFGList.GetSearchResultInfo(row.id) 391 local _, _, caption, desc, _, _, _, _, _, _, _, delisted, _, pcount, autoinv = C_LFGList.GetSearchResultInfo(row.id)
392 if delisted then return false end; 392 if delisted then return false end;
393 if filterByCountId > 1 then 393 if filterByCountId > 1 then
394 local fobj = filterByCountList[filterByCountId]; 394 local fobj = filterByCountList[filterByCountId];
395 if pcount < fobj.min or pcount > fobj.max then return false end; 395 if pcount < fobj.min or pcount > fobj.max then return false end;
396 end 396 end
403 return true; 403 return true;
404 end 404 end
405 405
406 function addon:UpdateResponseData(event, result) 406 function addon:UpdateResponseData(event, result)
407 if not lfgTable then return end 407 if not lfgTable then return end
408 if select(11, C_LFGList.GetSearchResultInfo(result)) then 408 if select(12, C_LFGList.GetSearchResultInfo(result)) then
409 lfgTable:SetFilter(filterTable) 409 lfgTable:SetFilter(filterTable)
410 end 410 end
411 hasLfgListChanges = true 411 hasLfgListChanges = true
412 end 412 end
413 413
768 addon:UpdateAutoButtonStatus() 768 addon:UpdateAutoButtonStatus()
769 addon:SetGroupJoinStatus(id, status) 769 addon:SetGroupJoinStatus(id, status)
770 end 770 end
771 771
772 function addon:SetGroupJoinStatus(id, status) 772 function addon:SetGroupJoinStatus(id, status)
773 local name = select(12, C_LFGList.GetSearchResultInfo(id)) 773 local name = select(13, C_LFGList.GetSearchResultInfo(id))
774 if name then 774 if name then
775 recentgroups[name] = {status=status, time=GetTime()} 775 recentgroups[name] = {status=status, time=GetTime()}
776 end 776 end
777 end 777 end
778 778
971 local QuickJoin = { 971 local QuickJoin = {
972 func = function(self, button) 972 func = function(self, button)
973 if button == "RightButton" then 973 if button == "RightButton" then
974 addon:SetGroupJoinStatus(self.groupToJoin, "_skip") 974 addon:SetGroupJoinStatus(self.groupToJoin, "_skip")
975 else 975 else
976 local delisted = select(11, C_LFGList.GetSearchResultInfo(self.groupToJoin)) 976 local delisted = select(12, C_LFGList.GetSearchResultInfo(self.groupToJoin))
977 if delisted == false then 977 if delisted == false then
978 JoinGroup(self.groupToJoin) 978 JoinGroup(self.groupToJoin)
979 else 979 else
980 addon:SetStatus("Group just delisted") 980 addon:SetStatus("Group just delisted")
981 end 981 end
1016 } 1016 }
1017 1017
1018 local NeedReset = { 1018 local NeedReset = {
1019 func = function() 1019 func = function()
1020 wipe(autoScanGroups); 1020 wipe(autoScanGroups);
1021 curLfgGroup = 0;
1021 local categoryToScan = addon.GetNextAutoScanCategory() 1022 local categoryToScan = addon.GetNextAutoScanCategory()
1022 if categoryToScan then 1023 if categoryToScan then
1023 addon.LfgScan(categoryToScan) 1024 addon.LfgScan(categoryToScan)
1024 end 1025 end
1025 end, 1026 end,