Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2018
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.70 KB | None | 0 0
  1. damageEvent = {
  2. ["SWING_DAMAGE"] = true,
  3. ["RANGE_DAMAGE"] = true,
  4. ["SPELL_DAMAGE"] = true,
  5. ["SPELL_PERIODIC_DAMAGE"] = true,
  6. }
  7.  
  8. checkKill = CreateFrame("Frame")
  9. checkKill:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
  10. checkKill:SetScript("OnEvent", function(self, event, timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...)
  11. local timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = CombatLogGetCurrentEventInfo()
  12. local spellID, spellName, spellSchool, amount, overkill
  13. local playerName = UnitName("player");
  14. local petName = UnitName("pet");
  15. local _, overkill
  16.  
  17. if(damageEvent[subevent] and sourceName == petName) then
  18. if subevent == "SWING_DAMAGE" then
  19. _, overkill = ...
  20. else
  21. _, _, _, _, overkill = ...
  22. end
  23. else
  24. overkill = 0;
  25. end
  26.  
  27. --IF event = a kill that happens within party(yours or anyone else in your raid/party) and the source is the player
  28. --because PARTY_KILL doesn't get triggered for pets we check the overkill instead of the subevent PARTY_KILL
  29. if ((subevent == "PARTY_KILL" and sourceName == playerName) or (overkill > 1 and sourceName == petName))
  30. --AND if the killed enemy is a player instead of an npc/monster etc
  31. and (destFlags == 66888 or KillingBlowAnnouncer:EnablePVP(info) == false)
  32. --THEN add the message KILLING BLOW! to the messageframe, and update the kbs_tracker
  33. then
  34.  
  35. if(KillingBlowAnnouncer:EnableMSGAnnounce(info) == true)then
  36. --|c
  37. local className, classId, raceName, raceId, gender, name, realm = GetPlayerInfoByGUID(destGUID)
  38. local classNamePlayer, classId, raceNamePlayer, raceId, genderPlayer, namePlayer, realmPlayer = GetPlayerInfoByGUID(UnitGUID("player"))
  39. --SetMapToCurrentZone()
  40. --local mapName = GetMapNameByID(GetCurrentMapAreaID())
  41. local gender = genderValues[gender]
  42. local genderPlayer = genderValues[genderPlayer]
  43. local message = KillingBlowAnnouncer:GetAnnounceMessage(info)
  44. local level = UnitLevel("player")
  45.  
  46. if (raceName ~= nil) then
  47. local raceName = raceName:lower();
  48. end
  49.  
  50. if (destFlags ~= 66888) then
  51. message = KillingBlowAnnouncer:GetAnnounceMessageNon(info)
  52. name = destName;
  53. end
  54.  
  55. if(KillingBlowAnnouncer:GetChatAnnounceChannel(info) == "private") then
  56. local playerName = "|cff" .. classColors[classNamePlayer] .. playerName .. "|r";
  57. local classNamePlayer = "|cff" .. classColors[classNamePlayer] .. classNamePlayer:lower() .. "|r";
  58.  
  59. if (destFlags == 66888) then
  60. name = "|cff" .. classColors[className] .. name .. "|r";
  61. className = "|cff" .. classColors[className] .. className:lower() .. "|r";
  62. end
  63.  
  64. print(interp(message,{player = playerName,enemy = name,class = className,zone = mapName, gender = gender, race = raceName, realm = realm, playerlevel = level, playerclass = classNamePlayer, playerrace = raceNamePlayer, playergender = genderPlayer, playerrealm = realmPlayer}))
  65. else
  66. if (className ~= nil) then
  67. local className = className:lower();
  68. end
  69. local classNamePlayer = classNamePlayer:lower();
  70.  
  71. SendChatMessage((interp(message,{player = playerName,enemy = name,class = className,zone = mapName, gender = gender, race = raceName, realm = realm, playerlevel = level, playerclass = classNamePlayer, playerrace = raceNamePlayer, playergender = genderPlayer, playerrealm = realmPlayer})),KillingBlowAnnouncer:GetChatAnnounceChannel(info))
  72. end
  73.  
  74. end
  75.  
  76. --IF enableKB = true
  77. if (KillingBlowAnnouncer:EnableKB(info) == true)
  78. --THEN addMessage
  79. then
  80. if(KillingBlowAnnouncer:GetModus(info) == 1) then
  81. message:AddMessage(KillingBlowAnnouncer:GetKillingMessage(info),KillingBlowAnnouncer:GetRed(info),KillingBlowAnnouncer:GetGreen(info),KillingBlowAnnouncer:GetBlue(info))
  82. elseif(KillingBlowAnnouncer:GetModus(info) == 2) then
  83. imageAnimationIn:Stop();
  84. imageAnimationOut:Stop();
  85. fade();
  86. end
  87. end
  88.  
  89. if (KillingBlowAnnouncer:EnableEmotes(info) == true)
  90. --THEN do random emote
  91. then
  92. emote = KillingBlowAnnouncer:GetRandomEmote();
  93. if emote ~= nil then
  94. DoEmote(KillingBlowAnnouncer:GetRandomEmote());
  95. end
  96. end
  97.  
  98.  
  99. --IF enableKBSound = true
  100. if (KillingBlowAnnouncer:EnableKBSound(info) == true)
  101. --THEN playsoundfile
  102. then
  103. if(KillingBlowAnnouncer:GetSoundModus(info) == 1) then
  104. local index = KillingBlowAnnouncer:GetSoundsOrderedOrder(info)
  105. local sound = KillingBlowAnnouncer:GetSoundOrderedListItem(info, index)
  106. if sound ~= nil then
  107. PlaySoundFile(Media:Fetch("sound", sound, KillingBlowAnnouncer:GetSoundLevel(info)));
  108. KillingBlowAnnouncer:IncrementSoundsOrderedOrder();
  109.  
  110. if (KillingBlowAnnouncer:EnableSoundOrderedRestartTime()) then
  111. resetSoundsOnTimer(KillingBlowAnnouncer:GetSoundsOrderedOrder(info));
  112. end
  113. end
  114. elseif(KillingBlowAnnouncer:GetSoundModus(info) == 2) then
  115. local sound = KillingBlowAnnouncer:GetRandomSound();
  116. if sound ~= nil then
  117. PlaySoundFile(Media:Fetch("sound", sound, KillingBlowAnnouncer:GetSoundLevel(info)));
  118. end
  119. end
  120. end
  121.  
  122. --IF enableKBT = true
  123. if (KillingBlowAnnouncer:EnableKBT(info) == true)
  124. --THEN update kbtracker
  125. then
  126. updateKbtracker();
  127. end
  128.  
  129. --IF chat message is enabled(variable enableMSG needs to be true for this)
  130. if (KillingBlowAnnouncer:EnableMSG(info) == true)
  131. --THEN get message from variable message and send it to the chat chat
  132. then
  133. if(KillingBlowAnnouncer:GetChatChannel(info) == "private") then
  134. print(KillingBlowAnnouncer:GetMessage(info))
  135. else
  136. SendChatMessage(KillingBlowAnnouncer:GetMessage(info),KillingBlowAnnouncer:GetChatChannel(info));
  137. end
  138. end
  139. end
  140. end);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement