Guest User

Untitled

a guest
Oct 21st, 2019
155
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local PA = _G.ProjectAzilroka
  2. local EFL = PA:NewModule('EnhancedFriendsList', 'AceEvent-3.0', 'AceHook-3.0', 'AceTimer-3.0')
  3. PA.EFL, _G.EnhancedFriendsList = EFL, EFL
  4.  
  5. EFL.Title = '|cFF16C3F2Enhanced|r |cFFFFFFFFFriends List|r'
  6. EFL.Description = 'Provides Friends List Customization'
  7. EFL.Authors = 'Azilroka'
  8. EFL.Credits = 'Marotheit Merathilis'
  9.  
  10. local pairs, tonumber, unpack, format = pairs, tonumber, unpack, format
  11. local C_FriendList_GetFriendInfoByIndex, BNGetFriendInfo, BNGetGameAccountInfo, BNConnected, GetQuestDifficultyColor, CanCooperateWithGameAccount = C_FriendList.GetFriendInfoByIndex, BNGetFriendInfo, BNGetGameAccountInfo, BNConnected, GetQuestDifficultyColor, CanCooperateWithGameAccount
  12.  
  13. local MediaPath = [[Interface\AddOns\ProjectAzilroka\Media\EnhancedFriendsList\]]
  14. local ONE_MINUTE = 60;
  15. local ONE_HOUR = 60 * ONE_MINUTE;
  16. local ONE_DAY = 24 * ONE_HOUR;
  17. local ONE_MONTH = 30 * ONE_DAY;
  18. local ONE_YEAR = 12 * ONE_MONTH;
  19.  
  20. --[[
  21. -- Pull Server ID & Name
  22. /dump select(2, strsplit('-', UnitGUID('player'))) .. ' = ' ..GetRealmName()
  23. -- Find in _G
  24. /run for i,v in pairs(_G) do if type(i)=="string" and i:match("BNET_CLIENT_") then print(i,"=",v) end end
  25. ]]
  26.  
  27. EFL.Icons = {
  28. Game = {
  29. Alliance = {
  30. Name = FACTION_ALLIANCE,
  31. Order = 1,
  32. Default = BNet_GetClientTexture(BNET_CLIENT_WOW),
  33. BlizzardChat = [[Interface\ChatFrame\UI-ChatIcon-WoW]],
  34. Flat = MediaPath..[[GameIcons\Flat\Alliance]],
  35. Gloss = MediaPath..[[GameIcons\Gloss\Alliance]],
  36. Launcher = MediaPath..[[GameIcons\Launcher\Alliance]],
  37. },
  38. Horde = {
  39. Name = FACTION_HORDE,
  40. Order = 2,
  41. Default = BNet_GetClientTexture(BNET_CLIENT_WOW),
  42. BlizzardChat = [[Interface\ChatFrame\UI-ChatIcon-WoW]],
  43. Flat = MediaPath..[[GameIcons\Flat\Horde]],
  44. Gloss = MediaPath..[[GameIcons\Gloss\Horde]],
  45. Launcher = MediaPath..[[GameIcons\Launcher\Horde]],
  46. },
  47. Neutral = {
  48. Name = FACTION_STANDING_LABEL4,
  49. Order = 3,
  50. Default = BNet_GetClientTexture(BNET_CLIENT_WOW),
  51. BlizzardChat = [[Interface\ChatFrame\UI-ChatIcon-WoW]],
  52. Flat = MediaPath..[[GameIcons\Flat\WoW]],
  53. Gloss = MediaPath..[[GameIcons\Gloss\WoW]],
  54. Launcher = MediaPath..[[GameIcons\Launcher\WoW]],
  55. },
  56. D3 = {
  57. Name = PA.ACL['Diablo 3'],
  58. Order = 4,
  59. Color = 'C41F3B',
  60. Default = BNet_GetClientTexture(BNET_CLIENT_D3),
  61. BlizzardChat = [[Interface\ChatFrame\UI-ChatIcon-D3]],
  62. Flat = MediaPath..[[GameIcons\Flat\D3]],
  63. Gloss = MediaPath..[[GameIcons\Gloss\D3]],
  64. Launcher = MediaPath..[[GameIcons\Launcher\D3]],
  65. },
  66. WTCG = {
  67. Name = PA.ACL['Hearthstone'],
  68. Order = 5,
  69. Color = 'FFB100',
  70. Default = BNet_GetClientTexture(BNET_CLIENT_WTCG),
  71. BlizzardChat = [[Interface\ChatFrame\UI-ChatIcon-WTCG]],
  72. Flat = MediaPath..[[GameIcons\Flat\Hearthstone]],
  73. Gloss = MediaPath..[[GameIcons\Gloss\Hearthstone]],
  74. Launcher = MediaPath..[[GameIcons\Launcher\Hearthstone]],
  75. },
  76. S1 = {
  77. Name = PA.ACL['Starcraft'],
  78. Order = 6,
  79. Color = 'C495DD',
  80. Default = BNet_GetClientTexture(BNET_CLIENT_SC),
  81. BlizzardChat = [[Interface\ChatFrame\UI-ChatIcon-SC]],
  82. Flat = MediaPath..[[GameIcons\Flat\SC]],
  83. Gloss = MediaPath..[[GameIcons\Gloss\SC]],
  84. Launcher = MediaPath..[[GameIcons\Launcher\SC]],
  85. },
  86. S2 = {
  87. Name = PA.ACL['Starcraft 2'],
  88. Order = 7,
  89. Color = 'C495DD',
  90. Default = BNet_GetClientTexture(BNET_CLIENT_SC2),
  91. BlizzardChat = [[Interface\ChatFrame\UI-ChatIcon-SC2]],
  92. Flat = MediaPath..[[GameIcons\Flat\SC2]],
  93. Gloss = MediaPath..[[GameIcons\Gloss\SC2]],
  94. Launcher = MediaPath..[[GameIcons\Launcher\SC2]],
  95. },
  96. App = {
  97. Name = PA.ACL['App'],
  98. Order = 8,
  99. Color = '82C5FF',
  100. Default = BNet_GetClientTexture(BNET_CLIENT_APP),
  101. BlizzardChat = [[Interface\ChatFrame\UI-ChatIcon-Battlenet]],
  102. Flat = MediaPath..[[GameIcons\Flat\BattleNet]],
  103. Gloss = MediaPath..[[GameIcons\Gloss\BattleNet]],
  104. Launcher = MediaPath..[[GameIcons\Launcher\BattleNet]],
  105. Animated = MediaPath..[[GameIcons\Bnet]],
  106. },
  107. BSAp = {
  108. Name = PA.ACL['Mobile'],
  109. Order = 9,
  110. Color = '82C5FF',
  111. Default = BNet_GetClientTexture(BNET_CLIENT_APP),
  112. BlizzardChat = 'Interface\\ChatFrame\\UI-ChatIcon-Battlenet',
  113. Flat = MediaPath..'GameIcons\\Flat\\BattleNet',
  114. Gloss = MediaPath..'GameIcons\\Gloss\\BattleNet',
  115. Launcher = MediaPath..'GameIcons\\Launcher\\BattleNet',
  116. Animated = MediaPath..'GameIcons\\Bnet',
  117. },
  118. Hero = {
  119. Name = PA.ACL['Hero of the Storm'],
  120. Order = 10,
  121. Color = '00CCFF',
  122. Default = BNet_GetClientTexture(BNET_CLIENT_HEROES),
  123. BlizzardChat = [[Interface\ChatFrame\UI-ChatIcon-HotS]],
  124. Flat = MediaPath..[[GameIcons\Flat\Heroes]],
  125. Gloss = MediaPath..[[GameIcons\Gloss\Heroes]],
  126. Launcher = MediaPath..[[GameIcons\Launcher\Heroes]],
  127. },
  128. Pro = {
  129. Name = PA.ACL['Overwatch'],
  130. Order = 11,
  131. Color = 'FFFFFF',
  132. Default = BNet_GetClientTexture(BNET_CLIENT_OVERWATCH),
  133. BlizzardChat = [[Interface\ChatFrame\UI-ChatIcon-Overwatch]],
  134. Flat = MediaPath..[[GameIcons\Flat\Overwatch]],
  135. Gloss = MediaPath..[[GameIcons\Gloss\Overwatch]],
  136. Launcher = MediaPath..[[GameIcons\Launcher\Overwatch]],
  137. },
  138. DST2 = {
  139. Name = PA.ACL['Destiny 2'],
  140. Order = 12,
  141. Color = 'FFFFFF',
  142. Default = BNet_GetClientTexture(BNET_CLIENT_DESTINY2),
  143. BlizzardChat = [[Interface\ChatFrame\UI-ChatIcon-Destiny2]],
  144. Flat = MediaPath..[[GameIcons\Launcher\Destiny2]],
  145. Gloss = MediaPath..[[GameIcons\Launcher\Destiny2]],
  146. Launcher = MediaPath..[[GameIcons\Launcher\Destiny2]],
  147. },
  148. VIPR = {
  149. Name = PA.ACL['Call of Duty 4'],
  150. Order = 13,
  151. Color = 'FFFFFF',
  152. Default = BNet_GetClientTexture(BNET_CLIENT_COD),
  153. BlizzardChat = [[Interface\ChatFrame\UI-ChatIcon-CallOfDutyBlackOps4]],
  154. Flat = MediaPath..[[GameIcons\Launcher\COD4]],
  155. Gloss = MediaPath..[[GameIcons\Launcher\COD4]],
  156. Launcher = MediaPath..[[GameIcons\Launcher\COD4]],
  157. },
  158. },
  159. Status = {
  160. Online = {
  161. Name = FRIENDS_LIST_ONLINE,
  162. Order = 1,
  163. Default = FRIENDS_TEXTURE_ONLINE,
  164. Square = MediaPath..[[StatusIcons\Square\Online]],
  165. D3 = MediaPath..[[StatusIcons\D3\Online]],
  166. },
  167. Offline = {
  168. Name = FRIENDS_LIST_OFFLINE,
  169. Order = 2,
  170. Default = FRIENDS_TEXTURE_OFFLINE,
  171. Square = MediaPath..[[StatusIcons\Square\Offline]],
  172. D3 = MediaPath..[[StatusIcons\D3\Offline]],
  173. },
  174. DND = {
  175. Name = DEFAULT_DND_MESSAGE,
  176. Order = 3,
  177. Default = FRIENDS_TEXTURE_DND,
  178. Square = MediaPath..[[StatusIcons\Square\DND]],
  179. D3 = MediaPath..[[StatusIcons\D3\DND]],
  180. },
  181. AFK = {
  182. Name = DEFAULT_AFK_MESSAGE,
  183. Order = 4,
  184. Default = FRIENDS_TEXTURE_AFK,
  185. Square = MediaPath..[[StatusIcons\Square\AFK]],
  186. D3 = MediaPath..[[StatusIcons\D3\AFK]],
  187. },
  188. }
  189. }
  190.  
  191. -- /dump "["..select(2, strsplit('-', UnitGUID('player'))) .. "] = '" ..GetRealmName().."'"
  192. EFL.ClassicServerNameByID = {
  193. [4703] = 'Amnennar',
  194. [4715] = 'Anathema',
  195. [4716] = 'Arcanite Reaper',
  196. [4742] = 'Ashbringer',
  197. [4387] = 'Ashkandi',
  198. [4372] = 'Atiesh',
  199. [4669] = 'Arugal',
  200. [4441] = 'Auberdine',
  201. [4376] = 'Azuresong',
  202. [4728] = 'Benediction',
  203. [4398] = 'Bigglesworth',
  204. [4397] = 'Blaumeux',
  205. [4746] = 'Bloodfang',
  206. [4648] = 'Bloodsail Buccaneers',
  207. [4386] = 'Deviate Delight',
  208. [4751] = 'Dragonfang',
  209. [4756] = "Dragon's Call",
  210. [4755] = 'Dreadmist',
  211. [4731] = 'Earthfury',
  212. [4749] = 'Earthshaker',
  213. [4440] = 'Everlook',
  214. [4408] = 'Faerlina',
  215. [4396] = 'Fairbanks',
  216. [4739] = 'Felstriker',
  217. [4744] = 'Finkle',
  218. [4467] = 'Firemaw',
  219. [4706] = 'Flamelash',
  220. [4702] = 'Gandling',
  221. [4476] = 'Gehennas',
  222. [4465] = 'Golemagg',
  223. [4647] = 'Grobbulus',
  224. [4732] = 'Heartseeker',
  225. [4763] = 'Heartstriker',
  226. [4406] = 'Herod',
  227. [4678] = 'Hydraxian Waterlords',
  228. [4698] = 'Incendius',
  229. [4758] = 'Judgement',
  230. [4700] = 'Kirtonos',
  231. [4699] = 'Kromcrush',
  232. [4399] = 'Kurinnaxx',
  233. [4442] = 'Lakeshire',
  234. [4801] = 'Loatheb',
  235. [4463] = 'Lucifron',
  236. [4813] = 'Mandokir',
  237. [4384] = 'Mankrik',
  238. [4454] = 'Mirage Raceway',
  239. [4701] = 'Mograine',
  240. [4373] = 'Myzrael',
  241. [4456] = 'Nethergarde Keep',
  242. [4729] = 'Netherwind',
  243. [4741] = 'Noggenfogger',
  244. [4374] = 'Old Blanchy',
  245. [4385] = 'Pagle',
  246. [4466] = 'Patchwerk',
  247. [4453] = 'Pyrewood Village',
  248. [4695] = 'Rattlegore',
  249. [4455] = 'Razorfen',
  250. [4478] = 'Razorgore',
  251. [4667] = 'Remulos',
  252. [4475] = 'Shazzrah',
  253. [4410] = 'Skeram',
  254. [4743] = 'Skullflame',
  255. [4696] = 'Smolderweb',
  256. [4409] = 'Stalagg',
  257. [4705] = 'Stonespine',
  258. [4726] = 'Sulfuras',
  259. [4464] = 'Sulfuron',
  260. [4737] = "Sul'thraze",
  261. [4757] = 'Ten Storms',
  262. [4407] = 'Thalnos',
  263. [4714] = 'Thunderfury',
  264. [4745] = 'Transcendence',
  265. [4477] = 'Venoxis',
  266. [4388] = 'Westfall',
  267. [4395] = 'Whitemane',
  268. [4727] = 'Windseeker',
  269. [4670] = 'Yojamba',
  270. [4676] = 'Zandalar Tribe',
  271.  
  272. [4452] = 'Хроми',
  273. [4704] = 'Змейталак',
  274. [4754] = 'Рок-Делар',
  275. [4766] = 'Вестник Рока',
  276. [4474] = 'Пламегор',
  277. }
  278.  
  279. local accountInfo = { gameAccountInfo = {} }
  280. function EFL:GetBattleNetInfo(friendIndex)
  281. if PA.Classic then
  282. local bnetIDAccount, accountName, battleTag, isBattleTag, _, bnetIDGameAccount, _, isOnline, lastOnline, isBnetAFK, isBnetDND, messageText, noteText, _, messageTime, _, isReferAFriend, canSummonFriend, isFavorite = BNGetFriendInfo(friendIndex)
  283.  
  284. if not bnetIDGameAccount then return end
  285.  
  286. local hasFocus, characterName, client, realmName, realmID, faction, race, class, guild, zoneName, level, gameText, broadcastText, broadcastTime, _, toonID, _, isGameAFK, isGameBusy, guid, wowProjectID, mobile = BNGetGameAccountInfo(bnetIDGameAccount)
  287.  
  288. accountInfo.bnetAccountID = bnetIDAccount
  289. accountInfo.accountName = accountName
  290. accountInfo.battleTag = battleTag
  291. accountInfo.isBattleTagFriend = isBattleTag
  292. accountInfo.isDND = isBnetDND
  293. accountInfo.isAFK = isBnetAFK
  294. accountInfo.isFriend = true
  295. accountInfo.isFavorite = isFavorite
  296. accountInfo.note = noteText
  297. accountInfo.rafLinkType = 0
  298. accountInfo.appearOffline = false
  299. accountInfo.customMessage = messageText
  300. accountInfo.lastOnlineTime = lastOnline
  301. accountInfo.customMessageTime = messageTime
  302.  
  303. accountInfo.gameAccountInfo.clientProgram = client or "App"
  304. accountInfo.gameAccountInfo.richPresence = gameText
  305. accountInfo.gameAccountInfo.gameAccountID = bnetIDGameAccount
  306. accountInfo.gameAccountInfo.isOnline = isOnline
  307. accountInfo.gameAccountInfo.isGameAFK = isGameAFK
  308. accountInfo.gameAccountInfo.isGameBusy = isGameBusy
  309. accountInfo.gameAccountInfo.isWowMobile = mobile
  310. accountInfo.gameAccountInfo.hasFocus = hasFocus
  311. accountInfo.gameAccountInfo.canSummon = canSummonFriend
  312.  
  313. if client == BNET_CLIENT_WOW then
  314. accountInfo.gameAccountInfo.characterName = characterName or ""
  315. accountInfo.gameAccountInfo.factionName = faction ~= '' and faction or nil
  316. accountInfo.gameAccountInfo.playerGuid = guid or 0
  317. accountInfo.gameAccountInfo.wowProjectID = wowProjectID or 0
  318. accountInfo.gameAccountInfo.realmID = realmID or 0
  319. accountInfo.gameAccountInfo.realmDisplayName = realmName or ""
  320. accountInfo.gameAccountInfo.realmName = realmName or ""
  321. accountInfo.gameAccountInfo.areaName = zoneName or ""
  322. accountInfo.gameAccountInfo.className = class or ""
  323. accountInfo.gameAccountInfo.characterLevel = level or 0
  324. accountInfo.gameAccountInfo.raceName = race or ""
  325. else
  326. accountInfo.gameAccountInfo.characterName = nil
  327. accountInfo.gameAccountInfo.factionName = nil
  328. accountInfo.gameAccountInfo.playerGuid = nil
  329. accountInfo.gameAccountInfo.wowProjectID = nil
  330. accountInfo.gameAccountInfo.realmID = nil
  331. accountInfo.gameAccountInfo.realmDisplayName = nil
  332. accountInfo.gameAccountInfo.realmName = nil
  333. accountInfo.gameAccountInfo.areaName = nil
  334. accountInfo.gameAccountInfo.className = nil
  335. accountInfo.gameAccountInfo.characterLevel = nil
  336. accountInfo.gameAccountInfo.raceName = nil
  337. end
  338.  
  339. return accountInfo
  340. else
  341. accountInfo = C_BattleNet.GetFriendAccountInfo(friendIndex)
  342.  
  343. if accountInfo.gameAccountInfo.wowProjectID == WOW_PROJECT_CLASSIC then
  344. accountInfo.gameAccountInfo.realmDisplayName = EFL.ClassicServerNameByID[accountInfo.gameAccountInfo.realmID] or accountInfo.gameAccountInfo.realmID
  345. end
  346.  
  347. return accountInfo
  348. end
  349. end
  350.  
  351. function EFL:UpdateFriends(button)
  352. local nameText, nameColor, infoText, broadcastText, _, Cooperate
  353. local info, name, level, class, area, connected, status
  354. local cooperateColor = GRAY_FONT_COLOR
  355. if button.buttonType == FRIENDS_BUTTON_TYPE_WOW then
  356. info = C_FriendList_GetFriendInfoByIndex(button.id)
  357. name, level, class, area, connected = info.name, info.level, info.className, info.area, info.connected
  358. broadcastText = nil
  359. if connected then
  360. button.status:SetTexture(EFL.Icons.Status[(status == CHAT_FLAG_DND and 'DND' or status == CHAT_FLAG_AFK and 'AFK' or 'Online')][self.db.StatusIconPack])
  361. local classcolor = PA:ClassColorCode(class)
  362. if EFL.db.ShowLevel then
  363. if EFL.db.DiffLevel then
  364. local diff = level ~= 0 and format('FF%02x%02x%02x', GetQuestDifficultyColor(level).r * 255, GetQuestDifficultyColor(level).g * 255, GetQuestDifficultyColor(level).b * 255) or 'FFFFFFFF'
  365. nameText = format('%s |cFFFFFFFF(|r%s - %s %s|cFFFFFFFF)|r', WrapTextInColorCode(name, classcolor), class, LEVEL, WrapTextInColorCode(level, diff))
  366. else
  367. nameText = format('%s |cFFFFFFFF(|r%s - %s %s|cFFFFFFFF)|r', WrapTextInColorCode(name, classcolor), class, LEVEL, WrapTextInColorCode(level, 'FFFFE519'))
  368. end
  369. else
  370. nameText = format('%s |cFFFFFFFF(|r%s|cFFFFFFFF)|r', WrapTextInColorCode(name, classcolor), class)
  371. end
  372. nameColor = FRIENDS_WOW_NAME_COLOR
  373. Cooperate = true
  374. cooperateColor = LIGHTYELLOW_FONT_COLOR
  375. else
  376. button.status:SetTexture(EFL.Icons.Status.Offline[self.db.StatusIconPack])
  377. nameText = name
  378. nameColor = FRIENDS_GRAY_COLOR
  379. end
  380. infoText = area
  381. elseif button.buttonType == FRIENDS_BUTTON_TYPE_BNET then
  382. local info = EFL:GetBattleNetInfo(button.id);
  383. if info then
  384. nameText = info.accountName
  385. infoText = accountInfo.gameAccountInfo.richPresence
  386.  
  387. if infoText == "" then
  388. infoText = PA.ACL["Mobile"]
  389. end
  390.  
  391. if info.gameAccountInfo.isOnline then
  392. local client = info.gameAccountInfo.clientProgram
  393. nameColor = FRIENDS_BNET_NAME_COLOR
  394.  
  395. if client == BNET_CLIENT_WOW then
  396. local level = info.gameAccountInfo.characterLevel
  397. local characterName = info.gameAccountInfo.characterName
  398. local classcolor = PA:ClassColorCode(info.gameAccountInfo.className)
  399. if EFL.db.ShowLevel then
  400. if EFL.db.DiffLevel then
  401. local diff = level ~= 0 and format('FF%02x%02x%02x', GetQuestDifficultyColor(level).r * 255, GetQuestDifficultyColor(level).g * 255, GetQuestDifficultyColor(level).b * 255) or 'FFFFFFFF'
  402. nameText = format('%s |cFFFFFFFF(|r%s - %s %s|cFFFFFFFF)|r', nameText, WrapTextInColorCode(characterName, classcolor), LEVEL, WrapTextInColorCode(level, diff))
  403. else
  404. nameText = format('%s |cFFFFFFFF(|r%s - %s %s|cFFFFFFFF)|r', nameText, WrapTextInColorCode(characterName, classcolor), LEVEL, WrapTextInColorCode(level, 'FFFFE519'))
  405. end
  406. else
  407. nameText = format('%s |cFFFFFFFF(|r%s|cFFFFFFFF)|r', nameText, WrapTextInColorCode(characterName, classcolor))
  408. end
  409.  
  410. if info.gameAccountInfo.wowProjectID == WOW_PROJECT_CLASSIC and info.gameAccountInfo.realmDisplayName ~= PA.MyRealm then
  411. infoText = format('%s - %s - %s', info.gameAccountInfo.areaName, info.gameAccountInfo.realmDisplayName, infoText)
  412. elseif info.gameAccountInfo.realmDisplayName == PA.MyRealm then
  413. infoText = info.gameAccountInfo.areaName
  414. end
  415.  
  416. if PA.Retail and info.gameAccountInfo.wowProjectID == WOW_PROJECT_MAINLINE then
  417. Cooperate = CanCooperateWithGameAccount(info)
  418. cooperateColor = LIGHTYELLOW_FONT_COLOR
  419. end
  420.  
  421. local faction = info.gameAccountInfo.factionName
  422. button.gameIcon:SetTexture(faction and EFL.Icons.Game[faction][self.db[faction]] or EFL.Icons.Game.Neutral.Launcher)
  423. else
  424. nameText = format('|cFF%s%s|r', EFL.Icons.Game[client].Color or 'FFFFFF', nameText)
  425. button.gameIcon:SetTexture(EFL.Icons.Game[client][self.db[client]])
  426. end
  427.  
  428. button.status:SetTexture(EFL.Icons.Status[(info.isDND and 'DND' or info.isAFK and 'AFK' or 'Online')][self.db.StatusIconPack])
  429.  
  430. button.gameIcon:SetTexCoord(0, 1, 0, 1)
  431. button.gameIcon:SetDrawLayer('OVERLAY')
  432. button.gameIcon:SetAlpha(1)
  433. else
  434. button.status:SetTexture(EFL.Icons.Status.Offline[self.db.StatusIconPack])
  435. nameColor = FRIENDS_GRAY_COLOR
  436. local lastOnline = info.lastOnlineTime
  437. infoText = (not lastOnline or lastOnline == 0 or time() - lastOnline >= ONE_YEAR) and FRIENDS_LIST_OFFLINE or format(BNET_LAST_ONLINE_TIME, FriendsFrame_GetLastOnline(lastOnline))
  438. end
  439. end
  440. end
  441.  
  442. if button.summonButton:IsShown() then
  443. button.gameIcon:SetPoint('TOPRIGHT', -50, -2)
  444. else
  445. button.gameIcon:SetPoint('TOPRIGHT', -21, -2)
  446. end
  447.  
  448. if not button.isUpdateHooked then
  449. button:HookScript("OnUpdate", function(self, elapsed)
  450. if button.gameIcon:GetTexture() == MediaPath..[[GameIcons\Bnet]] then
  451. AnimateTexCoords(self.gameIcon, 512, 256, 64, 64, 25, elapsed, 0.02)
  452. end
  453. end)
  454. button.isUpdateHooked = true
  455. end
  456.  
  457. if nameText then
  458. button.name:SetText(nameText)
  459. button.name:SetTextColor(nameColor.r, nameColor.g, nameColor.b)
  460. button.info:SetText(infoText)
  461. button.info:SetTextColor(cooperateColor.r, cooperateColor.g, cooperateColor.b)
  462. button.name:SetFont(PA.LSM:Fetch('font', self.db.NameFont), self.db.NameFontSize, self.db.NameFontFlag)
  463. button.info:SetFont(PA.LSM:Fetch('font', self.db.InfoFont), self.db.InfoFontSize, self.db.InfoFontFlag)
  464.  
  465. if button.Favorite and button.Favorite:IsShown() then
  466. button.Favorite:ClearAllPoints()
  467. button.Favorite:SetPoint("TOPLEFT", button.name, "TOPLEFT", button.name:GetStringWidth(), 0);
  468. end
  469. end
  470. end
  471.  
  472. function EFL:GetOptions()
  473. local Options = {
  474. type = 'group',
  475. name = EFL.Title,
  476. desc = EFL.Description,
  477. args = {
  478. header = {
  479. order = 1,
  480. type = 'header',
  481. name = PA:Color(EFL.Title)
  482. },
  483. general = {
  484. order = 2,
  485. type = 'group',
  486. name = PA.ACL['General'],
  487. guiInline = true,
  488. get = function(info) return EFL.db[info[#info]] end,
  489. set = function(info, value) EFL.db[info[#info]] = value FriendsFrame_Update() end,
  490. args = {
  491. NameSettings = {
  492. type = 'group',
  493. order = 1,
  494. name = PA.ACL['Name Settings'],
  495. guiInline = true,
  496. get = function(info) return EFL.db[info[#info]] end,
  497. set = function(info, value) EFL.db[info[#info]] = value FriendsFrame_Update() end,
  498. args = {
  499. NameFont = {
  500. type = 'select', dialogControl = 'LSM30_Font',
  501. order = 1,
  502. name = PA.ACL['Name Font'],
  503. desc = PA.ACL['The font that the RealID / Character Name / Level uses.'],
  504. values = PA.LSM:HashTable('font'),
  505. },
  506. NameFontSize = {
  507. order = 2,
  508. name = PA.ACL['Name Font Size'],
  509. desc = PA.ACL['The font size that the RealID / Character Name / Level uses.'],
  510. type = 'range',
  511. min = 6, max = 22, step = 1,
  512. },
  513. NameFontFlag = {
  514. name = PA.ACL['Name Font Flag'],
  515. desc = PA.ACL['The font flag that the RealID / Character Name / Level uses.'],
  516. order = 3,
  517. type = 'select',
  518. values = {
  519. ['NONE'] = 'None',
  520. ['OUTLINE'] = 'OUTLINE',
  521. ['MONOCHROME'] = 'MONOCHROME',
  522. ['MONOCHROMEOUTLINE'] = 'MONOCROMEOUTLINE',
  523. ['THICKOUTLINE'] = 'THICKOUTLINE',
  524. },
  525. },
  526. ShowLevel = {
  527. type = 'toggle',
  528. order = 4,
  529. name = PA.ACL['Show Level'],
  530. },
  531. DiffLevel = {
  532. type = 'toggle',
  533. order = 5,
  534. name = PA.ACL['Level by Difficulty'],
  535. disabled = function() return (not EFL.db.ShowLevel) end,
  536. },
  537. },
  538. },
  539. InfoSettings = {
  540. type = 'group',
  541. order = 2,
  542. name = PA.ACL['Info Settings'],
  543. guiInline = true,
  544. get = function(info) return EFL.db[info[#info]] end,
  545. set = function(info, value) EFL.db[info[#info]] = value FriendsFrame_Update() end,
  546. args = {
  547. InfoFont = {
  548. type = 'select', dialogControl = 'LSM30_Font',
  549. order = 1,
  550. name = PA.ACL['Info Font'],
  551. desc = PA.ACL['The font that the Zone / Server uses.'],
  552. values = PA.LSM:HashTable('font'),
  553. },
  554. InfoFontSize = {
  555. order = 2,
  556. name = PA.ACL['Info Font Size'],
  557. desc = PA.ACL['The font size that the Zone / Server uses.'],
  558. type = 'range',
  559. min = 6, max = 22, step = 1,
  560. },
  561. InfoFontFlag = {
  562. order = 3,
  563. name = PA.ACL['Info Font Outline'],
  564. desc = PA.ACL['The font flag that the Zone / Server uses.'],
  565. type = 'select',
  566. values = {
  567. ['NONE'] = 'None',
  568. ['OUTLINE'] = 'OUTLINE',
  569. ['MONOCHROME'] = 'MONOCHROME',
  570. ['MONOCHROMEOUTLINE'] = 'MONOCROMEOUTLINE',
  571. ['THICKOUTLINE'] = 'THICKOUTLINE',
  572. },
  573. },
  574. StatusIconPack = {
  575. name = PA.ACL['Status Icon Pack'],
  576. desc = PA.ACL['Different Status Icons.'],
  577. order = 4,
  578. type = 'select',
  579. values = {
  580. ['Default'] = 'Default',
  581. ['Square'] = 'Square',
  582. ['D3'] = 'Diablo 3',
  583. },
  584. },
  585. },
  586. },
  587. },
  588. },
  589. GameIcons = {
  590. order = 3,
  591. type = 'group',
  592. name = PA.ACL['Game Icons'],
  593. guiInline = true,
  594. get = function(info) return EFL.db[info[#info]] end,
  595. set = function(info, value) EFL.db[info[#info]] = value FriendsFrame_Update() end,
  596. args = {},
  597. },
  598. GameIconsPreview = {
  599. order = 4,
  600. type = 'group',
  601. name = PA.ACL['Game Icon Preview'],
  602. guiInline = true,
  603. args = {},
  604. },
  605. StatusIcons = {
  606. order = 5,
  607. type = 'group',
  608. name = PA.ACL['Status Icon Preview'],
  609. guiInline = true,
  610. args = {},
  611. },
  612. AuthorHeader = {
  613. order = -4,
  614. type = 'header',
  615. name = PA.ACL['Authors:'],
  616. },
  617. Authors = {
  618. order = -3,
  619. type = 'description',
  620. name = EFL.Authors,
  621. fontSize = 'large',
  622. },
  623. CreditsHeader = {
  624. order = -2,
  625. type = 'header',
  626. name = PA.ACL['Credits:'],
  627. },
  628. Credits = {
  629. order = -1,
  630. type = 'description',
  631. name = EFL.Credits,
  632. fontSize = 'large',
  633. },
  634. },
  635. }
  636.  
  637. for Key, Value in pairs(EFL.Icons.Game) do
  638. Options.args.GameIcons.args[Key] = {
  639. name = Value.Name..PA.ACL[' Icon'],
  640. order = Value.Order,
  641. type = 'select',
  642. values = {
  643. ['Default'] = 'Default',
  644. ['BlizzardChat'] = 'Blizzard Chat',
  645. ['Flat'] = 'Flat Style',
  646. ['Gloss'] = 'Glossy',
  647. ['Launcher'] = 'Launcher',
  648. },
  649. }
  650. Options.args.GameIconsPreview.args[Key] = {
  651. order = Value.Order,
  652. type = 'execute',
  653. name = Value.Name,
  654. func = function() return end,
  655. image = function(info) return EFL.Icons.Game[info[#info]][EFL.db[Key]], 32, 32 end,
  656. }
  657. end
  658.  
  659. Options.args.GameIcons.args['App'].values['Animated'] = 'Animated'
  660. Options.args.GameIcons.args['BSAp'].values['Animated'] = 'Animated'
  661.  
  662. for Key, Value in pairs(EFL.Icons.Status) do
  663. Options.args.StatusIcons.args[Key] = {
  664. order = Value.Order,
  665. type = 'execute',
  666. name = Value.Name,
  667. func = function() return end,
  668. image = function(info) return EFL.Icons.Status[info[#info]][EFL.db.StatusIconPack], 16, 16 end,
  669. }
  670. end
  671.  
  672. PA.Options.args.EnhancedFriendsList = Options
  673. end
  674.  
  675. function EFL:BuildProfile()
  676. PA.Defaults.profile['EnhancedFriendsList'] = {
  677. ['Enable'] = true,
  678. ['NameFont'] = 'Arial Narrow',
  679. ['NameFontSize'] = 12,
  680. ['NameFontFlag'] = 'OUTLINE',
  681. ['InfoFont'] = 'Arial Narrow',
  682. ['InfoFontSize'] = 12,
  683. ['InfoFontFlag'] = 'OUTLINE',
  684. ['StatusIconPack'] = 'Default',
  685. ['ShowLevel'] = true,
  686. ['DiffLevel'] = true,
  687. }
  688.  
  689. for _, GameIcon in pairs({'Alliance', 'Horde', 'Neutral', 'D3', 'WTCG', 'S1', 'S2', 'App', 'BSAp', 'Hero', 'Pro', 'DST2', 'VIPR' }) do
  690. PA.Defaults.profile['EnhancedFriendsList'][GameIcon] = 'Launcher'
  691. end
  692.  
  693. if PA.ElvUI then
  694. PA.Defaults.profile['EnhancedFriendsList']['NameFont'] = ElvUI[1].db.general.font
  695. PA.Defaults.profile['EnhancedFriendsList']['InfoFont'] = ElvUI[1].db.general.font
  696. elseif PA.Tukui then
  697. PA.Defaults.profile['EnhancedFriendsList']['NameFont'] = 'Tukui Pixel'
  698. PA.Defaults.profile['EnhancedFriendsList']['InfoFont'] = 'Tukui Pixel'
  699. PA.Defaults.profile['EnhancedFriendsList']['NameFontFlag'] = 'MONOCHROMEOUTLINE'
  700. PA.Defaults.profile['EnhancedFriendsList']['InfoFontFlag'] = 'MONOCHROMEOUTLINE'
  701. end
  702.  
  703. PA.Options.args.general.args.EnhancedFriendsList = {
  704. type = 'toggle',
  705. name = EFL.Title,
  706. desc = EFL.Description,
  707. }
  708. end
  709.  
  710. function EFL:Initialize()
  711. EFL.db = PA.db['EnhancedFriendsList']
  712.  
  713. if EFL.db.Enable ~= true then
  714. return
  715. end
  716.  
  717. EFL:GetOptions()
  718.  
  719. --if PA.db.FG then
  720. -- EFL:SecureHook(PA.FG, 'FriendGroups_UpdateFriendButton', function(self, button) EFL:UpdateFriends(button) end)
  721. --else
  722. EFL:SecureHook("FriendsFrame_UpdateFriendButton", 'UpdateFriends')
  723. --end
  724. end
RAW Paste Data