SHARE
TWEET

Ring damage explosion code

krazyito65 Aug 1st, 2015 (edited) 42 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Custom Trigger: Damage Text
  2. function(e, ...)
  3.    
  4.     --[[
  5. -- CHEAT SHEET for select (X, ...)
  6.  
  7.     1st Param    2nd Param    3rd Param    4th Param    5th Param    6th Param    7th Param    8th Param    9th Param    10th Param    11th Param
  8.     timestamp    event    hideCaster    sourceGUID    sourceName    sourceFlags    sourceRaidFlags    destGUID    destName    destFlags    destRaidFlags
  9.  
  10.     Prefix                    1st Parameter (12th)    2nd Parameter (13th)    3rd Parameter (14th)
  11.     SWING
  12.     RANGE                   spellId                          spellName                      spellSchool
  13.     SPELL                    spellId                          spellName                      spellSchool
  14.     SPELL_PERIODIC     spellId                         spellName                      spellSchool
  15.     SPELL_BUILDING     spellId                         spellName                       spellSchool
  16.     ENVIRONMENTAL    environmentalType
  17.  
  18.     Suffix       1st Param (15th)    2nd Param (16th)    3rd Param (17th)    4th Param (18th)    5th Param (19th)    6th Param (20st)    7th Param (21nd)    8th Param (22rd)    9th Param (23th)    10th Param (24th)    11th Param (25th)
  19.     _DAMAGE    amount                      overkill                    school                     resisted                 blocked                    absorbed                      critical                 glancing                      crushing               isOffHand                   multistrike
  20.  
  21. --------------------------------------------------
  22.        
  23.  
  24. for i=1, GetNumGroupMembers() do
  25.             local raider = "raid"..i
  26.             if UnitName(raider) == name then
  27.                 local x, y = UnitPosition(raider)                
  28.                 local infoTable = {NAME = name, TIME = GetTime()+30, X = x, Y = y}
  29.                 table.insert(aura_env.playerInfo, infoTable)
  30.                 break    
  31.             end            
  32.         end  
  33.  
  34.  
  35.  
  36.     for k,v in pairs(aura_env.playerInfo) do
  37.  
  38.  
  39.  
  40. ------ PET DAMAGE EVENTS
  41. COMBAT_LOG_EVENT_UNFILTERED 1438429786.334 SPELL_DAMAGE false Creature-0-3779-1153-26215-94852-00003CB250 Fey Moonwing 8465 0 Creature-0-3779-1153-26215-87761-0000BC8478 Dungeoneer's Training Dummy 68136 0 188046 Fey Missile 72 3627 -1 72 nil nil nil false false false false false
  42.  
  43. COMBAT_LOG_EVENT_UNFILTERED 1438435929.592 SWING_DAMAGE false Pet-0-3023-1153-23296-93349-0102430CD1 Abbie 4370 0 Creature-0-3020-1153-8717-87761-00003CBDFC Dungeoneer's Training Dummy 68136 128 762 -1 1 nil nil nil false false false false
  44.  
  45. SPELL_SUMMON,Player-3723-08161502,"Ogrund-Barthilas",0x511,0x0,Creature-0-3748-1153-8817-92993-0001BCDD2C,"Mirror Image",0x2111,0x0,184274,"Burning Mirror",0x40
  46.  
  47. COMBAT_LOG_EVENT_UNFILTERED 1438443700.513 SPELL_SUMMON false Player-3684-08217F54 Krazyito 1297 0 Creature-0-3020-1153-8717-94852-00003CE8B3 Fey Moonwing 2600 0 188083 Fey Moonwing 8
  48.  
  49.  
  50.  local myPet = sourceFlags and bit.band(sourceFlags, COMBATLOG_OBJECT_AFFILIATION_MASK) == 1 --check if its MY pet or creature (not others)
  51.  
  52. ]]
  53.    
  54.     local intRing = "Nithramus" -- placeholder text for checking if the event happened
  55.     local strRing = "Thorasus"
  56.     local agiRing = "Maalus"
  57.    
  58.     local subevent = select(2, ...) -- lazy variables so i dont have to use underscores (thiking about it now way after i did it, this is pretty smart cause fuck trying to count to make sure I got the right one)
  59.     local spellName = select(13, ...)
  60.     local sourceGUID = select(4, ...)
  61.     local destGUID = select(8, ...)
  62.     local sourceName = select(5, ...)
  63.     local name = ""
  64.     local broke = false
  65.     local myPet = false
  66.    
  67.     local isCreature = string.match(sourceGUID, "Creature") == "Creature"
  68.    
  69.     local buff = UnitBuff("player", "Nithramus") or UnitBuff("player", "Thorasus") or UnitBuff("player", "Maalus") -- this is a fail safe to try to trigger the aura if the player has the buff
  70.    
  71.     local function getRingBuff(unitID)
  72.        
  73.         local one = UnitBuff(unitID, "Nithramus") -- overrides original variable with nil if we do not have the buff
  74.         local two= UnitBuff(unitID, "Thorasus")
  75.         local three = UnitBuff(unitID, "Maalus")
  76.        
  77.         return one, two, three
  78.        
  79.     end
  80.    
  81.     if ((subevent == "SPELL_AURA_APPLIED" and (spellName == intRing or spellName == strRing or spellName == agiRing)) or buff ~= nil )and not aura_env.triggered then -- if the buff is applies to SOMEONE then show the number, make sure to only trigger once as to not reset whole thing
  82.         return true
  83.        
  84.         --[[
  85.             If the subevent is a 'damaging player event' (SPELL_DAMAGE, SPELL_PERIODIC_DAMAGE, SWING_DAMAGE, SPELL_BUILDING_DAMAGE (player damage to building? idk), or RANGE_DAMAGE)
  86.         ]]
  87.        
  88.     elseif subevent == "SPELL_SUMMON" then
  89.        
  90.         if string.match(sourceGUID, "Creature") == "Creature" then
  91.             name = string.gsub(sourceName, "%-[^|]+", "") -- remove realm names, of the source unit, if any. 5 = SourceName
  92.             local infoTable = {GUID = destGUID, OWNER = name}
  93.             table.insert(aura_env.petInfo, infoTable)
  94.         end
  95.        
  96.        
  97.     elseif subevent == "SPELL_DAMAGE" or subevent == "SPELL_PERIODIC_DAMAGE" or subevent == "SWING_DAMAGE" or subevent == "SPELL_BUILDING_DAMAGE" or subevent == "RANGE_DAMAGE" then -- if damage events happen
  98.        
  99.         name = string.gsub(sourceName, "%-[^|]+", "") -- remove realm names, of the source unit, if any. 5 = SourceName
  100.         local isPet
  101.         if string.match(sourceGUID, "Player") ~= "Player"  then isPet = true else isPet = false end -- 4 is sourceGUID, check if this is a pet
  102.        
  103.         if isPet then
  104.             intRing, strRing, agiRing = nil, nil, nil -- pets keep adding damage and ignore all the checks...
  105.             myPet = sourceFlags and bit.band(sourceFlags, COMBATLOG_OBJECT_AFFILIATION_MASK) == 1 --check if its MY pet or creature (not others)
  106.         end
  107.        
  108.        
  109.         ---------------------Giant stupid check becasue fuck partys....
  110.         --[[
  111.               Basic idea here is, check if we are solo, in a party or in a raid.
  112.               If one of those are true, find the UnitID of the sourceName (either player, partyN, or raidN, and their pets)
  113.               If we find a macthing UnitID then make sure that UnitID has the Ring buff (if its a pet, check if the owner has the buff)
  114.               If they have the buff, we save the name of the ring just to have a 'true' check (if no buff then its nil)
  115.           ]]
  116.        
  117.         if GetNumGroupMembers() == 0 then -- not in a party or raid group, look for the players stuff
  118.            
  119.             if UnitName("player") == name or sourceGUID == UnitGUID("playerpet") or myPet then -- if the event is a player or a creature or the players pet
  120.                 intRing, strRing, agiRing = getRingBuff("player")
  121.             end
  122.            
  123.         elseif GetNumGroupMembers() <= 5 then -- need to check if in a party
  124.            
  125.             if UnitInRaid("player") == nil then  -- if nil, we are in party, so fuck you. This makes it more complicated (have to check 'party1-4' and 'player')
  126.                
  127.                 if UnitName("player") == name or sourceGUID == UnitGUID("playerpet") or myPet then -- the player or his pet casted the spell
  128.                     intRing, strRing, agiRing = getRingBuff("player")
  129.                 else
  130.                     for i=1, GetNumGroupMembers() do
  131.                         local raider = "party"..i -- its gonna check for party5, but its nil so fuck it, it may break before then anyway. (there is only party1-4)
  132.                         if UnitName(raider) == name or (sourceGUID == UnitGUID(raider.."pet")) then -- UnitName returns only the name in the first parameter (realm in the second), or the units pet
  133.                             intRing, strRing, agiRing = getRingBuff(raider)
  134.                             break
  135.                         elseif isCreature then -- if it is a creature
  136.                             for k,v in pairs(aura_env.petInfo) do  -- go through our list ofcreatures
  137.                                 if v.GUID == sourceGUID and v.OWNER == UnitName(raider) then -- if the owner is the player, find his buff
  138.                                     intRing, strRing, agiRing = getRingBuff(raider)
  139.                                     broke = true
  140.                                     break
  141.                                 end
  142.                             end
  143.                         end-- end current raider
  144.                         if broke then break end -- check if we broke in the inner loop so we dont continue.
  145.                     end  -- end for loop
  146.                 end
  147.                
  148.             else -- we are in a raid, yay so easy
  149.                 for i=1, GetNumGroupMembers() do
  150.                     local raider = "raid"..i
  151.                     if UnitName(raider) == name or (sourceGUID == UnitGUID(raider.."pet")) then -- UnitName returns only the name in the first parameter (realm in the second), or the units pet
  152.                         intRing, strRing, agiRing = getRingBuff(raider)
  153.                         break
  154.                     elseif isCreature then -- if it is a creature
  155.                         for k,v in pairs(aura_env.petInfo) do  -- go through our list ofcreatures
  156.                             if v.GUID == sourceGUID and v.OWNER == UnitName(raider) then -- if the owner is the player, find his buff
  157.                                 intRing, strRing, agiRing = getRingBuff(raider)
  158.                                 broke = true
  159.                                 break
  160.                             end
  161.                         end
  162.                     end-- end current raider
  163.                     if broke then break end -- check if we broke in the inner loop so we dont continue.
  164.                 end  -- end for loop
  165.             end -- end raid check
  166.         end-- end party / raid check
  167.        
  168.         ---------------------Giant stupid check becasue fuck partys....
  169.        
  170.        
  171.         --[[
  172.             If we have a ring buff, then Check if the damage was a swing or not
  173.             Regardless of what it was, add the damage amount to the total
  174.         ]]
  175.        
  176.         if intRing ~= nil or strRing ~= nil or agiRing ~= nil then -- if we have the buff
  177.             if subevent == "SWING_DAMAGE" then -- swing has different return postions
  178.                 aura_env.amount = aura_env.amount + select(12, ...)  -- 12 is SWING_DAMAGE amount
  179.             else -- its any other event we were checking for
  180.                 aura_env.amount = aura_env.amount + select(15, ...) -- 15 is SPELL_DAMAGE amount
  181.             end -- end swing check
  182.         end --end buff check
  183.     end --end event checking
  184. end -- end function
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top