Advertisement
Xzempt

Untitled

Jul 13th, 2011
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 65.44 KB | None | 0 0
  1.  
  2. UNITPOPUP_TITLE_HEIGHT = 26;
  3. UNITPOPUP_BUTTON_HEIGHT = 15;
  4. UNITPOPUP_BORDER_HEIGHT = 8;
  5. UNITPOPUP_BORDER_WIDTH = 19;
  6.  
  7. UNITPOPUP_NUMBUTTONS = 9;
  8. UNITPOPUP_TIMEOUT = 5;
  9.  
  10. UNITPOPUP_SPACER_SPACING = 6;
  11.  
  12. UnitPopupButtons = { };
  13. UnitPopupButtons["CANCEL"] = { text = CANCEL, dist = 0, space = 1 };
  14. UnitPopupButtons["TRADE"] = { text = TRADE, dist = 2 };
  15. UnitPopupButtons["INSPECT"] = { text = INSPECT, dist = 1 };
  16. UnitPopupButtons["ACHIEVEMENTS"] = { text = COMPARE_ACHIEVEMENTS, dist = 1 };
  17. UnitPopupButtons["TARGET"] = { text = TARGET, dist = 0 };
  18. UnitPopupButtons["IGNORE"] = { text = IGNORE, dist = 0 };
  19. UnitPopupButtons["REPORT_SPAM"] = { text = REPORT_SPAM, dist = 0 };
  20. UnitPopupButtons["POP_OUT_CHAT"] = { text = MOVE_TO_WHISPER_WINDOW, dist = 0 };
  21. UnitPopupButtons["DUEL"] = { text = DUEL, dist = 3, space = 1 };
  22. UnitPopupButtons["WHISPER"] = { text = WHISPER, dist = 0 };
  23. UnitPopupButtons["INVITE"] = { text = PARTY_INVITE, dist = 0 };
  24. UnitPopupButtons["UNINVITE"] = { text = PARTY_UNINVITE, dist = 0 };
  25. UnitPopupButtons["REMOVE_FRIEND"] = { text = REMOVE_FRIEND, dist = 0 };
  26. UnitPopupButtons["SET_NOTE"] = { text = SET_NOTE, dist = 0 };
  27. UnitPopupButtons["BN_REMOVE_FRIEND"] = { text = REMOVE_FRIEND, dist = 0 };
  28. UnitPopupButtons["BN_SET_NOTE"] = { text = SET_NOTE, dist = 0 };
  29. UnitPopupButtons["BN_VIEW_FRIENDS"] = { text = VIEW_FRIENDS_OF_FRIENDS, dist = 0 };
  30. UnitPopupButtons["BN_INVITE"] = { text = PARTY_INVITE, dist = 0 };
  31. UnitPopupButtons["BN_TARGET"] = { text = TARGET, dist = 0 };
  32. UnitPopupButtons["BLOCK_COMMUNICATION"] = { text = BLOCK_COMMUNICATION, dist = 0 };
  33. UnitPopupButtons["CREATE_CONVERSATION_WITH"] = { text = CREATE_CONVERSATION_WITH, dist = 0 };
  34. UnitPopupButtons["VOTE_TO_KICK"] = { text = VOTE_TO_KICK, dist = 0 };
  35. UnitPopupButtons["PROMOTE"] = { text = PARTY_PROMOTE, dist = 0 };
  36. UnitPopupButtons["PROMOTE_GUIDE"] = { text = PARTY_PROMOTE_GUIDE, dist = 0 };
  37. UnitPopupButtons["GUILD_PROMOTE"] = { text = GUILD_PROMOTE, dist = 0 };
  38. UnitPopupButtons["GUILD_LEAVE"] = { text = GUILD_LEAVE, dist = 0 };
  39. UnitPopupButtons["TEAM_PROMOTE"] = { text = TEAM_PROMOTE, dist = 0 };
  40. UnitPopupButtons["TEAM_KICK"] = { text = TEAM_KICK, dist = 0 };
  41. UnitPopupButtons["TEAM_LEAVE"] = { text = TEAM_LEAVE, dist = 0 };
  42. UnitPopupButtons["LEAVE"] = { text = PARTY_LEAVE, dist = 0 };
  43. UnitPopupButtons["FOLLOW"] = { text = FOLLOW, dist = 4 };
  44. UnitPopupButtons["PET_DISMISS"] = { text = PET_DISMISS, dist = 0 };
  45. UnitPopupButtons["PET_ABANDON"] = { text = PET_ABANDON, dist = 0 };
  46. UnitPopupButtons["PET_PAPERDOLL"] = { text = PET_PAPERDOLL, dist = 0 };
  47. UnitPopupButtons["PET_RENAME"] = { text = PET_RENAME, dist = 0 };
  48. UnitPopupButtons["LOOT_METHOD"] = { text = LOOT_METHOD, dist = 0, nested = 1};
  49. UnitPopupButtons["FREE_FOR_ALL"] = { text = LOOT_FREE_FOR_ALL, dist = 0 };
  50. UnitPopupButtons["ROUND_ROBIN"] = { text = LOOT_ROUND_ROBIN, dist = 0 };
  51. UnitPopupButtons["MASTER_LOOTER"] = { text = LOOT_MASTER_LOOTER, dist = 0 };
  52. UnitPopupButtons["GROUP_LOOT"] = { text = LOOT_GROUP_LOOT, dist = 0 };
  53. UnitPopupButtons["NEED_BEFORE_GREED"] = { text = LOOT_NEED_BEFORE_GREED, dist = 0 };
  54. UnitPopupButtons["RESET_INSTANCES"] = { text = RESET_INSTANCES, dist = 0 };
  55. UnitPopupButtons["CONVERT_TO_RAID"] = { text = CONVERT_TO_RAID, dist = 0 };
  56. UnitPopupButtons["CONVERT_TO_PARTY"] = { text = CONVERT_TO_PARTY, dist = 0 };
  57.  
  58. UnitPopupButtons["DUNGEON_DIFFICULTY"] = { text = DUNGEON_DIFFICULTY, dist = 0, nested = 1};
  59. UnitPopupButtons["DUNGEON_DIFFICULTY1"] = { text = DUNGEON_DIFFICULTY1, dist = 0 };
  60. UnitPopupButtons["DUNGEON_DIFFICULTY2"] = { text = DUNGEON_DIFFICULTY2, dist = 0 };
  61. --UnitPopupButtons["DUNGEON_DIFFICULTY3"] = { text = DUNGEON_DIFFICULTY3, dist = 0 };
  62.  
  63. UnitPopupButtons["RAID_DIFFICULTY"] = { text = RAID_DIFFICULTY, dist = 0, nested = 1};
  64. UnitPopupButtons["RAID_DIFFICULTY1"] = { text = RAID_DIFFICULTY1, dist = 0 };
  65. UnitPopupButtons["RAID_DIFFICULTY2"] = { text = RAID_DIFFICULTY2, dist = 0 };
  66. UnitPopupButtons["RAID_DIFFICULTY3"] = { text = RAID_DIFFICULTY3, dist = 0 };
  67. UnitPopupButtons["RAID_DIFFICULTY4"] = { text = RAID_DIFFICULTY4, dist = 0 };
  68.  
  69. UnitPopupButtons["PVP_FLAG"] = { text = PVP_FLAG, dist = 0, nested = 1};
  70. UnitPopupButtons["PVP_ENABLE"] = { text = ENABLE, dist = 0, checkable = 1 };
  71. UnitPopupButtons["PVP_DISABLE"] = { text = DISABLE, dist = 0, checkable = 1 };
  72.  
  73. UnitPopupButtons["LOOT_THRESHOLD"] = { text = LOOT_THRESHOLD, dist = 0, nested = 1 };
  74. UnitPopupButtons["LOOT_PROMOTE"] = { text = LOOT_PROMOTE, dist = 0 };
  75. UnitPopupButtons["ITEM_QUALITY2_DESC"] = { text = ITEM_QUALITY2_DESC, dist = 0, color = ITEM_QUALITY_COLORS[2] };
  76. UnitPopupButtons["ITEM_QUALITY3_DESC"] = { text = ITEM_QUALITY3_DESC, dist = 0, color = ITEM_QUALITY_COLORS[3] };
  77. UnitPopupButtons["ITEM_QUALITY4_DESC"] = { text = ITEM_QUALITY4_DESC, dist = 0, color = ITEM_QUALITY_COLORS[4] };
  78.  
  79. UnitPopupButtons["OPT_OUT_LOOT_TITLE"] = { text = OPT_OUT_LOOT_TITLE, dist = 0, nested = 1, tooltipText = NEWBIE_TOOLTIP_UNIT_OPT_OUT_LOOT };
  80. UnitPopupButtons["OPT_OUT_LOOT_ENABLE"] = { text = YES, dist = 0, checkable = 1 };
  81. UnitPopupButtons["OPT_OUT_LOOT_DISABLE"] = { text = NO, dist = 0, checkable = 1 };
  82.  
  83. UnitPopupButtons["BN_REPORT"] = { text = BNET_REPORT, dist = 0, nested = 1 };
  84. UnitPopupButtons["BN_REPORT_SPAM"] = { text = BNET_REPORT_SPAM, dist = 0 };
  85. UnitPopupButtons["BN_REPORT_ABUSE"] = { text = BNET_REPORT_ABUSE, dist = 0 };
  86. UnitPopupButtons["BN_REPORT_THREAT"] = { text = BNET_REPORT_THREAT, dist = 0 };
  87. UnitPopupButtons["BN_REPORT_NAME"] = { text = BNET_REPORT_NAME, dist = 0 };
  88.  
  89. UnitPopupButtons["RAID_LEADER"] = { text = SET_RAID_LEADER, dist = 0 };
  90. UnitPopupButtons["RAID_PROMOTE"] = { text = SET_RAID_ASSISTANT, dist = 0 };
  91. UnitPopupButtons["RAID_MAINTANK"] = { text = SET_MAIN_TANK, dist = 0 };
  92. UnitPopupButtons["RAID_MAINASSIST"] = { text = SET_MAIN_ASSIST, dist = 0 };
  93. UnitPopupButtons["RAID_DEMOTE"] = { text = DEMOTE, dist = 0 };
  94. UnitPopupButtons["RAID_REMOVE"] = { text = REMOVE, dist = 0 };
  95.  
  96. UnitPopupButtons["PVP_REPORT_AFK"] = { text = PVP_REPORT_AFK, dist = 0 };
  97.  
  98. UnitPopupButtons["RAF_SUMMON"] = { text = RAF_SUMMON, dist = 0 };
  99. UnitPopupButtons["RAF_GRANT_LEVEL"] = { text = RAF_GRANT_LEVEL, dist = 0 };
  100.  
  101. UnitPopupButtons["VEHICLE_LEAVE"] = { text = VEHICLE_LEAVE, dist = 0 };
  102.  
  103. UnitPopupButtons["SET_FOCUS"] = { text = SET_FOCUS, dist = 0 };
  104. UnitPopupButtons["CLEAR_FOCUS"] = { text = CLEAR_FOCUS, dist = 0 };
  105. UnitPopupButtons["LOCK_FOCUS_FRAME"] = { text = LOCK_FOCUS_FRAME, dist = 0 };
  106. UnitPopupButtons["UNLOCK_FOCUS_FRAME"] = { text = UNLOCK_FOCUS_FRAME, dist = 0 };
  107.  
  108. -- Voice Chat Related
  109. UnitPopupButtons["MUTE"] = { text = MUTE, dist = 0 };
  110. UnitPopupButtons["UNMUTE"] = { text = UNMUTE, dist = 0 };
  111.  
  112. UnitPopupButtons["RAID_TARGET_ICON"] = { text = RAID_TARGET_ICON, dist = 0, nested = 1 };
  113. UnitPopupButtons["RAID_TARGET_1"] = { text = RAID_TARGET_1, dist = 0, checkable = 1, color = {r = 1.0, g = 0.92, b = 0}, icon = "Interface\\TargetingFrame\\UI-RaidTargetingIcons", tCoordLeft = 0, tCoordRight = 0.25, tCoordTop = 0, tCoordBottom = 0.25 };
  114. UnitPopupButtons["RAID_TARGET_2"] = { text = RAID_TARGET_2, dist = 0, checkable = 1, color = {r = 0.98, g = 0.57, b = 0}, icon = "Interface\\TargetingFrame\\UI-RaidTargetingIcons", tCoordLeft = 0.25, tCoordRight = 0.5, tCoordTop = 0, tCoordBottom = 0.25 };
  115. UnitPopupButtons["RAID_TARGET_3"] = { text = RAID_TARGET_3, dist = 0, checkable = 1, color = {r = 0.83, g = 0.22, b = 0.9}, icon = "Interface\\TargetingFrame\\UI-RaidTargetingIcons", tCoordLeft = 0.5, tCoordRight = 0.75, tCoordTop = 0, tCoordBottom = 0.25 };
  116. UnitPopupButtons["RAID_TARGET_4"] = { text = RAID_TARGET_4, dist = 0, checkable = 1, color = {r = 0.04, g = 0.95, b = 0}, icon = "Interface\\TargetingFrame\\UI-RaidTargetingIcons", tCoordLeft = 0.75, tCoordRight = 1, tCoordTop = 0, tCoordBottom = 0.25 };
  117. UnitPopupButtons["RAID_TARGET_5"] = { text = RAID_TARGET_5, dist = 0, checkable = 1, color = {r = 0.7, g = 0.82, b = 0.875}, icon = "Interface\\TargetingFrame\\UI-RaidTargetingIcons", tCoordLeft = 0, tCoordRight = 0.25, tCoordTop = 0.25, tCoordBottom = 0.5 };
  118. UnitPopupButtons["RAID_TARGET_6"] = { text = RAID_TARGET_6, dist = 0, checkable = 1, color = {r = 0, g = 0.71, b = 1}, icon = "Interface\\TargetingFrame\\UI-RaidTargetingIcons", tCoordLeft = 0.25, tCoordRight = 0.5, tCoordTop = 0.25, tCoordBottom = 0.5 };
  119. UnitPopupButtons["RAID_TARGET_7"] = { text = RAID_TARGET_7, dist = 0, checkable = 1, color = {r = 1.0, g = 0.24, b = 0.168}, icon = "Interface\\TargetingFrame\\UI-RaidTargetingIcons", tCoordLeft = 0.5, tCoordRight = 0.75, tCoordTop = 0.25, tCoordBottom = 0.5 };
  120. UnitPopupButtons["RAID_TARGET_8"] = { text = RAID_TARGET_8, dist = 0, checkable = 1, color = {r = 0.98, g = 0.98, b = 0.98}, icon = "Interface\\TargetingFrame\\UI-RaidTargetingIcons", tCoordLeft = 0.75, tCoordRight = 1, tCoordTop = 0.25, tCoordBottom = 0.5 };
  121. UnitPopupButtons["RAID_TARGET_NONE"] = { text = RAID_TARGET_NONE, dist = 0, checkable = 1 };
  122.  
  123. --Role icons
  124. UnitPopupButtons["SELECT_ROLE"] = { text = SET_ROLE, dist = 0, nested = 1 };
  125. UnitPopupButtons["SET_ROLE_NONE"] = { text = NO_ROLE, dist = 0 };
  126. UnitPopupButtons["SET_ROLE_TANK"] = { text = INLINE_TANK_ICON.." "..TANK, dist = 0 };
  127. UnitPopupButtons["SET_ROLE_HEALER"] = { text = INLINE_HEALER_ICON.." "..HEALER, dist = 0 };
  128. UnitPopupButtons["SET_ROLE_DAMAGER"] = { text = INLINE_DAMAGER_ICON.." "..DAMAGER, dist = 0 };
  129.  
  130. -- Chat Channel Player Commands
  131. UnitPopupButtons["CHAT_PROMOTE"] = { text = MAKE_MODERATOR, dist = 0 };
  132. UnitPopupButtons["CHAT_DEMOTE"] = { text = REMOVE_MODERATOR, dist = 0 };
  133. UnitPopupButtons["CHAT_OWNER"] = { text = CHAT_OWNER, dist = 0 };
  134. UnitPopupButtons["CHAT_SILENCE"] = { text = CHAT_SILENCE, dist = 0 };
  135. UnitPopupButtons["CHAT_UNSILENCE"] = { text = CHAT_UNSILENCE, dist = 0 };
  136. UnitPopupButtons["PARTY_SILENCE"] = { text = PARTY_SILENCE, dist = 0 };
  137. UnitPopupButtons["PARTY_UNSILENCE"] = { text = PARTY_UNSILENCE, dist = 0 };
  138. UnitPopupButtons["RAID_SILENCE"] = { text = RAID_SILENCE, dist = 0 };
  139. UnitPopupButtons["RAID_UNSILENCE"] = { text = RAID_UNSILENCE, dist = 0 };
  140. UnitPopupButtons["BATTLEGROUND_SILENCE"] = { text = BATTLEGROUND_SILENCE, dist = 0 };
  141. UnitPopupButtons["BATTLEGROUND_UNSILENCE"] = { text = BATTLEGROUND_UNSILENCE, dist = 0 };
  142. UnitPopupButtons["CHAT_KICK"] = { text = CHAT_KICK, dist = 0 };
  143. UnitPopupButtons["CHAT_BAN"] = { text = CHAT_BAN, dist = 0 };
  144.  
  145. -- First level menus
  146. UnitPopupMenus = { };
  147. UnitPopupMenus["SELF"] = { "SET_FOCUS", "PVP_FLAG", "LOOT_METHOD", "LOOT_THRESHOLD", "OPT_OUT_LOOT_TITLE", "LOOT_PROMOTE", "CONVERT_TO_RAID", "CONVERT_TO_PARTY", "DUNGEON_DIFFICULTY", "RAID_DIFFICULTY", "RESET_INSTANCES", "RAID_TARGET_ICON", "SELECT_ROLE", "LEAVE", "CANCEL" };
  148. UnitPopupMenus["PET"] = { "SET_FOCUS", "PET_PAPERDOLL", "PET_RENAME", "PET_ABANDON", "PET_DISMISS", "CANCEL" };
  149. UnitPopupMenus["PARTY"] = { "SET_FOCUS", "MUTE", "UNMUTE", "PARTY_SILENCE", "PARTY_UNSILENCE", "RAID_SILENCE", "RAID_UNSILENCE", "BATTLEGROUND_SILENCE", "BATTLEGROUND_UNSILENCE", "WHISPER", "PROMOTE", "PROMOTE_GUIDE", "LOOT_PROMOTE", "VOTE_TO_KICK", "UNINVITE", "INSPECT", "ACHIEVEMENTS", "TRADE", "FOLLOW", "DUEL", "RAID_TARGET_ICON", "SELECT_ROLE", "PVP_REPORT_AFK", "RAF_SUMMON", "RAF_GRANT_LEVEL", "CANCEL" };
  150. UnitPopupMenus["PLAYER"] = { "SET_FOCUS", "WHISPER", "INSPECT", "INVITE", "ACHIEVEMENTS", "TRADE", "FOLLOW", "DUEL", "RAID_TARGET_ICON", "RAF_SUMMON", "RAF_GRANT_LEVEL", "CANCEL" };
  151. UnitPopupMenus["RAID_PLAYER"] = { "SET_FOCUS", "MUTE", "UNMUTE", "RAID_SILENCE", "RAID_UNSILENCE", "BATTLEGROUND_SILENCE", "BATTLEGROUND_UNSILENCE", "WHISPER", "INSPECT", "ACHIEVEMENTS", "TRADE", "FOLLOW", "DUEL", "RAID_TARGET_ICON", "SELECT_ROLE", "RAID_LEADER", "RAID_PROMOTE", "RAID_DEMOTE", "LOOT_PROMOTE", "RAID_REMOVE", "PVP_REPORT_AFK", "RAF_SUMMON", "RAF_GRANT_LEVEL", "CANCEL" };
  152. UnitPopupMenus["RAID"] = { "SET_FOCUS", "MUTE", "UNMUTE", "RAID_SILENCE", "RAID_UNSILENCE", "BATTLEGROUND_SILENCE", "BATTLEGROUND_UNSILENCE", "RAID_LEADER", "RAID_PROMOTE", "RAID_MAINTANK", "RAID_MAINASSIST", "LOOT_PROMOTE", "RAID_DEMOTE", "RAID_REMOVE", "PVP_REPORT_AFK", "CANCEL" };
  153. UnitPopupMenus["FRIEND_OFFLINE"] = { "SET_NOTE", "IGNORE", "REMOVE_FRIEND", "CANCEL" };
  154. UnitPopupMenus["BN_FRIEND"] = { "WHISPER", "POP_OUT_CHAT", "CREATE_CONVERSATION_WITH", "BN_INVITE", "BN_TARGET", "BN_SET_NOTE", "BN_VIEW_FRIENDS", "BLOCK_COMMUNICATION", "BN_REPORT", "BN_REMOVE_FRIEND", "CANCEL" };
  155. UnitPopupMenus["BN_FRIEND_OFFLINE"] = { "BN_SET_NOTE", "BN_VIEW_FRIENDS", "BN_REPORT", "BN_REMOVE_FRIEND", "CANCEL" };
  156. UnitPopupMenus["TEAM"] = { "WHISPER", "INVITE", "TARGET", "TEAM_PROMOTE", "TEAM_KICK", "TEAM_LEAVE", "CANCEL" };
  157. UnitPopupMenus["RAID_TARGET_ICON"] = { "RAID_TARGET_1", "RAID_TARGET_2", "RAID_TARGET_3", "RAID_TARGET_4", "RAID_TARGET_5", "RAID_TARGET_6", "RAID_TARGET_7", "RAID_TARGET_8", "RAID_TARGET_NONE" };
  158. UnitPopupMenus["SELECT_ROLE"] = { "SET_ROLE_TANK", "SET_ROLE_HEALER", "SET_ROLE_DAMAGER", "SET_ROLE_NONE" };
  159. UnitPopupMenus["CHAT_ROSTER"] = { "WHISPER", "TARGET", "MUTE", "UNMUTE", "CHAT_SILENCE", "CHAT_UNSILENCE", "CHAT_PROMOTE", "CHAT_DEMOTE", "CHAT_OWNER", "CANCEL" };
  160. UnitPopupMenus["VEHICLE"] = { "SET_FOCUS", "RAID_TARGET_ICON", "VEHICLE_LEAVE", "CANCEL" };
  161. UnitPopupMenus["TARGET"] = { "SET_FOCUS", "RAID_TARGET_ICON", "CANCEL" };
  162. UnitPopupMenus["ARENAENEMY"] = { "SET_FOCUS", "CANCEL" };
  163. UnitPopupMenus["FOCUS"] = { "CLEAR_FOCUS", "LOCK_FOCUS_FRAME", "UNLOCK_FOCUS_FRAME", "RAID_TARGET_ICON", "CANCEL" };
  164. UnitPopupMenus["BOSS"] = { "SET_FOCUS", "RAID_TARGET_ICON", "CANCEL" };
  165.  
  166. -- Second level menus
  167. UnitPopupMenus["PVP_FLAG"] = { "PVP_ENABLE", "PVP_DISABLE"};
  168. UnitPopupMenus["LOOT_METHOD"] = { "FREE_FOR_ALL", "ROUND_ROBIN", "MASTER_LOOTER", "GROUP_LOOT", "NEED_BEFORE_GREED", "CANCEL" };
  169. UnitPopupMenus["LOOT_THRESHOLD"] = { "ITEM_QUALITY2_DESC", "ITEM_QUALITY3_DESC", "ITEM_QUALITY4_DESC", "CANCEL" };
  170. UnitPopupMenus["OPT_OUT_LOOT_TITLE"] = { "OPT_OUT_LOOT_ENABLE", "OPT_OUT_LOOT_DISABLE"};
  171. UnitPopupMenus["DUNGEON_DIFFICULTY"] = { "DUNGEON_DIFFICULTY1", "DUNGEON_DIFFICULTY2" };
  172. UnitPopupMenus["RAID_DIFFICULTY"] = { "RAID_DIFFICULTY1", "RAID_DIFFICULTY2", "RAID_DIFFICULTY3", "RAID_DIFFICULTY4" };
  173. UnitPopupMenus["BN_REPORT"] = { "BN_REPORT_SPAM", "BN_REPORT_ABUSE", "BN_REPORT_NAME" };
  174.  
  175. UnitPopupShown = {};
  176. UnitPopupShown[1] = {};
  177. UnitPopupShown[2] = {};
  178. UnitPopupShown[3] = {};
  179.  
  180. UnitLootMethod = {};
  181. UnitLootMethod["freeforall"] = { text = LOOT_FREE_FOR_ALL, tooltipText = NEWBIE_TOOLTIP_UNIT_FREE_FOR_ALL };
  182. UnitLootMethod["roundrobin"] = { text = LOOT_ROUND_ROBIN, tooltipText = NEWBIE_TOOLTIP_UNIT_ROUND_ROBIN };
  183. UnitLootMethod["master"] = { text = LOOT_MASTER_LOOTER, tooltipText = NEWBIE_TOOLTIP_UNIT_MASTER_LOOTER };
  184. UnitLootMethod["group"] = { text = LOOT_GROUP_LOOT, tooltipText = NEWBIE_TOOLTIP_UNIT_GROUP_LOOT };
  185. UnitLootMethod["needbeforegreed"] = { text = LOOT_NEED_BEFORE_GREED, tooltipText = NEWBIE_TOOLTIP_UNIT_NEED_BEFORE_GREED };
  186.  
  187.  
  188. UnitPopupFrames = {
  189. "PlayerFrameDropDown",
  190. "TargetFrameDropDown",
  191. "FocusFrameDropDown",
  192. "PartyMemberFrame1DropDown",
  193. "PartyMemberFrame2DropDown",
  194. "PartyMemberFrame3DropDown",
  195. "PartyMemberFrame4DropDown",
  196. "FriendsDropDown"
  197. };
  198.  
  199. function UnitPopup_ShowMenu (dropdownMenu, which, unit, name, userData)
  200. local server = nil;
  201. -- Init variables
  202. dropdownMenu.which = which;
  203. dropdownMenu.unit = unit;
  204. if ( unit ) then
  205. name, server = UnitName(unit);
  206. elseif ( name ) then
  207. local n, s = strmatch(name, "^([^-]+)-(.*)");
  208. if ( n ) then
  209. name = n;
  210. server = s;
  211. end
  212. end
  213. dropdownMenu.name = name;
  214. dropdownMenu.userData = userData;
  215. dropdownMenu.server = server;
  216.  
  217. -- Determine which buttons should be shown or hidden
  218. UnitPopup_HideButtons();
  219.  
  220. -- If only one menu item (the cancel button) then don't show the menu
  221. local count = 0;
  222. for index, value in ipairs(UnitPopupMenus[which]) do
  223. if( UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] == 1 and value ~= "CANCEL" ) then
  224. count = count + 1;
  225. end
  226. end
  227. if ( count < 1 ) then
  228. return;
  229. end
  230.  
  231. -- Determine which loot method and which loot threshold are selected and set the corresponding buttons to the same text
  232. dropdownMenu.selectedLootMethod = UnitLootMethod[GetLootMethod()].text;
  233. UnitPopupButtons["LOOT_METHOD"].text = dropdownMenu.selectedLootMethod;
  234. UnitPopupButtons["LOOT_METHOD"].tooltipText = UnitLootMethod[GetLootMethod()].tooltipText;
  235. dropdownMenu.selectedLootThreshold = _G["ITEM_QUALITY"..GetLootThreshold().."_DESC"];
  236. UnitPopupButtons["LOOT_THRESHOLD"].text = dropdownMenu.selectedLootThreshold;
  237. -- This allows player to view loot settings if he's not the leader
  238. if ( ((GetNumPartyMembers() > 0) or (GetNumRaidMembers() > 0)) and IsPartyLeader() and not HasLFGRestrictions()) then
  239. -- If this is true then player is the party leader
  240. UnitPopupButtons["LOOT_METHOD"].nested = 1;
  241. UnitPopupButtons["LOOT_THRESHOLD"].nested = 1;
  242. else
  243. UnitPopupButtons["LOOT_METHOD"].nested = nil;
  244. UnitPopupButtons["LOOT_THRESHOLD"].nested = nil;
  245. end
  246. -- Set the selected opt out of loot option to the opt out of loot button text
  247. if ( GetOptOutOfLoot() ) then
  248. UnitPopupButtons["OPT_OUT_LOOT_TITLE"].text = format(OPT_OUT_LOOT_TITLE, UnitPopupButtons["OPT_OUT_LOOT_ENABLE"].text);
  249. else
  250. UnitPopupButtons["OPT_OUT_LOOT_TITLE"].text = format(OPT_OUT_LOOT_TITLE, UnitPopupButtons["OPT_OUT_LOOT_DISABLE"].text);
  251. end
  252. -- Disable dungeon and raid difficulty in instances except for for leaders in dynamic instances
  253. local selectedRaidDifficulty, allowedRaidDifficultyChange;
  254. local _, instanceType, _, _, _, _, isDynamicInstance = GetInstanceInfo();
  255. if ( isDynamicInstance and CanChangePlayerDifficulty() ) then
  256. selectedRaidDifficulty, allowedRaidDifficultyChange = _GetPlayerDifficultyMenuOptions();
  257. end
  258. if ( instanceType == "none" ) then
  259. UnitPopupButtons["DUNGEON_DIFFICULTY"].nested = 1;
  260. UnitPopupButtons["RAID_DIFFICULTY"].nested = 1;
  261. else
  262. UnitPopupButtons["DUNGEON_DIFFICULTY"].nested = nil;
  263. if ( allowedRaidDifficultyChange ) then
  264. UnitPopupButtons["RAID_DIFFICULTY"].nested = 1;
  265. else
  266. UnitPopupButtons["RAID_DIFFICULTY"].nested = nil;
  267. end
  268. end
  269.  
  270. --Add the cooldown to the RAF Summon
  271. do
  272. local start, duration = GetSummonFriendCooldown();
  273. local remaining = start + duration - GetTime();
  274. if ( remaining > 0 ) then
  275. UnitPopupButtons["RAF_SUMMON"].text = format(RAF_SUMMON_WITH_COOLDOWN, SecondsToTime(remaining, true));
  276. else
  277. UnitPopupButtons["RAF_SUMMON"].text = RAF_SUMMON;
  278. end
  279. end
  280.  
  281. -- If level 2 dropdown
  282. local info;
  283. local color;
  284. local icon;
  285. if ( UIDROPDOWNMENU_MENU_LEVEL == 2 ) then
  286. dropdownMenu.which = UIDROPDOWNMENU_MENU_VALUE;
  287. -- Set which menu is being opened
  288. OPEN_DROPDOWNMENUS[UIDROPDOWNMENU_MENU_LEVEL] = {which = dropdownMenu.which, unit = dropdownMenu.unit};
  289. info = UIDropDownMenu_CreateInfo();
  290. for index, value in ipairs(UnitPopupMenus[UIDROPDOWNMENU_MENU_VALUE]) do
  291. info.text = UnitPopupButtons[value].text;
  292. info.owner = UIDROPDOWNMENU_MENU_VALUE;
  293. -- Set the text color
  294. color = UnitPopupButtons[value].color;
  295. if ( color ) then
  296. info.colorCode = string.format("|cFF%02x%02x%02x", color.r*255, color.g*255, color.b*255);
  297. else
  298. info.colorCode = nil;
  299. end
  300. -- Icons
  301. info.icon = UnitPopupButtons[value].icon;
  302. info.tCoordLeft = UnitPopupButtons[value].tCoordLeft;
  303. info.tCoordRight = UnitPopupButtons[value].tCoordRight;
  304. info.tCoordTop = UnitPopupButtons[value].tCoordTop;
  305. info.tCoordBottom = UnitPopupButtons[value].tCoordBottom;
  306. -- Checked conditions
  307. info.checked = nil;
  308. if ( info.text == dropdownMenu.selectedLootMethod ) then
  309. info.checked = 1;
  310. elseif ( info.text == dropdownMenu.selectedLootThreshold ) then
  311. info.checked = 1;
  312. elseif ( strsub(value, 1, 12) == "RAID_TARGET_" ) then
  313. local raidTargetIndex = GetRaidTargetIndex(unit);
  314. if ( raidTargetIndex == index ) then
  315. info.checked = 1;
  316. end
  317. elseif ( strsub(value, 1, 18) == "DUNGEON_DIFFICULTY" and (strlen(value) > 18)) then
  318. local dungeonDifficulty = GetDungeonDifficulty();
  319. if ( dungeonDifficulty == index ) then
  320. info.checked = 1;
  321. end
  322. local inParty = 0;
  323. if ( (GetNumPartyMembers() > 0) or (GetNumRaidMembers() > 0) ) then
  324. inParty = 1;
  325. end
  326. local isLeader = 0;
  327. if ( IsPartyLeader() ) then
  328. isLeader = 1;
  329. end
  330. local inInstance, instanceType = IsInInstance();
  331. if ( ( inParty == 1 and isLeader == 0 ) or inInstance ) then
  332. info.disabled = 1;
  333. end
  334. elseif ( strsub(value, 1, 15) == "RAID_DIFFICULTY" and (strlen(value) > 15)) then
  335. if ( isDynamicInstance ) then
  336. if ( selectedRaidDifficulty == index ) then
  337. info.checked = 1;
  338. end
  339. else
  340. local dungeonDifficulty = GetRaidDifficulty();
  341. if ( dungeonDifficulty == index ) then
  342. info.checked = 1;
  343. end
  344. end
  345. local inParty = 0;
  346. if ( (GetNumPartyMembers() > 0) or (GetNumRaidMembers() > 0) ) then
  347. inParty = 1;
  348. end
  349. local isLeader = 0;
  350. if ( IsPartyLeader() ) then
  351. isLeader = 1;
  352. end
  353. local inInstance, instanceType = IsInInstance();
  354. if ( ( inParty == 1 and isLeader == 0 ) or inInstance ) then
  355. info.disabled = 1;
  356. end
  357. if ( allowedRaidDifficultyChange and allowedRaidDifficultyChange == value ) then
  358. info.disabled = nil;
  359. end
  360. elseif ( value == "PVP_ENABLE" ) then
  361. if ( GetPVPDesired() == 1 ) then
  362. info.checked = 1;
  363. end
  364. elseif ( value == "PVP_DISABLE" ) then
  365. if ( GetPVPDesired() == 0 ) then
  366. info.checked = 1;
  367. end
  368. elseif ( value == "OPT_OUT_LOOT_ENABLE" ) then
  369. if ( GetOptOutOfLoot() ) then
  370. info.checked = 1;
  371. end
  372. elseif ( value == "OPT_OUT_LOOT_DISABLE" ) then
  373. if ( not GetOptOutOfLoot() ) then
  374. info.checked = 1;
  375. end
  376. elseif ( strsub(value, 1, 9) == "SET_ROLE_" ) then
  377. if ( UnitGroupRolesAssigned(unit) == strsub(value, 10) ) then
  378. info.checked = 1;
  379. end
  380. end
  381.  
  382. info.value = value;
  383. info.func = UnitPopup_OnClick;
  384. -- Setup newbie tooltips
  385. info.tooltipTitle = UnitPopupButtons[value].text;
  386. info.tooltipText = _G["NEWBIE_TOOLTIP_UNIT_"..value];
  387. UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
  388. end
  389. return;
  390. end
  391.  
  392. -- Add dropdown title
  393. if ( unit or name ) then
  394. info = UIDropDownMenu_CreateInfo();
  395. if ( name ) then
  396. info.text = name;
  397. else
  398. info.text = UNKNOWN;
  399. end
  400. info.isTitle = 1;
  401. info.notCheckable = 1;
  402. UIDropDownMenu_AddButton(info);
  403. end
  404.  
  405. -- Set which menu is being opened
  406. OPEN_DROPDOWNMENUS[UIDROPDOWNMENU_MENU_LEVEL] = {which = dropdownMenu.which, unit = dropdownMenu.unit};
  407. -- Show the buttons which are used by this menu
  408. local tooltipText;
  409. info = UIDropDownMenu_CreateInfo();
  410. for index, value in ipairs(UnitPopupMenus[which]) do
  411. if( UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] == 1 ) then
  412. info.text = UnitPopupButtons[value].text;
  413. info.value = value;
  414. info.owner = which;
  415. info.func = UnitPopup_OnClick;
  416. if ( not UnitPopupButtons[value].checkable ) then
  417. info.notCheckable = 1;
  418. else
  419. info.notCheckable = nil;
  420. end
  421. -- Text color
  422. if ( value == "LOOT_THRESHOLD" ) then
  423. -- Set the text color
  424. info.colorCode = ITEM_QUALITY_COLORS[GetLootThreshold()].hex;
  425. else
  426. color = UnitPopupButtons[value].color;
  427. if ( color ) then
  428. info.colorCode = string.format("|cFF%02x%02x%02x", color.r*255, color.g*255, color.b*255);
  429. else
  430. info.colorCode = nil;
  431. end
  432. end
  433.  
  434. -- Icons
  435. info.icon = UnitPopupButtons[value].icon;
  436. info.tCoordLeft = UnitPopupButtons[value].tCoordLeft;
  437. info.tCoordRight = UnitPopupButtons[value].tCoordRight;
  438. info.tCoordTop = UnitPopupButtons[value].tCoordTop;
  439. info.tCoordBottom = UnitPopupButtons[value].tCoordBottom;
  440. -- Checked conditions
  441. info.checked = nil;
  442. if ( strsub(value, 1, 12) == "RAID_TARGET_"and value ~= "RAID_TARGET_ICON" ) then
  443. local raidTargetIndex = GetRaidTargetIndex("target");
  444. if ( raidTargetIndex == index ) then
  445. info.checked = 1;
  446. end
  447. end
  448.  
  449. if ( UnitPopupButtons[value].nested ) then
  450. info.hasArrow = 1;
  451. else
  452. info.hasArrow = nil;
  453. end
  454.  
  455. -- Setup newbie tooltips
  456. info.tooltipTitle = UnitPopupButtons[value].text;
  457. tooltipText = _G["NEWBIE_TOOLTIP_UNIT_"..value];
  458. if ( not tooltipText ) then
  459. tooltipText = UnitPopupButtons[value].tooltipText;
  460. end
  461. info.tooltipText = tooltipText;
  462. UIDropDownMenu_AddButton(info);
  463. end
  464. end
  465. PlaySound("igMainMenuOpen");
  466. end
  467.  
  468. function UnitPopup_HideButtons ()
  469. local dropdownMenu = UIDROPDOWNMENU_INIT_MENU;
  470. local inInstance, instanceType = IsInInstance();
  471. local inParty = 0;
  472. if ( (GetNumPartyMembers() > 0) or (GetNumRaidMembers() > 0) ) then
  473. inParty = 1;
  474. end
  475.  
  476. local inRaid = 0;
  477. if ( (GetNumRaidMembers() > 0) ) then
  478. inRaid = 1;
  479. end
  480.  
  481. local isLeader = 0;
  482. if ( IsPartyLeader() ) then
  483. isLeader = 1;
  484. end
  485.  
  486. local isAssistant = 0;
  487. if ( IsRaidOfficer() ) then
  488. isAssistant = 1;
  489. end
  490.  
  491. local inBattleground = 0;
  492. if ( UnitInBattleground("player") ) then
  493. inBattleground = 1;
  494. end
  495.  
  496. local canCoop = 0;
  497. if ( dropdownMenu.unit and UnitCanCooperate("player", dropdownMenu.unit) ) then
  498. canCoop = 1;
  499. end
  500.  
  501. for index, value in ipairs(UnitPopupMenus[UIDROPDOWNMENU_MENU_VALUE] or UnitPopupMenus[dropdownMenu.which]) do
  502. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 1;
  503. if ( value == "TRADE" ) then
  504. if ( canCoop == 0 ) then
  505. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  506. end
  507. elseif ( value == "INVITE" ) then
  508. if ( dropdownMenu.unit ) then
  509. local _, server = UnitName(dropdownMenu.unit);
  510. if ( canCoop == 0 or UnitIsUnit("player", dropdownMenu.unit) or (server and server ~= "") ) then
  511. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  512. end
  513. elseif ( (dropdownMenu == PVPTeamManagementFrameTeamDropDown) and not PVPTeamManagementFrameTeamDropDown.online ) then
  514. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  515. elseif ( (dropdownMenu == ChannelRosterDropDown) ) then
  516. if ( UnitInRaid(dropdownMenu.name) ~= nil ) then
  517. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  518. end
  519. elseif ( dropdownMenu == FriendsDropDown and dropdownMenu.isMobile ) then
  520. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  521. else
  522. if ( dropdownMenu.name == UnitName("party1") or
  523. dropdownMenu.name == UnitName("party2") or
  524. dropdownMenu.name == UnitName("party3") or
  525. dropdownMenu.name == UnitName("party4") or
  526. dropdownMenu.name == UnitName("player")) then
  527. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  528. end
  529. end
  530. elseif ( value == "BN_INVITE" ) then
  531. local presenceID, givenName, surname, toonName = BNGetFriendInfoByID(dropdownMenu.presenceID);
  532. if ( CanCooperateWithToon(dropdownMenu.presenceID) and (UnitInParty(toonName) or UnitInRaid(toonName)) ) then
  533. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  534. end
  535. elseif ( value == "FOLLOW" ) then
  536. if ( canCoop == 0 ) then
  537. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  538. end
  539. elseif ( value == "WHISPER" ) then
  540. if ( dropdownMenu.unit ) then
  541. if ( canCoop == 0 or dropdownMenu.name == UnitName("player") ) then
  542. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  543. end
  544. elseif ( (dropdownMenu == PVPTeamManagementFrameTeamDropDown) and not PVPTeamManagementFrameTeamDropDown.online ) then
  545. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  546. end
  547. elseif ( value == "CREATE_CONVERSATION_WITH" ) then
  548. if ( not dropdownMenu.presenceID or not BNFeaturesEnabledAndConnected()) then
  549. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  550. else
  551. local presenceID, givenName, surname, toonName, toonID, client, isOnline = BNGetFriendInfoByID(dropdownMenu.presenceID);
  552. if ( not isOnline ) then
  553. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  554. end
  555. end
  556. elseif ( value == "DUEL" ) then
  557. if ( UnitCanAttack("player", dropdownMenu.unit) ) then
  558. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  559. end
  560. elseif ( value == "INSPECT" or value == "ACHIEVEMENTS" ) then
  561. if ( not dropdownMenu.unit or UnitCanAttack("player", dropdownMenu.unit) ) then
  562. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  563. end
  564. elseif ( value == "IGNORE" ) then
  565. if ( dropdownMenu.name == UnitName("player") and dropdownMenu.unit and canCoop == 0 ) then
  566. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  567. end
  568. elseif ( value == "REMOVE_FRIEND" ) then
  569. if ( not dropdownMenu.friendsList ) then
  570. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  571. end
  572. elseif ( value == "SET_NOTE" ) then
  573. if ( not dropdownMenu.friendsList ) then
  574. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  575. end
  576. elseif ( value == "BN_SET_NOTE" ) then
  577. if ( not dropdownMenu.friendsList ) then
  578. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  579. end
  580. elseif ( value == "BN_VIEW_FRIENDS" ) then
  581. if ( not dropdownMenu.friendsList ) then
  582. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  583. end
  584. elseif ( value == "BN_REMOVE_FRIEND" ) then
  585. if ( not dropdownMenu.friendsList ) then
  586. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  587. end
  588. elseif ( value == "BLOCK_COMMUNICATION" ) then
  589. -- only show it for presence IDs that are not friends
  590. if ( dropdownMenu.presenceID and BNFeaturesEnabledAndConnected()) then
  591. local presenceID, givenName, surname, toonName, toonID, client, isOnline, lastOnline, isAFK, isDND, broadcastText, noteText, isFriend = BNGetFriendInfoByID(dropdownMenu.presenceID);
  592. if ( isFriend ) then
  593. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  594. end
  595. else
  596. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  597. end
  598. elseif ( value == "BN_REPORT" ) then
  599. if ( not dropdownMenu.presenceID or not BNFeaturesEnabledAndConnected() ) then
  600. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  601. end
  602. elseif ( value == "REPORT_SPAM" ) then
  603. if ( not dropdownMenu.lineID or not CanComplainChat(dropdownMenu.lineID) ) then
  604. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  605. end
  606. elseif ( value == "POP_OUT_CHAT" ) then
  607. if ( (dropdownMenu.chatType ~= "WHISPER" and dropdownMenu.chatType ~= "BN_WHISPER") or dropdownMenu.chatTarget == UnitName("player") or
  608. FCFManager_GetNumDedicatedFrames(dropdownMenu.chatType, dropdownMenu.chatTarget) > 0 ) then
  609. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  610. end
  611. elseif ( value == "TARGET" ) then
  612. -- We don't want to show a menu option that will end up being blocked
  613. if ( InCombatLockdown() or not issecure() ) then
  614. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  615. elseif ( (dropdownMenu == PVPTeamManagementFrameTeamDropDown) and not PVPTeamManagementFrameTeamDropDown.online ) then
  616. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  617. elseif ( dropdownMenu.isMobile ) then
  618. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  619. end
  620. elseif ( value == "PROMOTE" ) then
  621. if ( (inParty == 0) or (isLeader == 0) or HasLFGRestrictions()) then
  622. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  623. end
  624. elseif ( value == "PROMOTE_GUIDE" ) then
  625. if ( (inParty == 0) or (isLeader == 0) or not HasLFGRestrictions()) then
  626. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  627. end
  628. elseif ( value == "GUILD_PROMOTE" ) then
  629. if ( not IsGuildLeader() or not UnitIsInMyGuild(dropdownMenu.name) or dropdownMenu.name == UnitName("player") or not GuildFrame or not GuildFrame:IsShown() ) then
  630. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  631. end
  632. elseif ( value == "GUILD_LEAVE" ) then
  633. if ( dropdownMenu.name ~= UnitName("player") or not GuildFrame or not GuildFrame:IsShown() ) then
  634. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  635. end
  636. elseif ( value == "TEAM_PROMOTE" ) then
  637. if ( dropdownMenu.name == UnitName("player") or not PVP_ArenaTeamFrame():IsShown() ) then
  638. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  639. elseif ( PVP_ArenaTeamFrame():IsShown() and not IsArenaTeamCaptain(PVP_GetSelectedArenaTeam()) ) then
  640. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  641. end
  642. elseif ( value == "TEAM_KICK" ) then
  643. if ( dropdownMenu.name == UnitName("player") or not PVP_ArenaTeamFrame():IsShown() ) then
  644. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  645. elseif ( PVP_ArenaTeamFrame():IsShown() and not IsArenaTeamCaptain(PVP_GetSelectedArenaTeam()) ) then
  646. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  647. end
  648. elseif ( value == "TEAM_LEAVE" ) then
  649. if ( dropdownMenu.name ~= UnitName("player") or not PVP_ArenaTeamFrame():IsShown() ) then
  650. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  651. end
  652. elseif ( value == "UNINVITE" ) then
  653. if ( (inParty == 0) or (isLeader == 0) or (instanceType == "pvp") or (instanceType == "arena") or HasLFGRestrictions() ) then
  654. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  655. end
  656. elseif ( value == "VOTE_TO_KICK" ) then
  657. if ( (inParty == 0) or (instanceType == "pvp") or (instanceType == "arena") or (not HasLFGRestrictions()) ) then
  658. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  659. end
  660. elseif ( value == "LEAVE" ) then
  661. if ( (inParty == 0) ) then
  662. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  663. end
  664. elseif ( value == "FREE_FOR_ALL" ) then
  665. if ( (inParty == 0) or ((isLeader == 0) and (GetLootMethod() ~= "freeforall")) ) then
  666. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  667. end
  668. elseif ( value == "ROUND_ROBIN" ) then
  669. if ( (inParty == 0) or ((isLeader == 0) and (GetLootMethod() ~= "roundrobin")) ) then
  670. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  671. end
  672. elseif ( value == "MASTER_LOOTER" ) then
  673. if ( (inParty == 0) or ((isLeader == 0) and (GetLootMethod() ~= "master")) ) then
  674. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  675. end
  676. elseif ( value == "GROUP_LOOT" ) then
  677. if ( (inParty == 0) or ((isLeader == 0) and (GetLootMethod() ~= "group")) ) then
  678. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  679. end
  680. elseif ( value == "NEED_BEFORE_GREED" ) then
  681. if ( (inParty == 0) or ((isLeader == 0) and (GetLootMethod() ~= "needbeforegreed")) ) then
  682. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  683. end
  684. elseif ( value == "LOOT_THRESHOLD" ) then
  685. if ( inParty == 0 or HasLFGRestrictions() ) then
  686. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  687. end
  688. elseif ( value == "OPT_OUT_LOOT_TITLE" ) then
  689. if ( inParty == 0 or ( inParty == 1 and GetLootMethod() == "freeforall" ) ) then
  690. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  691. end
  692. elseif ( value == "LOOT_PROMOTE" ) then
  693. local lootMethod;
  694. local partyIndex, raidIndex;
  695. local isMaster = nil;
  696. lootMethod, partyIndex, raidIndex = GetLootMethod();
  697. if ( (dropdownMenu.which == "RAID") or (dropdownMenu.which == "RAID_PLAYER") ) then
  698. if ( raidIndex and (dropdownMenu.unit == "raid"..raidIndex) ) then
  699. isMaster = 1;
  700. end
  701. elseif ( dropdownMenu.which == "SELF" ) then
  702. if ( partyIndex and (partyIndex == 0) ) then
  703. isMaster = 1;
  704. end
  705. else
  706. if ( partyIndex and (dropdownMenu.unit == "party"..partyIndex) ) then
  707. isMaster = 1;
  708. end
  709. end
  710. if ( (inParty == 0) or (isLeader == 0) or (lootMethod ~= "master") or isMaster ) then
  711. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  712. end
  713. elseif ( value == "LOOT_METHOD" ) then
  714. if ( inParty == 0 ) then
  715. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  716. end
  717. elseif ( value == "CONVERT_TO_RAID" ) then
  718. if ( inParty ~= 1 or inRaid == 1 or isLeader ~= 1 ) then
  719. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  720. end
  721. elseif ( value == "CONVERT_TO_PARTY" ) then
  722. if ( inRaid ~= 1 or isLeader ~= 1 ) then
  723. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  724. end
  725. elseif ( value == "RESET_INSTANCES" ) then
  726. if ( ( inParty == 1 and isLeader == 0 ) or inInstance) then
  727. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  728. end
  729. elseif ( value == "DUNGEON_DIFFICULTY" ) then
  730. if ( UnitLevel("player") < 65 and GetDungeonDifficulty() == 1 ) then
  731. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  732. end
  733. elseif ( value == "RAID_DIFFICULTY" ) then
  734. if ( UnitLevel("player") < 65 and GetRaidDifficulty() == 1 ) then
  735. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  736. end
  737. elseif ( value == "MUTE" ) then
  738. if ( not IsVoiceChatEnabled() or (dropdownMenu.unit and not UnitIsConnected(dropdownMenu.unit)) ) then
  739. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  740. else
  741. -- Hide if already muted.
  742. if ( dropdownMenu.name == UnitName("player") or IsMuted(dropdownMenu.name) ) then
  743. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  744. end
  745. end
  746. elseif ( value == "UNMUTE" ) then
  747. if ( not IsVoiceChatEnabled() ) then
  748. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  749. else
  750. -- Hide if not muted or not online.
  751. if ( dropdownMenu.name == UnitName("player") or not IsMuted(dropdownMenu.name) ) then
  752. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  753. end
  754. end
  755. elseif ( value == "RAID_LEADER" ) then
  756. if ( (isLeader == 0) or UnitIsPartyLeader(dropdownMenu.unit)or not dropdownMenu.name ) then
  757. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  758. end
  759. elseif ( value == "RAID_PROMOTE" ) then
  760. if ( isLeader == 0 ) then
  761. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  762. elseif ( isLeader == 1 ) then
  763. if ( UnitIsRaidOfficer(dropdownMenu.unit) ) then
  764. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  765. end
  766. end
  767. elseif ( value == "RAID_DEMOTE" ) then
  768. if ( ( isLeader == 0 and isAssistant == 0 ) or not dropdownMenu.name ) then
  769. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  770. elseif ( not GetPartyAssignment("MAINTANK", dropdownMenu.name, 1) and not GetPartyAssignment("MAINASSIST", dropdownMenu.name, 1) ) then
  771. if ( isLeader == 0 and isAssistant == 1 and UnitIsRaidOfficer(dropdownMenu.unit) ) then
  772. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  773. elseif ( isLeader == 1 or isAssistant == 1 ) then
  774. if ( UnitIsPartyLeader(dropdownMenu.unit) or not UnitIsRaidOfficer(dropdownMenu.unit)) then
  775. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  776. end
  777. end
  778. end
  779. elseif ( value == "RAID_MAINTANK" ) then
  780. -- We don't want to show a menu option that will end up being blocked
  781. local name, rank, subgroup, level, class, fileName, zone, online, isDead, role = GetRaidRosterInfo(dropdownMenu.userData);
  782. if ( not issecure() or (isLeader == 0 and isAssistant == 0) or (role == "MAINTANK") or not dropdownMenu.name ) then
  783. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  784. end
  785. elseif ( value == "RAID_MAINASSIST" ) then
  786. -- We don't want to show a menu option that will end up being blocked
  787. local name, rank, subgroup, level, class, fileName, zone, online, isDead, role = GetRaidRosterInfo(dropdownMenu.userData);
  788. if ( not issecure() or (isLeader == 0 and isAssistant == 0) or (role == "MAINASSIST") or not dropdownMenu.name ) then
  789. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  790. end
  791. elseif ( value == "RAID_REMOVE" ) then
  792. if ( ( isLeader == 0 and isAssistant == 0 ) or not dropdownMenu.name ) then
  793. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  794. elseif ( isLeader == 0 and isAssistant == 1 and UnitIsRaidOfficer(dropdownMenu.unit) ) then
  795. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  796. elseif ( isLeader == 1 and UnitIsUnit(dropdownMenu.unit, "player") ) then
  797. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  798. end
  799. elseif ( value == "PVP_REPORT_AFK" ) then
  800. if ( not IsInActiveWorldPVP() and (inBattleground == 0 or GetCVar("enablePVPNotifyAFK") == "0") ) then
  801. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  802. elseif ( dropdownMenu.unit ) then
  803. if ( UnitIsUnit(dropdownMenu.unit,"player") ) then
  804. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  805. elseif ( not UnitInBattleground(dropdownMenu.unit) and not IsInActiveWorldPVP() ) then
  806. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  807. elseif ( (PlayerIsPVPInactive(dropdownMenu.unit)) ) then
  808. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  809. end
  810. elseif ( dropdownMenu.name ) then
  811. if ( dropdownMenu.name == UnitName("player") ) then
  812. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  813. elseif ( not UnitInBattleground(dropdownMenu.name) ) then
  814. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  815. end
  816. end
  817. elseif ( value == "RAF_SUMMON" ) then
  818. if( not IsReferAFriendLinked(dropdownMenu.unit) ) then
  819. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  820. end
  821. elseif ( value == "RAF_GRANT_LEVEL" ) then
  822. if( not IsReferAFriendLinked(dropdownMenu.unit) ) then
  823. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  824. end
  825. elseif ( value == "PET_PAPERDOLL" ) then
  826. if( not PetCanBeAbandoned() ) then
  827. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  828. end
  829. elseif ( value == "PET_RENAME" ) then
  830. if( not PetCanBeAbandoned() or not PetCanBeRenamed() ) then
  831. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  832. end
  833. elseif ( value == "PET_ABANDON" ) then
  834. if( not PetCanBeAbandoned() or not PetHasActionBar() ) then
  835. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  836. end
  837. elseif ( value == "PET_DISMISS" ) then
  838. if( PetCanBeAbandoned() or not PetCanBeDismissed() ) then
  839. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  840. end
  841. elseif ( strsub(value, 1, 12) == "RAID_TARGET_" ) then
  842. -- Task #30755. Let any party member mark targets
  843. -- Task 34335 - But only raid leaders can mark targets.
  844. if ( inRaid == 1 and isLeader == 0 and isAssistant == 0 ) then
  845. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  846. end
  847. if ( not (dropdownMenu.which == "SELF") ) then
  848. if ( UnitExists("target") and not UnitPlayerOrPetInParty("target") and not UnitPlayerOrPetInRaid("target") ) then
  849. if ( UnitIsPlayer("target") and (not UnitCanCooperate("player", "target") and not UnitIsUnit("target", "player")) ) then
  850. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  851. end
  852. end
  853. end
  854.  
  855. elseif ( value == "CHAT_PROMOTE" ) then
  856. if ( dropdownMenu.category == "CHANNEL_CATEGORY_GROUP" ) then
  857. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  858. else
  859. if ( not IsDisplayChannelOwner() or dropdownMenu.owner or dropdownMenu.moderator or dropdownMenu.name == UnitName("player") ) then
  860. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  861. end
  862. end
  863. elseif ( value == "CHAT_DEMOTE" ) then
  864. if ( dropdownMenu.category == "CHANNEL_CATEGORY_GROUP" ) then
  865. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  866. else
  867. if ( not IsDisplayChannelOwner() or dropdownMenu.owner or not dropdownMenu.moderator or dropdownMenu.name == UnitName("player") ) then
  868. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  869. end
  870. end
  871. elseif ( value == "CHAT_OWNER" ) then
  872. if ( dropdownMenu.category == "CHANNEL_CATEGORY_GROUP" ) then
  873. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  874. else
  875. if ( not IsDisplayChannelOwner() or dropdownMenu.owner or dropdownMenu.name == UnitName("player") ) then
  876. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  877. end
  878. end
  879. elseif ( value == "CHAT_SILENCE" ) then
  880. if ( not IsVoiceChatEnabled() or not dropdownMenu.name or dropdownMenu.name == UNKNOWNOBJECT or not GetVoiceStatus(dropdownMenu.name) ) then
  881. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  882. else
  883. if ( IsDisplayChannelModerator() and dropdownMenu.name ~= UnitName("player") ) then
  884. if ( IsSilenced(dropdownMenu.name) ) then
  885. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  886. end
  887. else
  888. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  889. end
  890. end
  891. elseif ( value == "CHAT_UNSILENCE" ) then
  892. if ( not IsVoiceChatEnabled() or not dropdownMenu.name or dropdownMenu.name == UNKNOWNOBJECT or not GetVoiceStatus(dropdownMenu.name) ) then
  893. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  894. else
  895. if ( IsDisplayChannelModerator() ) then
  896. if ( not IsSilenced(dropdownMenu.name) ) then
  897. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  898. end
  899. else
  900. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  901. end
  902. end
  903. elseif ( value == "PARTY_SILENCE" ) then
  904. if ( not IsVoiceChatEnabled() or not dropdownMenu.name or dropdownMenu.name == UNKNOWNOBJECT or not GetVoiceStatus(dropdownMenu.name) ) then
  905. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  906. else
  907. if ( ( inParty == 1 and isLeader == 1 and inRaid == 0 ) and dropdownMenu.name ~= UnitName("player") ) then
  908. if ( UnitIsSilenced(dropdownMenu.name, "party") ) then
  909. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  910. end
  911. dropdownMenu.channelName = "party";
  912. else
  913. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  914. end
  915. end
  916. elseif ( value == "PARTY_UNSILENCE" ) then
  917. if ( not IsVoiceChatEnabled() or not dropdownMenu.name or dropdownMenu.name == UNKNOWNOBJECT or not GetVoiceStatus(dropdownMenu.name) ) then
  918. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  919. else
  920. if ( ( inParty == 1 and isLeader == 1 and inRaid == 0 ) ) then
  921. if ( not UnitIsSilenced(dropdownMenu.name, "party") ) then
  922. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  923. end
  924. dropdownMenu.channelName = "party";
  925. else
  926. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  927. end
  928. end
  929. elseif ( value == "RAID_SILENCE" ) then
  930. if ( not IsVoiceChatEnabled() or not dropdownMenu.name or dropdownMenu.name == UNKNOWNOBJECT or not GetVoiceStatus(dropdownMenu.name) ) then
  931. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  932. else
  933. if ( inBattleground == 0 ) then
  934. if ( ( inParty == 1 and isAssistant == 1 and inRaid == 1 ) and dropdownMenu.name ~= UnitName("player") ) then
  935. if ( UnitIsSilenced(dropdownMenu.name, "raid") ) then
  936. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  937. end
  938. dropdownMenu.channelName = "raid";
  939. else
  940. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  941. end
  942. else
  943. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  944. end
  945. end
  946. elseif ( value == "RAID_UNSILENCE" ) then
  947. if ( not IsVoiceChatEnabled() or not dropdownMenu.name or dropdownMenu.name == UNKNOWNOBJECT or not GetVoiceStatus(dropdownMenu.name) ) then
  948. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  949. else
  950. if ( inBattleground == 0 ) then
  951. if ( ( inParty == 1 and isAssistant == 1 and inRaid == 1 ) ) then
  952. if ( not UnitIsSilenced(dropdownMenu.name, "raid") ) then
  953. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  954. end
  955. dropdownMenu.channelName = "raid";
  956. else
  957. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  958. end
  959. else
  960. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  961. end
  962. end
  963. elseif ( value == "BATTLEGROUND_SILENCE" ) then
  964. if ( not IsVoiceChatEnabled() or not dropdownMenu.name or dropdownMenu.name == UNKNOWNOBJECT or not GetVoiceStatus(dropdownMenu.name) ) then
  965. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  966. else
  967. if ( inBattleground == 1 ) then
  968. if ( ( inParty == 1 and isAssistant == 1 and inRaid == 1 ) and dropdownMenu.name ~= UnitName("player") ) then
  969. if ( UnitIsSilenced(dropdownMenu.name, "battleground") ) then
  970. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  971. end
  972. dropdownMenu.channelName = "battleground";
  973. else
  974. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  975. end
  976. else
  977. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  978. end
  979. end
  980. elseif ( value == "BATTLEGROUND_UNSILENCE" ) then
  981. if ( not IsVoiceChatEnabled() or not dropdownMenu.name or dropdownMenu.name == UNKNOWNOBJECT or not GetVoiceStatus(dropdownMenu.name) ) then
  982. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  983. else
  984. if ( inBattleground == 1 ) then
  985. if ( ( inParty == 1 and isAssistant == 1 and inRaid == 1 ) ) then
  986. if ( not UnitIsSilenced(dropdownMenu.name, "battleground") ) then
  987. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  988. end
  989. dropdownMenu.channelName = "battleground";
  990. else
  991. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  992. end
  993. else
  994. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  995. end
  996. end
  997. elseif ( value == "CHAT_KICK" ) then
  998. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  999. elseif ( value == "CHAT_LEAVE" ) then
  1000. if ( not dropdownMenu.active or dropdownMenu.group) then
  1001. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  1002. end
  1003. elseif ( value == "VEHICLE_LEAVE" ) then
  1004. if ( not CanExitVehicle() ) then
  1005. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  1006. end
  1007. elseif ( value == "LOCK_FOCUS_FRAME" ) then
  1008. if ( FocusFrame_IsLocked() ) then
  1009. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  1010. end
  1011. elseif ( value == "UNLOCK_FOCUS_FRAME" ) then
  1012. if ( not FocusFrame_IsLocked() ) then
  1013. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  1014. end
  1015. elseif ( value == "SELECT_ROLE" ) then
  1016. if ( not ( (GetNumPartyMembers() > 0 or GetNumRaidMembers() > 0) and not HasLFGRestrictions() and (isLeader ~= 0 or isAssistant ~= 0 or UnitIsUnit(dropdownMenu.unit, "player")) ) ) then
  1017. UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0;
  1018. end
  1019. end
  1020. end
  1021. end
  1022.  
  1023. function UnitPopup_OnUpdate (elapsed)
  1024. if ( not DropDownList1:IsShown() ) then
  1025. return;
  1026. end
  1027.  
  1028. -- If none of the untipopup frames are visible then return
  1029. for index, value in ipairs(UnitPopupFrames) do
  1030. if ( UIDROPDOWNMENU_OPEN_MENU == _G[value] ) then
  1031. break;
  1032. end
  1033. end
  1034.  
  1035. local currentDropDown = UIDROPDOWNMENU_OPEN_MENU;
  1036.  
  1037. local inParty = 0;
  1038. if ( (GetNumPartyMembers() > 0) or (GetNumRaidMembers() > 0) ) then
  1039. inParty = 1;
  1040. end
  1041.  
  1042. local isCaptain
  1043. if (PVP_GetSelectedArenaTeam() and IsArenaTeamCaptain(PVP_GetSelectedArenaTeam()) ) then
  1044. isCaptain = 1;
  1045. end
  1046.  
  1047. local isLeader = 0;
  1048. if ( IsPartyLeader() ) then
  1049. isLeader = 1;
  1050. end
  1051. local isAssistant = 0;
  1052. if ( IsRaidOfficer() ) then
  1053. isAssistant = 1;
  1054. end
  1055.  
  1056. -- dynamic difficulty
  1057. local allowedRaidDifficultyChange;
  1058. local _, instanceType, _, _, _, _, isDynamicInstance = GetInstanceInfo();
  1059. if ( isDynamicInstance and CanChangePlayerDifficulty() ) then
  1060. _, allowedRaidDifficultyChange = _GetPlayerDifficultyMenuOptions();
  1061. end
  1062.  
  1063. -- Loop through all menus and enable/disable their buttons appropriately
  1064. local count, tempCount;
  1065. local inInstance, instanceType = IsInInstance();
  1066. for level, dropdownFrame in pairs(OPEN_DROPDOWNMENUS) do
  1067. if ( dropdownFrame ) then
  1068. count = 0;
  1069. for index, value in ipairs(UnitPopupMenus[dropdownFrame.which]) do
  1070. if ( UnitPopupShown[level][index] == 1 ) then
  1071. count = count + 1;
  1072. local enable = 1;
  1073. if ( UnitPopupButtons[value].dist > 0 ) then
  1074. if ( not CheckInteractDistance(dropdownFrame.unit, UnitPopupButtons[value].dist) ) then
  1075. enable = 0;
  1076. end
  1077. end
  1078.  
  1079. if ( value == "TRADE" ) then
  1080. if ( UnitIsDeadOrGhost("player") or (not HasFullControl()) or UnitIsDeadOrGhost(dropdownFrame.unit) ) then
  1081. enable = 0;
  1082. end
  1083. elseif ( value == "LEAVE" ) then
  1084. if ( inParty == 0 ) then
  1085. enable = 0;
  1086. end
  1087. elseif ( value == "INVITE" ) then
  1088. if ( (inParty == 1 and (isLeader == 0 and isAssistant == 0)) or currentDropDown.server ) then
  1089. enable = 0;
  1090. end
  1091. elseif ( value == "UNINVITE" ) then
  1092. if ( inParty == 0 or (isLeader == 0) or HasLFGRestrictions() ) then
  1093. enable = 0;
  1094. end
  1095. elseif ( value == "BN_INVITE" or value == "BN_TARGET" ) then
  1096. if ( not currentDropDown.presenceID or not CanCooperateWithToon(currentDropDown.presenceID) ) then
  1097. enable = 0;
  1098. end
  1099. elseif ( value == "VOTE_TO_KICK" ) then
  1100. if ( inParty == 0 or not HasLFGRestrictions() ) then
  1101. enable = 0;
  1102. end
  1103. elseif ( value == "PROMOTE" or value == "PROMOTE_GUIDE" ) then
  1104. if ( inParty == 0 or isLeader == 0 or ( dropdownFrame.unit and not UnitIsConnected(dropdownFrame.unit) ) ) then
  1105. enable = 0;
  1106. end
  1107. elseif ( value == "WHISPER" ) then
  1108. if ( dropdownFrame.unit and not UnitIsConnected(dropdownFrame.unit) ) then
  1109. enable = 0;
  1110. end
  1111. elseif ( value == "MUTE" ) then
  1112. if ( dropdownFrame.unit and not UnitIsConnected(dropdownFrame.unit) ) then
  1113. enable = 0;
  1114. end
  1115. elseif ( value == "INSPECT" ) then
  1116. if ( UnitIsDeadOrGhost("player") ) then
  1117. enable = 0;
  1118. end
  1119. elseif ( value == "FOLLOW" ) then
  1120. if ( UnitIsDead("player") ) then
  1121. enable = 0;
  1122. end
  1123. elseif ( value == "DUEL" ) then
  1124. if ( UnitIsDeadOrGhost("player") or (not HasFullControl()) or UnitIsDeadOrGhost(dropdownFrame.unit) ) then
  1125. enable = 0;
  1126. end
  1127. elseif ( value == "LOOT_METHOD" ) then
  1128. if ( isLeader == 0 or HasLFGRestrictions() ) then
  1129. enable = 0;
  1130. end
  1131. elseif ( value == "LOOT_PROMOTE" ) then
  1132. local lootMethod;
  1133. local partyMaster, raidMaster;
  1134. lootMethod, partyMaster, raidMaster = GetLootMethod();
  1135. if ( (inParty == 0) or (isLeader == 0) or (lootMethod ~= "master") ) then
  1136. enable = 0;
  1137. else
  1138. local masterName = 0;
  1139. if ( partyMaster and (partyMaster == 0) ) then
  1140. masterName = "player";
  1141. elseif ( partyMaster ) then
  1142. masterName = "party"..partyMaster;
  1143. elseif ( raidMaster ) then
  1144. masterName = "raid"..raidMaster;
  1145. end
  1146. if ( dropdownFrame.unit and UnitIsUnit(dropdownFrame.unit, masterName) ) then
  1147. enable = 0;
  1148. end
  1149. end
  1150. elseif ( value == "DUNGEON_DIFFICULTY" and inInstance ) then
  1151. enable = 0;
  1152. elseif ( ( strsub(value, 1, 18) == "DUNGEON_DIFFICULTY" ) and ( strlen(value) > 18 ) ) then
  1153. if ( ( inParty == 1 and isLeader == 0 ) or inInstance or HasLFGRestrictions() ) then
  1154. enable = 0;
  1155. end
  1156. elseif ( value == "RAID_DIFFICULTY" and inInstance and not allowedRaidDifficultyChange ) then
  1157. enable = 0;
  1158. elseif ( ( strsub(value, 1, 15) == "RAID_DIFFICULTY" ) and ( strlen(value) > 15 ) ) then
  1159. if ( ( inParty == 1 and isLeader == 0 ) or inInstance ) then
  1160. enable = 0;
  1161. end
  1162. if ( allowedRaidDifficultyChange and allowedRaidDifficultyChange == value ) then
  1163. enable = 1;
  1164. end
  1165. elseif ( value == "CONVERT_TO_PARTY" ) then
  1166. if ( GetNumRaidMembers() > MEMBERS_PER_RAID_GROUP ) then
  1167. enable = 0;
  1168. end
  1169. elseif ( value == "RESET_INSTANCES" ) then
  1170. if ( ( inParty == 1 and isLeader == 0 ) or inInstance or HasLFGRestrictions() ) then
  1171. enable = 0;
  1172. end
  1173. elseif ( value == "RAF_SUMMON" ) then
  1174. if( not CanSummonFriend(dropdownFrame.unit) ) then
  1175. enable = 0;
  1176. end
  1177. elseif ( value == "RAF_GRANT_LEVEL" ) then
  1178. if( not CanGrantLevel(dropdownFrame.unit) ) then
  1179. enable = 0;
  1180. end
  1181. elseif ( value == "SET_ROLE_TANK" ) then
  1182. local canBeTank, canBeHealer, canBeDamager = UnitGetAvailableRoles(dropdownFrame.unit);
  1183. if ( not canBeTank ) then
  1184. enable = 0;
  1185. end
  1186. elseif ( value == "SET_ROLE_HEALER" ) then
  1187. local canBeTank, canBeHealer, canBeDamager = UnitGetAvailableRoles(dropdownFrame.unit);
  1188. if ( not canBeHealer ) then
  1189. enable = 0;
  1190. end
  1191. elseif ( value == "SET_ROLE_DAMAGER" ) then
  1192. local canBeTank, canBeHealer, canBeDamager = UnitGetAvailableRoles(dropdownFrame.unit);
  1193. if ( not canBeDamager ) then
  1194. enable = 0;
  1195. end
  1196. end
  1197.  
  1198. if ( level > 1 ) then
  1199. tempCount = count;
  1200. else
  1201. tempCount = count + 1;
  1202. end
  1203.  
  1204. if ( enable == 1 ) then
  1205. UIDropDownMenu_EnableButton(level, tempCount);
  1206. else
  1207. UIDropDownMenu_DisableButton(level, tempCount);
  1208. end
  1209. end
  1210. end
  1211. end
  1212. end
  1213. end
  1214.  
  1215. function UnitPopup_OnClick (self)
  1216. local dropdownFrame = UIDROPDOWNMENU_INIT_MENU;
  1217. local button = self.value;
  1218. local unit = dropdownFrame.unit;
  1219. local name = dropdownFrame.name;
  1220. local server = dropdownFrame.server;
  1221. local fullname = name;
  1222.  
  1223. if ( server and (not unit or not UnitIsSameServer("player", unit)) ) then
  1224. fullname = name.."-"..server;
  1225. end
  1226.  
  1227. local inParty = 0;
  1228. if ( (GetNumPartyMembers() > 0) or (GetNumRaidMembers() > 0) ) then
  1229. inParty = 1;
  1230. end
  1231.  
  1232. local isLeader = 0;
  1233. if ( IsPartyLeader() ) then
  1234. isLeader = 1;
  1235. end
  1236. local isAssistant = 0;
  1237. if ( IsRaidOfficer() ) then
  1238. isAssistant = 1;
  1239. end
  1240.  
  1241. if ( button == "TRADE" ) then
  1242. InitiateTrade(unit);
  1243. elseif ( button == "WHISPER" ) then
  1244. ChatFrame_SendTell(fullname, dropdownFrame.chatFrame);
  1245. elseif ( button == "CREATE_CONVERSATION_WITH" ) then
  1246. BNConversationInvite_NewConversation(dropdownFrame.presenceID)
  1247. elseif ( button == "INSPECT" ) then
  1248. InspectUnit(unit);
  1249. elseif ( button == "ACHIEVEMENTS" ) then
  1250. InspectAchievements(unit);
  1251. elseif ( button == "TARGET" ) then
  1252. TargetUnit(fullname, 1);
  1253. elseif ( button == "IGNORE" ) then
  1254. AddOrDelIgnore(fullname);
  1255. elseif ( button == "REPORT_SPAM" ) then
  1256. local dialog = StaticPopup_Show("CONFIRM_REPORT_SPAM_CHAT", name);
  1257. if ( dialog ) then
  1258. dialog.data = dropdownFrame.lineID;
  1259. end
  1260. elseif ( button == "POP_OUT_CHAT" ) then
  1261. FCF_OpenTemporaryWindow(dropdownFrame.chatType, dropdownFrame.chatTarget, dropdownFrame.chatFrame, true);
  1262. elseif ( button == "DUEL" ) then
  1263. StartDuel(unit, 1);
  1264. elseif ( button == "INVITE" ) then
  1265. InviteUnit(fullname);
  1266. elseif ( button == "UNINVITE" or button == "VOTE_TO_KICK" ) then
  1267. UninviteUnit(fullname);
  1268. elseif ( button == "REMOVE_FRIEND" ) then
  1269. RemoveFriend(name);
  1270. elseif ( button == "SET_NOTE" ) then
  1271. FriendsFrame.NotesID = name;
  1272. StaticPopup_Show("SET_FRIENDNOTE", name);
  1273. PlaySound("igCharacterInfoClose");
  1274. elseif ( button == "BN_REMOVE_FRIEND" ) then
  1275. local presenceID, givenName, surname = BNGetFriendInfoByID(dropdownFrame.presenceID);
  1276. if ( presenceID ) then
  1277. local dialog = StaticPopup_Show("CONFIRM_REMOVE_FRIEND", string.format(BATTLENET_NAME_FORMAT, givenName, surname));
  1278. if ( dialog ) then
  1279. dialog.data = presenceID;
  1280. end
  1281. end
  1282. elseif ( button == "BN_SET_NOTE" ) then
  1283. FriendsFrame.NotesID = dropdownFrame.presenceID;
  1284. StaticPopup_Show("SET_BNFRIENDNOTE", name);
  1285. PlaySound("igCharacterInfoClose");
  1286. elseif ( button == "BN_VIEW_FRIENDS" ) then
  1287. FriendsFriendsFrame_Show(dropdownFrame.presenceID);
  1288. elseif ( button == "BN_INVITE" ) then
  1289. local presenceID, givenName, surname, toonName = BNGetFriendInfoByID(dropdownFrame.presenceID);
  1290. if ( toonName ) then
  1291. InviteUnit(toonName);
  1292. end
  1293. elseif ( button == "BN_TARGET" ) then
  1294. local presenceID, givenName, surname, toonName = BNGetFriendInfoByID(dropdownFrame.presenceID);
  1295. if ( toonName ) then
  1296. TargetUnit(toonName, 1);
  1297. end
  1298. elseif ( button == "BLOCK_COMMUNICATION" ) then
  1299. BNSetToonBlocked(dropdownFrame.presenceID, true);
  1300. elseif ( button == "PROMOTE" or button == "PROMOTE_GUIDE" ) then
  1301. PromoteToLeader(unit, 1);
  1302. elseif ( button == "GUILD_PROMOTE" ) then
  1303. local dialog = StaticPopup_Show("CONFIRM_GUILD_PROMOTE", name);
  1304. dialog.data = name;
  1305. elseif ( button == "GUILD_LEAVE" ) then
  1306. StaticPopup_Show("CONFIRM_GUILD_LEAVE", GetGuildInfo("player"));
  1307. elseif ( button == "TEAM_PROMOTE" ) then
  1308. local dialog = StaticPopup_Show("CONFIRM_TEAM_PROMOTE", name, GetArenaTeam(PVP_GetSelectedArenaTeam()));
  1309. if ( dialog ) then
  1310. dialog.data = PVP_GetSelectedArenaTeam();
  1311. dialog.data2 = name;
  1312. end
  1313. elseif ( button == "TEAM_KICK" ) then
  1314. local dialog = StaticPopup_Show("CONFIRM_TEAM_KICK", name, GetArenaTeam(PVP_GetSelectedArenaTeam()) );
  1315. if ( dialog ) then
  1316. dialog.data = PVP_GetSelectedArenaTeam();
  1317. dialog.data2 = name;
  1318. end
  1319. elseif ( button == "TEAM_LEAVE" ) then
  1320. local dialog = StaticPopup_Show("CONFIRM_TEAM_LEAVE", GetArenaTeam(PVP_GetSelectedArenaTeam()) );
  1321. if ( dialog ) then
  1322. dialog.data = PVP_GetSelectedArenaTeam();
  1323. end
  1324. elseif ( button == "LEAVE" ) then
  1325. LeaveParty();
  1326. elseif ( button == "PET_DISMISS" ) then
  1327. PetDismiss();
  1328. elseif ( button == "PET_ABANDON" ) then
  1329. StaticPopup_Show("ABANDON_PET");
  1330. elseif ( button == "PET_PAPERDOLL" ) then
  1331. if (not PetPaperDollFrame:IsVisible()) then
  1332. ToggleCharacter("PetPaperDollFrame");
  1333. end
  1334. elseif ( button == "PET_RENAME" ) then
  1335. StaticPopup_Show("RENAME_PET");
  1336. elseif ( button == "FREE_FOR_ALL" ) then
  1337. SetLootMethod("freeforall");
  1338. UIDropDownMenu_SetButtonText(self:GetParent().parentLevel, self:GetParent().parentID, UnitPopupButtons[button].text);
  1339. UIDropDownMenu_Refresh(dropdownFrame, nil, 1);
  1340. elseif ( button == "ROUND_ROBIN" ) then
  1341. SetLootMethod("roundrobin");
  1342. UIDropDownMenu_SetButtonText(self:GetParent().parentLevel, self:GetParent().parentID, UnitPopupButtons[button].text);
  1343. UIDropDownMenu_Refresh(dropdownFrame, nil, 1);
  1344. elseif ( button == "MASTER_LOOTER" ) then
  1345. SetLootMethod("master", fullname);
  1346. UIDropDownMenu_SetButtonText(self:GetParent().parentLevel, self:GetParent().parentID, UnitPopupButtons[button].text);
  1347. UIDropDownMenu_Refresh(dropdownFrame, nil, 1);
  1348. elseif ( button == "GROUP_LOOT" ) then
  1349. SetLootMethod("group");
  1350. UIDropDownMenu_SetButtonText(self:GetParent().parentLevel, self:GetParent().parentID, UnitPopupButtons[button].text);
  1351. UIDropDownMenu_Refresh(dropdownFrame, nil, 1);
  1352. elseif ( button == "NEED_BEFORE_GREED" ) then
  1353. SetLootMethod("needbeforegreed");
  1354. UIDropDownMenu_SetButtonText(self:GetParent().parentLevel, self:GetParent().parentID, UnitPopupButtons[button].text);
  1355. UIDropDownMenu_Refresh(dropdownFrame, nil, 1);
  1356. elseif ( button == "OPT_OUT_LOOT_ENABLE" ) then
  1357. SetOptOutOfLoot(1);
  1358. CloseDropDownMenus()
  1359. elseif ( button == "OPT_OUT_LOOT_DISABLE" ) then
  1360. SetOptOutOfLoot(nil);
  1361. CloseDropDownMenus();
  1362. elseif ( strsub(button, 1, 18) == "DUNGEON_DIFFICULTY" and (strlen(button) > 18) ) then
  1363. local dungeonDifficulty = tonumber( strsub(button,19,19) );
  1364. SetDungeonDifficulty(dungeonDifficulty);
  1365. elseif ( strsub(button, 1, 15) == "RAID_DIFFICULTY" and (strlen(button) > 15) ) then
  1366. local raidDifficulty = tonumber( strsub(button,16,16) );
  1367. SetRaidDifficulty(raidDifficulty);
  1368. elseif ( button == "LOOT_PROMOTE" ) then
  1369. SetLootMethod("master", fullname, 1);
  1370. elseif ( button == "PVP_ENABLE" ) then
  1371. SetPVP(1);
  1372. elseif ( button == "PVP_DISABLE" ) then
  1373. SetPVP(nil);
  1374. elseif ( button == "CONVERT_TO_RAID" ) then
  1375. ConvertToRaid();
  1376. elseif ( button == "CONVERT_TO_PARTY" ) then
  1377. ConvertToParty();
  1378. elseif ( button == "RESET_INSTANCES" ) then
  1379. StaticPopup_Show("CONFIRM_RESET_INSTANCES");
  1380. elseif ( button == "FOLLOW" ) then
  1381. FollowUnit(fullname, 1);
  1382. elseif ( button == "MUTE" ) then
  1383. AddMute(fullname);
  1384. elseif ( button == "UNMUTE" ) then
  1385. DelMute(fullname);
  1386. elseif ( button == "RAID_LEADER" ) then
  1387. PromoteToLeader(fullname, 1)
  1388. elseif ( button == "RAID_PROMOTE" ) then
  1389. PromoteToAssistant(fullname, 1);
  1390. elseif ( button == "RAID_DEMOTE" ) then
  1391. if ( isLeader == 1 and UnitIsRaidOfficer(unit) ) then
  1392. DemoteAssistant(fullname, 1);
  1393. end
  1394. if ( GetPartyAssignment("MAINTANK", fullname, 1) ) then
  1395. ClearPartyAssignment("MAINTANK", fullname, 1);
  1396. elseif ( GetPartyAssignment("MAINASSIST", fullname, 1) ) then
  1397. ClearPartyAssignment("MAINASSIST", fullname, 1);
  1398. end
  1399. elseif ( button == "RAID_MAINTANK" ) then
  1400. SetPartyAssignment("MAINTANK", fullname, 1);
  1401. elseif ( button == "RAID_MAINASSIST" ) then
  1402. SetPartyAssignment("MAINASSIST", fullname, 1);
  1403. elseif ( button == "RAID_REMOVE" ) then
  1404. UninviteUnit(fullname);
  1405. elseif ( button == "PVP_REPORT_AFK" ) then
  1406. ReportPlayerIsPVPAFK(fullname);
  1407. elseif ( button == "RAF_SUMMON" ) then
  1408. SummonFriend(unit)
  1409. elseif ( button == "RAF_GRANT_LEVEL" ) then
  1410. GrantLevel(unit);
  1411. elseif ( button == "ITEM_QUALITY2_DESC" or button == "ITEM_QUALITY3_DESC" or button == "ITEM_QUALITY4_DESC" ) then
  1412. local id = self:GetID()+1;
  1413. SetLootThreshold(id);
  1414. UIDropDownMenu_SetButtonText(self:GetParent().parentLevel, self:GetParent().parentID, UnitPopupButtons[button].text);
  1415. elseif ( strsub(button, 1, 12) == "RAID_TARGET_" and button ~= "RAID_TARGET_ICON" ) then
  1416. local raidTargetIndex = strsub(button, 13);
  1417. if ( raidTargetIndex == "NONE" ) then
  1418. raidTargetIndex = 0;
  1419. end
  1420. SetRaidTargetIcon(unit, tonumber(raidTargetIndex));
  1421. elseif ( button == "CHAT_PROMOTE" ) then
  1422. ChannelModerator(dropdownFrame.channelName, fullname);
  1423. elseif ( button == "CHAT_DEMOTE" ) then
  1424. ChannelUnmoderator(dropdownFrame.channelName, fullname);
  1425. elseif ( button == "CHAT_OWNER" ) then
  1426. SetChannelOwner(dropdownFrame.channelName, fullname);
  1427. elseif ( button == "CHAT_SILENCE" or button == "PARTY_SILENCE" or button == "RAID_SILENCE" or button == "BATTLEGROUND_SILENCE" ) then
  1428. ChannelSilenceVoice(dropdownFrame.channelName, fullname);
  1429. elseif ( button == "CHAT_UNSILENCE" or button == "PARTY_UNSILENCE" or button == "RAID_UNSILENCE" or button == "BATTLEGROUND_UNSILENCE" ) then
  1430. ChannelUnSilenceVoice(dropdownFrame.channelName, fullname);
  1431. elseif ( button == "CHAT_KICK" ) then
  1432. ChannelKick(dropdownFrame.channelName, fullname);
  1433. elseif ( button == "CHAT_BAN" ) then
  1434. ChannelBan(dropdownFrame.channelName, fullname);
  1435. elseif ( button == "VEHICLE_LEAVE" ) then
  1436. VehicleExit();
  1437. elseif ( button == "SET_FOCUS" ) then
  1438. FocusUnit(unit);
  1439. elseif ( button == "CLEAR_FOCUS" ) then
  1440. ClearFocus(unit);
  1441. elseif ( button == "LOCK_FOCUS_FRAME" ) then
  1442. FocusFrame_SetLock(true);
  1443. elseif ( button == "UNLOCK_FOCUS_FRAME" ) then
  1444. FocusFrame_SetLock(false);
  1445. elseif ( strsub(button, 1, 10) == "BN_REPORT_" ) then
  1446. BNet_InitiateReport(dropdownFrame.presenceID, strsub(button, 11));
  1447. elseif ( strsub(button, 1, 9) == "SET_ROLE_" ) then
  1448. UnitSetRole(dropdownFrame.unit, strsub(button, 10));
  1449. end
  1450. PlaySound("UChatScrollButton");
  1451. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement