Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. -- Captures the loot that is above the desired threshold and opens the loot frame
  2. if event == "LOOT_OPENED" then
  3. if IsRaidLeader() and RaidLootDB.autoAnnouceLoot == true then
  4. lootOnMob = {}
  5. raidLoot_AnnounceLoot()
  6. end
  7. end
  8.  
  9. -- Automattically announces the loot on a mob to the raid
  10. function raidLoot_AnnounceLoot()
  11. local lootLinks
  12. for index = 1, GetNumLootItems() do
  13. if (LootSlotIsItem(index)) then
  14. local itemLink = GetLootSlotLink(index);
  15. local _, _, _, rarity, _ = GetLootSlotInfo(index)
  16.  
  17. if rarity >= RaidLootDB.autoSetLootThresholdName then
  18. if lootLinks == nil then
  19. lootLinks = itemLink
  20. else
  21. lootLinks = lootLinks .. itemLink
  22. end
  23. lootOnMob[index] = itemLink
  24. end
  25. end
  26. end
  27. if lootLinks ~= nil then
  28. if tonumber(RaidLootDB.autoAnnounceLootName) == 1 then
  29. SendChatMessage(lootLinks, "GUILD")
  30. elseif tonumber(RaidLootDB.autoAnnounceLootName) == 2 then
  31. SendChatMessage(lootLinks, "PARTY")
  32. elseif tonumber(RaidLootDB.autoAnnounceLootName) == 3 then
  33. SendChatMessage(lootLinks, "RAID")
  34. elseif tonumber(RaidLootDB.autoAnnounceLootName) == 4 then
  35. SendChatMessage(lootLinks, "SAY")
  36. end
  37. raidLoot_ShowLF()
  38. end
  39. end
  40.  
  41.  
  42. -- Shows the Raid Loot frame
  43. function raidLoot_ShowLF()
  44. RaidLootDB.isHiddenLF = false
  45. raidLoot_ShowRolls()
  46. raidLoot_LootDrop()
  47. raidLoot_LootFrame:Show()
  48. raidLoot_LootFrame_headerText:SetText(rLV)
  49. end
  50.  
  51.  
  52. -- Creates the dropdown menu that contains the loot found on the mob
  53. function raidLoot_LootDrop()
  54. if not LootDrop then
  55. CreateFrame("Button", "LootDrop", raidLoot_LootFrame, "UIDropDownMenuTemplate")
  56. end
  57.  
  58.  
  59. LootDrop:ClearAllPoints()
  60. LootDrop:SetPoint("BOTTOMLEFT", raidLoot, "TOPLEFT", -20, 20)
  61. LootDrop:Show()
  62.  
  63. local function OnClick(self)
  64. UIDropDownMenu_SetSelectedID(LootDrop, self:GetID())
  65. RaidLootDB.LootDropSelected = UIDropDownMenu_GetSelectedID(LootDrop)
  66. end
  67.  
  68. local function initialize(self, level)
  69. local info = UIDropDownMenu_CreateInfo()
  70. if lootOnMob[1] == nil then
  71. info = UIDropDownMenu_CreateInfo()
  72. info.text = "Loot"
  73. info.value = "OptionVariable"
  74. info.func = OnClick
  75. UIDropDownMenu_AddButton(info, level)
  76. else
  77. for k,v in pairs(lootOnMob) do
  78. print("Creating loot drop down")
  79. local _, itemLink, _, _, _, _, _, _, _, _, _ = GetItemInfo(v)
  80. info = UIDropDownMenu_CreateInfo()
  81. info.text = v
  82. print(v)
  83. info.value = "OptionVariable"
  84. info.func = OnClick
  85. UIDropDownMenu_AddButton(info, level)
  86. end
  87. end
  88. end
  89.  
  90. UIDropDownMenu_Initialize(LootDrop, initialize)
  91. UIDropDownMenu_SetWidth(LootDrop, 100);
  92. UIDropDownMenu_SetButtonWidth(LootDrop, 124)
  93.  
  94. if lootOnMob[1] == nil then
  95. UIDropDownMenu_SetSelectedID(LootDrop, 1)
  96. else
  97. UIDropDownMenu_SetSelectedID(LootDrop, RaidLootDB.LootDropSelected)
  98. end
  99.  
  100. UIDropDownMenu_JustifyText(LootDrop, "LEFT")
  101.  
  102. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement