Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- damageEvent = {
- ["SWING_DAMAGE"] = true,
- ["RANGE_DAMAGE"] = true,
- ["SPELL_DAMAGE"] = true,
- ["SPELL_PERIODIC_DAMAGE"] = true,
- }
- checkKill = CreateFrame("Frame")
- checkKill:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
- checkKill:SetScript("OnEvent", function(self, event, timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...)
- local timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = CombatLogGetCurrentEventInfo()
- local spellID, spellName, spellSchool, amount, overkill
- local playerName = UnitName("player");
- local petName = UnitName("pet");
- local _, overkill
- if(damageEvent[subevent] and sourceName == petName) then
- if subevent == "SWING_DAMAGE" then
- _, overkill = ...
- else
- _, _, _, _, overkill = ...
- end
- else
- overkill = 0;
- end
- --IF event = a kill that happens within party(yours or anyone else in your raid/party) and the source is the player
- --because PARTY_KILL doesn't get triggered for pets we check the overkill instead of the subevent PARTY_KILL
- if ((subevent == "PARTY_KILL" and sourceName == playerName) or (overkill > 1 and sourceName == petName))
- --AND if the killed enemy is a player instead of an npc/monster etc
- and (destFlags == 66888 or KillingBlowAnnouncer:EnablePVP(info) == false)
- --THEN add the message KILLING BLOW! to the messageframe, and update the kbs_tracker
- then
- if(KillingBlowAnnouncer:EnableMSGAnnounce(info) == true)then
- --|c
- local className, classId, raceName, raceId, gender, name, realm = GetPlayerInfoByGUID(destGUID)
- local classNamePlayer, classId, raceNamePlayer, raceId, genderPlayer, namePlayer, realmPlayer = GetPlayerInfoByGUID(UnitGUID("player"))
- --SetMapToCurrentZone()
- --local mapName = GetMapNameByID(GetCurrentMapAreaID())
- local gender = genderValues[gender]
- local genderPlayer = genderValues[genderPlayer]
- local message = KillingBlowAnnouncer:GetAnnounceMessage(info)
- local level = UnitLevel("player")
- if (raceName ~= nil) then
- local raceName = raceName:lower();
- end
- if (destFlags ~= 66888) then
- message = KillingBlowAnnouncer:GetAnnounceMessageNon(info)
- name = destName;
- end
- if(KillingBlowAnnouncer:GetChatAnnounceChannel(info) == "private") then
- local playerName = "|cff" .. classColors[classNamePlayer] .. playerName .. "|r";
- local classNamePlayer = "|cff" .. classColors[classNamePlayer] .. classNamePlayer:lower() .. "|r";
- if (destFlags == 66888) then
- name = "|cff" .. classColors[className] .. name .. "|r";
- className = "|cff" .. classColors[className] .. className:lower() .. "|r";
- end
- 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}))
- else
- if (className ~= nil) then
- local className = className:lower();
- end
- local classNamePlayer = classNamePlayer:lower();
- 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))
- end
- end
- --IF enableKB = true
- if (KillingBlowAnnouncer:EnableKB(info) == true)
- --THEN addMessage
- then
- if(KillingBlowAnnouncer:GetModus(info) == 1) then
- message:AddMessage(KillingBlowAnnouncer:GetKillingMessage(info),KillingBlowAnnouncer:GetRed(info),KillingBlowAnnouncer:GetGreen(info),KillingBlowAnnouncer:GetBlue(info))
- elseif(KillingBlowAnnouncer:GetModus(info) == 2) then
- imageAnimationIn:Stop();
- imageAnimationOut:Stop();
- fade();
- end
- end
- if (KillingBlowAnnouncer:EnableEmotes(info) == true)
- --THEN do random emote
- then
- emote = KillingBlowAnnouncer:GetRandomEmote();
- if emote ~= nil then
- DoEmote(KillingBlowAnnouncer:GetRandomEmote());
- end
- end
- --IF enableKBSound = true
- if (KillingBlowAnnouncer:EnableKBSound(info) == true)
- --THEN playsoundfile
- then
- if(KillingBlowAnnouncer:GetSoundModus(info) == 1) then
- local index = KillingBlowAnnouncer:GetSoundsOrderedOrder(info)
- local sound = KillingBlowAnnouncer:GetSoundOrderedListItem(info, index)
- if sound ~= nil then
- PlaySoundFile(Media:Fetch("sound", sound, KillingBlowAnnouncer:GetSoundLevel(info)));
- KillingBlowAnnouncer:IncrementSoundsOrderedOrder();
- if (KillingBlowAnnouncer:EnableSoundOrderedRestartTime()) then
- resetSoundsOnTimer(KillingBlowAnnouncer:GetSoundsOrderedOrder(info));
- end
- end
- elseif(KillingBlowAnnouncer:GetSoundModus(info) == 2) then
- local sound = KillingBlowAnnouncer:GetRandomSound();
- if sound ~= nil then
- PlaySoundFile(Media:Fetch("sound", sound, KillingBlowAnnouncer:GetSoundLevel(info)));
- end
- end
- end
- --IF enableKBT = true
- if (KillingBlowAnnouncer:EnableKBT(info) == true)
- --THEN update kbtracker
- then
- updateKbtracker();
- end
- --IF chat message is enabled(variable enableMSG needs to be true for this)
- if (KillingBlowAnnouncer:EnableMSG(info) == true)
- --THEN get message from variable message and send it to the chat chat
- then
- if(KillingBlowAnnouncer:GetChatChannel(info) == "private") then
- print(KillingBlowAnnouncer:GetMessage(info))
- else
- SendChatMessage(KillingBlowAnnouncer:GetMessage(info),KillingBlowAnnouncer:GetChatChannel(info));
- end
- end
- end
- end);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement