Advertisement
Kibzz

Untitled

Jun 12th, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. local legendaries =
  2. {
  3. [SPEC_ID] =
  4. {
  5. LEGENDARY_ID,
  6. }
  7. }
  8.  
  9. local LEGGO_CAP = 10
  10.  
  11. local function getLeggoCount(s)
  12.  
  13. --print('calling get leggo count')
  14. local count = 0
  15. for k,v in pairs(legendaries[s]) do
  16. if GetItemCount( v, true) > 0 or IsEquippedItem( v ) then
  17. count = count + 1
  18. end
  19. end
  20. return count
  21. end
  22.  
  23. local function getSpec(s)
  24.  
  25. --print('calling get spec')
  26. if getLeggoCount(s) >= LEGGO_CAP then
  27. local _s = GetSpecialization() + 1;
  28. if _s > 3 then _s = 1 end
  29. return getSpec(GetSpecializationInfo(_s))
  30. else
  31. return s
  32. end
  33. end
  34.  
  35. local function showMessage(item)
  36.  
  37. --print('calling show message')
  38. if not item then return end
  39. local col = "|cff02a100"
  40. local name = UnitName("player")
  41. local _,class = UnitClass("player")
  42. local classCol = RAID_CLASS_COLORS[class]
  43. print(col .. "You recieve loot: |r" .. item .. col .. ".|r")
  44.  
  45. col = "|cff40FB40"
  46. print(col.."[".."|c"..classCol.colorStr .. name.."|r"..col.."] has recieved |r"..item..col.."!|r")
  47. end
  48.  
  49. local function getLeggo()
  50. --print('calling get leggo')
  51. local s = getSpec(GetLootSpecialization() ~= 0 and GetLootSpecialization() or GetSpecializationInfo(GetSpecialization()))
  52. local leggo = seed or math.random(1, 10)
  53. if GetItemCount( legendaries[s][leggo], true) > 0 or IsEquippedItem( legendaries[s][leggo] ) then
  54. return getLeggo()
  55. else
  56. return legendaries[s][leggo]
  57. end
  58. end
  59.  
  60. local function pooper( f )
  61. --print('calling pooper')
  62. local leggo = getLeggo()
  63. local item, link, rare, _, _, _, _, _, _, texture = GetItemInfo( leggo )
  64. if not link then return end
  65. f.Icon:SetTexture( texture )
  66. f.ItemName:SetText( item )
  67. local color = ITEM_QUALITY_COLORS[ 5 ]
  68. f.ItemName:SetVertexColor( color.r, color.g, color.b )
  69. f.hyperlink = link
  70. f.Background2.animIn:Play()
  71. f.Background3.animIn:Play()
  72. PlaySound("UI_LegendaryLoot_Toast")
  73. showMessage(link)
  74. end
  75.  
  76. local function showalert()
  77. local f = LegendaryItemAlertSystem
  78.  
  79. local alertFrame, isNew = f.alertFramePool:Acquire()
  80.  
  81. if isNew then
  82. alertFrame.queue = f
  83. alertFrame:SetScript( "OnHide", function( frame ) frame.queue:OnFrameHide( frame ) end )
  84.  
  85. if f.localizationHook then
  86. f.localizationHook( alertFrame )
  87. end
  88. end
  89.  
  90. if pooper then
  91. local result = pooper(alertFrame)
  92. if result == false then
  93. f.alertFramePool:Release(alertFrame)
  94. return false
  95. end
  96. end
  97.  
  98. AlertFrame:AddAlertFrame( alertFrame )
  99. f:CheckQueuedCoalesceData()
  100.  
  101. return true
  102. end
  103.  
  104. showalert()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement