Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.04 KB | None | 0 0
  1. --blade flurry stuff--------------------------------------------------------------------
  2. local cleaner, updater, bladeflurrytargets = 0, 0, {}
  3. local bftcf = CreateFrame('Button', 'BladeFlurryTargetCountFrame', UIParent)
  4.     bftcf:SetSize(50,50)
  5.     bftcf:SetPoint('CENTER', UIParent, 'CENTER')
  6.     bftcf:Hide()
  7.     bftcf:RegisterEvent('PLAYER_ENTERING_WORLD')
  8.     bftcf:RegisterUnitEvent('UNIT_AURA', 'player')
  9. local bftcftext = bftcf:CreateFontString(nil, 'OVERLAY')
  10.     bftcftext:SetFont(FONTSTRINGHERE, 11, 'OUTLINE')
  11.     bftcftext:SetAllPoints()
  12.    
  13.     bftcf:SetScript('OnEvent', function(self, elapsed, unit)
  14.         if (event == 'PLAYER_ENTERING_WORLD' and InCombatLockdown()) or (event == 'UNIT_AURA' and InCombatLockdown()) then
  15.             if UnitBuff('player', 'Blade Flurry') then
  16.                 bftcf:Show()
  17.                 bftcf:SetScript('OnUpdate', bftcupdater)
  18.             else
  19.                 bftcf:Hide()
  20.                 bftcf:SetScript('OnUpdate', nil)
  21.             end
  22.         end
  23.     end)
  24.    
  25. local bftcupdater = function('OnUpdate', self, elapsed, updater, cleaner, bladeflurrytargets)
  26.     updater = updater + elapsed
  27.     cleaner = cleaner + elapsed
  28.    
  29.     while updater >= 0.25 do --update the text value every 1/4 second to give ~real time analysis
  30.         bftcftext:SetText(#bladeflurrytargets)
  31.         updater = updater - 0.25
  32.     end
  33.    
  34.     while cleaner >= 2.6 do  --clear the table every main hand attack base line speed interval(way faster than this with slice and dice, but just to make sure) to be sure every target that's going to be hit has been hit
  35.         for k, v in next, bladeflurrytargets, nil do
  36.             if GetTime() > v then --it's been more than 2.6 seconds since the target has last been hit, thus we assume the target is not currently being hit by bladeflurry, so we nil out its key and value so it's removed from the #bladeflurrytargets value
  37.                 k, v = nil, nil
  38.             end
  39.         end
  40.         cleaner = cleaner - 2.6
  41.     end
  42. end
  43. --outgoingdmg stuff--------------------------------------------------------------------
  44. local outgoing = CreateFrame('MessageFrame', 'OutgoingDmgFrame', UIParent)
  45.     outgoing:SetSize(100,100)
  46.     outgoing:SetFont(FONT, 11, 'OUTLINE')
  47.     outgoing:SetJustifyH('LEFT')
  48.     outgoing:SetJustifyV('BOTTOM')
  49.     outgoing:SetPoint('BOTTOMLEFT', 'TARGETTARGETFRAME', 'TOPLEFT', 0, 30)
  50.     outgoing:SetFading(true)
  51.     outgoing:SetFadeDuration(1)
  52.     outgoing:SetInsertMode('BOTTOM')
  53.     outgoing:SetTimeVisible(5)
  54.     outgoing:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED')
  55.    
  56.     outgoing:SetScript('OnEvent', function(self, event, ...)
  57.         local _, a2, _, _, _, a6, _, _, _, _, _, _, a13, _, _, _, a17, a18, a19, a20, _ = ...
  58.         local icon, texture, text, modifier, r, g, b
  59.        
  60.         if a2 == UnitGUID('player') or a2 == UnitGUID('pet') or a2 == UnitGUID('vehicle') then --support pets and vehicles
  61.             if event == 'SWING_DAMAGE' then
  62.                 texture = GetInventoryItemTexture('player', 16) --main hand weapon icon
  63.                 texture = texture..':28:28:0:0:30:30:2:28:2:28|t'
  64.                
  65.                 if a20 then --glancing
  66.                     modifier = '~'
  67.                 elseif a19 then --crit
  68.                     modifier = '+'
  69.                 else --blocked, absorbed, overkill, or normal white attack
  70.                     modifier = ''
  71.                 end
  72.                
  73.                 if a17 or a18 then --absorbed or blocked
  74.                     text = a13 - (a17 or a18)..' ('..a17 or a18..')'
  75.                 else
  76.                     text = a13
  77.                 end
  78.                
  79.                 outgoing:AddMessage(texture..' '..modifier..text, 1, 1, 1)
  80.             elseif event == 'SWING_MISSED' and a13 == 'MISS' then
  81.                 texture = GetInventoryItemTexture('player', 16) --main hand weapon icon
  82.                 texture = texture..':28:28:0:0:30:30:2:28:2:28|t'
  83.                
  84.                 outgoing:AddMessage(texture..' '..a13, 0.53, 0.53, 0.53)
  85.             elseif event == 'SPELL_DAMAGE' then
  86.                 texture = select(3, GetSpellInfo(a10))
  87.                 texture = texture..':28:28:0:0:30:30:2:28:2:28|t'
  88.                
  89.                 if a19 then --crit
  90.                     modifier = '+'
  91.                 else
  92.                     modifier = ''
  93.                 end
  94.                
  95.                 if a18 then --resist
  96.                     text = a13 - a18..' ('..a18..')'
  97.                 else
  98.                     text = a13
  99.                 end
  100.                
  101.                 if a10 == 13877 then --blade flurry
  102.                     bladeflurrytargets[a6] = a1 + 2.6
  103.                 end
  104.                
  105.                 r, g, b = COMBAT_LOG_DEFAULT_COLORS.schoolColoring[a12]
  106.                 r, g, b = r*255, g*255, b*255
  107.                 outgoing:AddMessage(texture..' '..modifier..text, r, g, b)
  108.             elseif event == 'SPELL_MISSED' and a13 == 'MISS' then
  109.                 texture = select(3, GetSpellInfo(a10))
  110.                 texture = texture..':28:28:0:0:30:30:2:28:2:28|t'
  111.                
  112.                 outgoing:AddMessage(texture..' '..a13, 0.53, 0.53, 0.53)
  113.             elseif event == 'SPELL_PERIODIC_DAMAGE' then
  114.                 texture = select(3, GetSpellInfo(a10))
  115.                 texture = texture..':28:28:0:0:30:30:2:28:2:28|t'
  116.                
  117.                 if a19 then --crit
  118.                     modifier = '+'
  119.                 else
  120.                     modifier = ''
  121.                 end
  122.                
  123.                 if a18 then --resist
  124.                     text = a13 - a18..' ('..a18..')'
  125.                 else
  126.                     text = a13
  127.                 end
  128.            
  129.                 r, g, b = COMBAT_LOG_DEFAULT_COLORS.schoolColoring[a12] --color text by spellschool
  130.                 r, g, b = r*255, g*255, b*255
  131.                 outgoing:AddMessage(texture..' '..modifier..text, r, g, b)
  132.             elseif event == 'SPELL_PERIODIC_MISSED' and a13 == 'MISS' then
  133.                 texture = select(3, GetSpellInfo(a10))
  134.                 texture = texture..':28:28:0:0:30:30:2:28:2:28|t'
  135.                
  136.                 outgoing:AddMessage(texture..' '..a13, 0.53, 0.53, 0.53)
  137.             end
  138.         end
  139.     end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement