-- Amount of time to delay between selected player list updates and how long
-- to hold a recently selected player in cache.
local RECENTLY_SELECTED_PLAYERS_UPDATE_INTERVAL = 1;
local RECENTLY_SELECTED_PLAYERS_HOLD_TIME = 45;
local killingstreak = 0;
local dgks_playername = UnitName("player");
local dgks_multikill = 0;
local dgks_lastkill = 0;
-- Holds a list of recently selected hostile players.
local recentlySelectedPlayers = {};
local elapsedTime = 0;
-- Setup the Ace2 slash commands
local options = {
type='group',
args = {
sound = {
type = 'toggle',
name = 'Play Sound',
desc = 'Toggles the playing of the audible message',
get = "issound",
set = "togglesound"
},
emote = {
type = 'toggle',
name = 'Show Emote',
desc = 'Toggles the display of the emote',
get = "isemote",
set = "toggleemote"
},
bgonly = {
type = 'toggle',
name = 'Battleground Only',
desc = 'Toggles battleground only mode',
get = "isbgonly",
set = "togglebgonly"
},
raid = {
type = 'toggle',
name = 'Sync with Raid',
desc = 'Toggles the syncing the message with raid',
get = "israid",
set = "toggleraid"
},
-- ENABLE FOR DEBUGGING
--test = {
-- type = 'execute',
-- name = 'Test dgks',
-- desc = 'Test dgks message output',
-- func = "dgks_Killshot"
--},
score = {
type = 'execute',
name = 'Print KillingStreak',
desc = 'Print KillingStreak',
func = "dgks_KillingStreak"
}--,
--config = {
-- type = 'execute',
-- name = 'Show Config',
-- desc = 'Show Config',
-- func = "dgks_toggleConfig"
--}
}
};
--------------------
-- DGKS MAIN CODE --
--------------------
-- Create the Ace2 main object
dgks = AceLibrary("AceAddon-2.0"):new("AceConsole-2.0", "AceEvent-2.0", "AceDB-2.0");
-- Register the Ace2 / commands
dgks:RegisterChatCommand({"/dgks", "/ksn"}, options)
-- Setup the Ace2 slash command functions
function dgks:issound()
return self.db.profile.sound;
end
function dgks:togglesound()
self.db.profile.sound = not self.db.profile.sound;
end
function dgks:isemote()
return self.db.profile.emote;
end
function dgks:toggleemote()
self.db.profile.emote = not self.db.profile.emote;
end
function dgks:isbgonly()
return self.db.profile.bgonly;
end
function dgks:togglebgonly()
-- toggle current setting
self.db.profile.bgonly = not self.db.profile.bgonly;
-- if bg only mode watch zone changes
if (self.db.profile.bgonly) then
-- Setup bg only mode
self:RegisterEvent("ZONE_CHANGED_NEW_AREA");
-- Check to see if we are in bg or not
dgks:ZONE_CHANGED_NEW_AREA();
else
-- Setup all the time mode
self:UnregisterEvent("ZONE_CHANGED_NEW_AREA");
self:RegisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH");
self:RegisterEvent("CHAT_MSG_SYSTEM");
self:RegisterEvent("PLAYER_DEAD");
self:RegisterEvent("CHAT_MSG_ADDON");
self:RegisterEvent("PLAYER_TARGET_CHANGED");
end
end
function dgks:israid()
return self.db.profile.raid;
end
function dgks:toggleraid()
self.db.profile.raid = not self.db.profile.raid;
end
function dgks:OnUpdate(arg1)
-- Increment the amount of time passed since the last update.
elapsedTime = elapsedTime + arg1;
-- Check if it's time for an update.
if (elapsedTime >= RECENTLY_SELECTED_PLAYERS_UPDATE_INTERVAL) then
-- Loop through all of the recently selected players.
for playerName, lastSeen in recentlySelectedPlayers do
-- Increment the amount of time since the player was last seen.
recentlySelectedPlayers[playerName] = lastSeen + elapsedTime;
-- Check if enough time has passed and remove the player from the list.
if (lastSeen + elapsedTime >= RECENTLY_SELECTED_PLAYERS_HOLD_TIME) then
recentlySelectedPlayers[playerName] = nil;
end
end
-- Reset the elapsed time.
elapsedTime = 0;
end
end
function dgks:OnEnable()
-- Called when the addon is enabled
self:RegisterEvent("dgks_PlaySoundFile");
if (self.db.profile.bgonly) then
self:RegisterEvent("ZONE_CHANGED_NEW_AREA");
else
self:RegisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH");
self:RegisterEvent("CHAT_MSG_SYSTEM");
self:RegisterEvent("PLAYER_DEAD");
self:RegisterEvent("CHAT_MSG_ADDON");
self:RegisterEvent("PLAYER_TARGET_CHANGED");
end
end
function dgks:CHAT_MSG_COMBAT_HOSTILE_DEATH(arg1)
if (string.find (arg1, "You have slain ")) then
-- KILLSHOT!
killingstreak = dgks:dgks_Killshot(arg1, killingstreak);
end
end
function dgks:CHAT_MSG_SYSTEM(arg1)
if (string.find (arg1, dgks_playername .. " has defeated ")) then
-- Duel won!
if ( killingstreak < KSRANK1) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND1", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND1);
elseif (killingstreak < KSRANK2) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND2", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND2);
elseif (killingstreak < KSRANK3) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND3", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND3);
elseif (killingstreak < KSRANK4) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND4", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND4);
elseif (killingsteak < KSRANK5) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND5", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND5);
elseif (killingstreak > (KSRANK5 - 1)) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND6", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND6);
end
-- Increment killingblow streak
killingstreak = killingstreak + 1;
dgks:dgks_SendAddonMessage("dgks_txt", arg1, "RAID");
dgks:dgks_Blamo(arg1);
elseif (string.find (arg1, "has defeated " .. dgks_playername .. " in a duel.")) then
-- Duel lost!
killingstreak = 0;
dgks:dgks_SendAddonMessage("dgks_txt", arg1, "RAID");
end
if (string.find(arg1, dgks_playername .. " has fled from ")) then
-- lol u ran from a duel
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUNDH", "RAID");
dgks:dgks_PlaySoundFile(KSSOUNDH);
dgks:dgks_Blamo(arg1);
dgks:dgks_SendAddonMessage("dgks_txt", arg1, "RAID");
end
end
function dgks:PLAYER_DEAD()
-- Player has died. End killing streak.
killingstreak = 0;
end
function dgks:CHAT_MSG_ADDON(arg1,arg2,arg3,arg4)
if not (arg4 == dgks_playername) then
if (arg1 == "dgks") then
dgks:dgks_Blamo(arg4 .. arg2);
elseif (arg1 == "dgks_snd") then
if arg2 == "KSSOUND1" then
dgks:dgks_PlaySoundFile(KSSOUND1);
elseif arg2 == "KSSOUND2" then
dgks:dgks_PlaySoundFile(KSSOUND2);
elseif arg2 == "KSSOUND3" then
dgks:dgks_PlaySoundFile(KSSOUND3);
elseif arg2 == "KSSOUND4" then
dgks:dgks_PlaySoundFile(KSSOUND4);
elseif arg2 == "KSSOUND5" then
dgks:dgks_PlaySoundFile(KSSOUND5);
elseif arg2 == "KSSOUND6" then
dgks:dgks_PlaySoundFile(KSSOUND6);
elseif arg2 == "KSSOUND7" then
dgks:dgks_PlaySoundFile(KSSOUND7);
elseif arg2 == "KSSOUND8" then
dgks:dgks_PlaySoundFile(KSSOUND8);
elseif arg2 == "KSSOUND9" then
dgks:dgks_PlaySoundFile(KSSOUND9);
elseif arg2 == "KSSOUND10" then
dgks:dgks_PlaySoundFile(KSSOUND10);
elseif arg2 == "KSSOUND11" then
dgks:dgks_PlaySoundFile(KSSOUND11);
elseif arg2 == "KSSOUND12" then
dgks:dgks_PlaySoundFile(KSSOUND12);
elseif arg2 == "KSSOUND13" then
dgks:dgks_PlaySoundFile(KSSOUND13);
elseif arg2 == "KSSOUNDM1" then
dgks:dgks_PlaySoundFile(KSSOUNDM1);
elseif arg2 == "KSSOUNDM2" then
dgks:dgks_PlaySoundFile(KSSOUNDM2);
elseif arg2 == "KSSOUNDM3" then
dgks:dgks_PlaySoundFile(KSSOUNDM3);
elseif arg2 == "KSSOUNDM4" then
dgks:dgks_PlaySoundFile(KSSOUNDM4);
elseif arg2 == "KSSOUNDH" then
dgks:dgks_PlaySoundFile(KSSOUNDH);
end
elseif (arg1 == "dgks_txt") then
dgks:dgks_Print(arg2);
end
end
end
function dgks:ZONE_CHANGED_NEW_AREA()
local dgks_newzone = GetZoneText();
if ((dgks_newzone == "Warsong Gulch") or (dgks_newzone == "Arathi Basin") or (dgks_newzone == "Alterac Valley")) then
self:RegisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH");
self:RegisterEvent("PLAYER_DEAD");
self:RegisterEvent("CHAT_MSG_ADDON");
self:RegisterEvent("PLAYER_TARGET_CHANGED");
else
if self:IsEventRegistered("CHAT_MSG_COMBAT_HOSTILE_DEATH") then
self:UnregisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH");
self:UnregisterEvent("PLAYER_DEAD");
self:UnregisterEvent("CHAT_MSG_ADDON");
self:UnregisterEvent("PLAYER_TARGET_CHANGED");
end
end
end
function dgks:PLAYER_TARGET_CHANGED()
-- Make sure a unit is selected, is a player and is hostile.
if (UnitExists("target") and UnitIsPlayer("target") and not UnitIsFriend("player", "target")) then
-- Get the unit's name and make sure it's valid before adding it to the recently selected player's list.
local playerName = UnitName("target");
if (playerName) then
recentlySelectedPlayers[playerName] = 0;
end
end
end
function dgks:dgks_Print(msg)
-- New school Ace2 style
dgks:Print(msg);
end
function dgks:dgks_Blamo(msg)
if (IsAddOnLoaded("Blizzard_CombatText")) then
-- If Blizzard CombatText enable send msg there
CombatText_AddMessage(msg, CombatText_StandardSCroll, 1, 0.1, 0.1, "crit", 0);
elseif (IsAddOnLoaded("SCT")) then
-- If SCT is loaded send msg there
color = {r=1.0, g=0.1, b=0.1};
SCT:DisplayText(msg, color, 1, "event", 1, 1);
elseif (IsAddOnLoaded("MikScrollingBattleText")) then
-- If Mik's Scrolling Battle Text is loaded send msg here
MikSBT.DisplayMessage(msg, MikSBT.DISPLAYTYPE_OUTGOING, false, 0, 0, 255);
end
-- Last and least just send it to the text box if no scrolling text available.
dgks:dgks_Print(msg);
end
function dgks:dgks_Killshot(arg1, arg2)
-- Do some PC/NPC checking before we get all excited and flag a kill
-- There has got to be a better way to do this, but as of now this is my rig
local npc = 1;
-- Make sure arg2 is not nil
if (arg2 == nil) then
arg2 = 0;
end
-- If arg1 is nil then this must be a test
if (arg1 == nil) then
arg1 = "You have slain Test."
npc = 0;
-- DEBUG arg2 = arg2 - 1;
end
-- Get name from kill string
local dgks_victimname = string.sub(arg1,16,-2);
-- Check if the current target is the slain enemy and is a player, or the slain target is on the recently
-- selected players list.
if ((UnitExists("target") and (UnitName("target") == dgks_victimname) and UnitIsPlayer("target")) or (recentlySelectedPlayers[dgks_victimname] ~= nil)) then
npc = 0;
end
if npc==0 then
-- PLAYER GOT KILLSHOT
-- Emote Enabled
if (self.db.profile.emote) then
SendChatMessage("has destroyed " .. dgks_victimname, "EMOTE");
end
-- Print to SCT or Text Box
dgks:dgks_Blamo(dgks_playername .. " has killed " .. dgks_victimname);
dgks:dgks_SendAddonMessage("dgks", " has killed " .. dgks_victimname, "RAID");
-- Play correct sounds and send to raid
if (arg2 < KSRANK1) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND1", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND1);
elseif (arg2 < KSRANK2) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND2", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND2);
elseif (arg2 < KSRANK3) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND3", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND3);
elseif (arg2 < KSRANK4) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND4", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND4);
elseif (arg2 < KSRANK5) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND5", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND5);
elseif (arg2 > (KSRANK5 - 1)) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND6", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND6);
end
-- Check for multikill
local dgks_thiskill = GetTime();
if((dgks_lastkill + 5) > dgks_thiskill) then
-- multikill!!
dgks_multikill = dgks_multikill + 1;
if (dgks_multikill == 2) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUNDM1", "RAID");
dgks:dgks_SendAddonMessage("dgks_txt", dgks_playername .. " has got a " .. KSTEXTM1, "RAID");
dgks:Print(dgks_playername .. " has got a " .. KSTEXTM1);
dgks:dgks_PlaySoundFile(KSSOUNDM1);
elseif (dgks_multikill == 3) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUNDM2", "RAID");
dgks:dgks_SendAddonMessage("dgks_txt", dgks_playername .. " has got a " .. KSTEXTM2, "RAID");
dgks:Print(dgks_playername .. " has got a " .. KSTEXTM2);
dgks:dgks_PlaySoundFile(KSSOUNDM2);
elseif (dgks_multikill == 4) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUNDM3", "RAID");
dgks:dgks_SendAddonMessage("dgks_txt", dgks_playername .. " has got a " .. KSTEXTM3, "RAID");
dgks:Print(dgks_playername .. " has got a " .. KSTEXTM3);
dgks:dgks_PlaySoundFile(KSSOUNDM3);
elseif (dgks_multikill > 4) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUNDM4", "RAID");
dgks:dgks_SendAddonMessage("dgks_txt", dgks_playername .. " has got a " .. KSTEXTM4, "RAID");
dgks:Print(dgks_playername .. " has got a " .. KSTEXTM4);
dgks:dgks_PlaySoundFile(KSSOUNDM4);
end
else
-- last kill was more than 5 seconds ago
dgks_multikill = 1;
end
dgks_lastkill = dgks_thiskill;
-- Increment killingblow streak
return arg2+1;
end
-- Since it was an npc dont increment our killingblow streak
return arg2;
end
function dgks:dgks_PlaySoundFile(arg1)
if(self.db.profile.sound) then
if not (PlaySoundFile(arg1)) then
self:ScheduleEvent("dgks_PlaySoundFile", 0.2 , arg1);
end
end
end
function dgks:dgks_SendAddonMessage(arg1, arg2, arg3)
if(self.db.profile.raid) then
SendAddonMessage(arg1, arg2, arg3);
end
end
function dgks:dgks_KillingStreak()
dgks:dgks_Print("KillingStreak: " .. killingstreak);
end
function dgks:dgks_toggleConfig()
if not dgks_configframe then
dgks_configframe = CreateFrame("Frame",nil,UIParent);
dgks_configframe:SetFrameStrata("BACKGROUND");
dgks_configframe:SetWidth(128); -- Set These to whatever height/width is needed
dgks_configframe:SetHeight(64); -- for your Texture
dgks_configframe:SetPoint("CENTER",0,0);
dgks_configframe:Show();
end
if(dgks_configframe:IsVisible()) then
dgks_configframe:Hide();
else
dgks_configframe:Show();
end
end
I like the idea of this a lot, but it does not work for me...
Very seldom do I hear a sound effect played. When I do, it's very fast and high pitched in a "chipmunk" voice. Never happens as the result of a killing blow. Sometimes fires off when I change targets or mid fight.
Was wondering if you had a guide for typing in commands because I accidently disable it in game and don't know how to re-enable the mod. User's guide would be helpful.
Hey guys,
Leech is letting me work on this project for a while, since he hasn't had a lot of time to update it lately.
Biggest changes of the latest version: 20300.0.01
-Support for sound packs
-More kill ranks
-raidscore command
Two sound packs have been released to work with this version:
dgks_female
dgks_sexy
They are separate AddOns that go in your AddOns folder.
Once you have one installed you can change your sound pack by entering one of the following commands:
"/dgks soundpack male" <default>
"/dgks soundpack female"
"/dgks soundpack sexy"
download the latest versions from WowAce.
dgks now includes all killing ranks from UT2004.
By request of Lightbender of Kil'Jaeden, the new /raidscore command will print your killing streak to raid (killing streak = kills without dying)
A lot of people have been editing the LUA file to use custom kill messages, example: "Delthis has totally pwnd Clothahump". For this reason, a new slash command has been quietly added to allow you to more easily make your own kill message. However, due to obscene messages being used, the next version will either have a toggle to turn off others' custom messages, or force the standard message. It depends on the complications of implementation and compatibility with older versions.
-----------
Always get the latest version from WowAce, other websites have severly outdated copies. I will update them once I have rights.
Thanks to Ratchet(Leech) and Badandy for letting me work on your awesome mod! :D
I was hoping it would constantly announce my combos to raid/bg chat for entertainment purposes, but it doesn't. Is something like that planned for the future?
My guild have had a lot of fun with the new custom messages feature, but do you think you could implement the option to have a list of messages, picked at random on each kill? At the moment I have macros set up to change the message between kills so it'd be great to just shove them all straight into the addon.
hi thx for keep it update but it still dont work for me :( (its me or what ? t_t) i can use /ks and all but when i kill it dont count kill and play the song <...>
-----------------------
-- PRIVATE CONSTANTS --
-----------------------
-- Edit these to adjust killingstreak ranks --
KSRANK1 = 1;
KSRANK2 = 2;
KSRANK3 = 4;
KSRANK4 = 8;
KSRANK5 = 12;
KSRANK6 = 15;
KSRANK7 = 17;
KSRANK8 = 19;
KSRANK9 = 21;
KSRANK10 = 23;
KSRANK11 = 25;
KSRANK12 = 27:
KSRANK13 = 30;
-- End of editable killing streak ranks --
-- Sound Files
KSSOUND1 = "Interface\\AddOns\\dgks\\sounds\\firstblood.mp3";
KSSOUND2 = "Interface\\AddOns\\dgks\\sounds\\ohyeah.mp3";
KSSOUND3 = "Interface\\Addons\\dgks\\sounds\\ownage.mp3";
KSSOUND4 = "Interface\\AddOns\\dgks\\sounds\\killingspree.mp3";
KSSOUND5 = "Interface\\AddOns\\dgks\\sounds\\dominating.mp3";
KSSOUND6 = "Interface\\AddOns\\dgks\\sounds\\unstoppable.mp3";
KSSOUND7 = "Interface\\AddOns\\dgks\\sounds\\rampage.mp3";
KSSOUND8 = "Interface\\AddOns\\dgks\\sounds\\monsterkill.mp3";
KSSOUND9 = "Interface\\AddOns\\dgks\\sounds\\godlike.mp3";
KSSOUND10 = "Interface\\AddOns\\dgks\\sounds\\ludicrouskill.mp3";
KSSOUND11 = "Interface\\AddOns\\dgks\\sounds\\whickedsick.mp3";
KSSOUND12 = "Interface\\AddOns\\dgks\\sounds\\humiliation.mp3";
KSSOUND13 = "Interface\\AddOns\\dgks\\sounds\\haleluya.mp3";
KSSOUNDM1 = "Interface\\AddOns\\dgks\\sounds\\doublekill.mp3";
KSSOUNDM2 = "Interface\\AddOns\\dgks\\sounds\\triplekill.mp3";
KSSOUNDM3 = "Interface\\AddOns\\dgks\\sounds\\megakill.mp3";
KSSOUNDM4 = "Interface\\AddOns\\dgks\\sounds\\monsterkill.mp3";
KSSOUNDH = "Interface\\AddOns\\dgks\\sounds\\humiliation.mp3";
-- Multikill Text
KSTEXTM1 = "DOUBLEKILL!";
KSTEXTM2 = "TRIPLEKILL!";
KSTEXTM3 = "MEGAKILL!";
KSTEXTM4 = "MONSTERKILL!!!";
KSTEXTMH = "Total Humiliation!!!!!!!!";
-- Amount of time to delay between selected player list updates and how long
-- to hold a recently selected player in cache.
local RECENTLY_SELECTED_PLAYERS_UPDATE_INTERVAL = 1;
local RECENTLY_SELECTED_PLAYERS_HOLD_TIME = 45;
-----------------------
-- PRIVATE VARIABLES --
-----------------------
local killingstreak = 0;
local dgks_playername = UnitName("player");
local dgks_multikill = 0;
local dgks_lastkill = 0;
-- Holds a list of recently selected hostile players.
local recentlySelectedPlayers = {};
local elapsedTime = 0;
-- Setup the Ace2 slash commands
local options = {
type='group',
args = {
sound = {
type = 'toggle',
name = 'Play Sound',
desc = 'Toggles the playing of the audible message',
get = "issound",
set = "togglesound"
},
emote = {
type = 'toggle',
name = 'Show Emote',
desc = 'Toggles the display of the emote',
get = "isemote",
set = "toggleemote"
},
bgonly = {
type = 'toggle',
name = 'Battleground Only',
desc = 'Toggles battleground only mode',
get = "isbgonly",
set = "togglebgonly"
},
raid = {
type = 'toggle',
name = 'Sync with Raid',
desc = 'Toggles the syncing the message with raid',
get = "israid",
set = "toggleraid"
},
-- ENABLE FOR DEBUGGING
--test = {
-- type = 'execute',
-- name = 'Test dgks',
-- desc = 'Test dgks message output',
-- func = "dgks_Killshot"
--},
score = {
type = 'execute',
name = 'Print KillingStreak',
desc = 'Print KillingStreak',
func = "dgks_KillingStreak"
}--,
--config = {
-- type = 'execute',
-- name = 'Show Config',
-- desc = 'Show Config',
-- func = "dgks_toggleConfig"
--}
}
};
--------------------
-- DGKS MAIN CODE --
--------------------
-- Create the Ace2 main object
dgks = AceLibrary("AceAddon-2.0"):new("AceConsole-2.0", "AceEvent-2.0", "AceDB-2.0");
-- Register the Ace2 / commands
dgks:RegisterChatCommand({"/dgks", "/ksn"}, options)
-- Register default options
dgks:RegisterDB("dgksDB", "dgksDBPC");
dgks:RegisterDefaults("profile", {
sound = true,
emote = false,
bgonly = false,
raid = true
} );
-- Setup the Ace2 slash command functions
function dgks:issound()
return self.db.profile.sound;
end
function dgks:togglesound()
self.db.profile.sound = not self.db.profile.sound;
end
function dgks:isemote()
return self.db.profile.emote;
end
function dgks:toggleemote()
self.db.profile.emote = not self.db.profile.emote;
end
function dgks:isbgonly()
return self.db.profile.bgonly;
end
function dgks:togglebgonly()
-- toggle current setting
self.db.profile.bgonly = not self.db.profile.bgonly;
-- if bg only mode watch zone changes
if (self.db.profile.bgonly) then
-- Setup bg only mode
self:RegisterEvent("ZONE_CHANGED_NEW_AREA");
-- Check to see if we are in bg or not
dgks:ZONE_CHANGED_NEW_AREA();
else
-- Setup all the time mode
self:UnregisterEvent("ZONE_CHANGED_NEW_AREA");
self:RegisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH");
self:RegisterEvent("CHAT_MSG_SYSTEM");
self:RegisterEvent("PLAYER_DEAD");
self:RegisterEvent("CHAT_MSG_ADDON");
self:RegisterEvent("PLAYER_TARGET_CHANGED");
end
end
function dgks:israid()
return self.db.profile.raid;
end
function dgks:toggleraid()
self.db.profile.raid = not self.db.profile.raid;
end
function dgks:OnUpdate(arg1)
-- Increment the amount of time passed since the last update.
elapsedTime = elapsedTime + arg1;
-- Check if it's time for an update.
if (elapsedTime >= RECENTLY_SELECTED_PLAYERS_UPDATE_INTERVAL) then
-- Loop through all of the recently selected players.
for playerName, lastSeen in recentlySelectedPlayers do
-- Increment the amount of time since the player was last seen.
recentlySelectedPlayers[playerName] = lastSeen + elapsedTime;
-- Check if enough time has passed and remove the player from the list.
if (lastSeen + elapsedTime >= RECENTLY_SELECTED_PLAYERS_HOLD_TIME) then
recentlySelectedPlayers[playerName] = nil;
end
end
-- Reset the elapsed time.
elapsedTime = 0;
end
end
function dgks:OnEnable()
-- Called when the addon is enabled
self:RegisterEvent("dgks_PlaySoundFile");
if (self.db.profile.bgonly) then
self:RegisterEvent("ZONE_CHANGED_NEW_AREA");
else
self:RegisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH");
self:RegisterEvent("CHAT_MSG_SYSTEM");
self:RegisterEvent("PLAYER_DEAD");
self:RegisterEvent("CHAT_MSG_ADDON");
self:RegisterEvent("PLAYER_TARGET_CHANGED");
end
end
function dgks:CHAT_MSG_COMBAT_HOSTILE_DEATH(arg1)
if (string.find (arg1, "You have slain ")) then
-- KILLSHOT!
killingstreak = dgks:dgks_Killshot(arg1, killingstreak);
end
end
function dgks:CHAT_MSG_SYSTEM(arg1)
if (string.find (arg1, dgks_playername .. " has defeated ")) then
-- Duel won!
if ( killingstreak < KSRANK1) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND1", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND1);
elseif (killingstreak < KSRANK2) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND2", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND2);
elseif (killingstreak < KSRANK3) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND3", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND3);
elseif (killingstreak < KSRANK4) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND4", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND4);
elseif (killingsteak < KSRANK5) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND5", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND5);
elseif (killingstreak > (KSRANK5 - 1)) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND6", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND6);
end
-- Increment killingblow streak
killingstreak = killingstreak + 1;
dgks:dgks_SendAddonMessage("dgks_txt", arg1, "RAID");
dgks:dgks_Blamo(arg1);
elseif (string.find (arg1, "has defeated " .. dgks_playername .. " in a duel.")) then
-- Duel lost!
killingstreak = 0;
dgks:dgks_SendAddonMessage("dgks_txt", arg1, "RAID");
end
if (string.find(arg1, dgks_playername .. " has fled from ")) then
-- lol u ran from a duel
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUNDH", "RAID");
dgks:dgks_PlaySoundFile(KSSOUNDH);
dgks:dgks_Blamo(arg1);
dgks:dgks_SendAddonMessage("dgks_txt", arg1, "RAID");
end
end
function dgks:PLAYER_DEAD()
-- Player has died. End killing streak.
killingstreak = 0;
end
function dgks:CHAT_MSG_ADDON(arg1,arg2,arg3,arg4)
if not (arg4 == dgks_playername) then
if (arg1 == "dgks") then
dgks:dgks_Blamo(arg4 .. arg2);
elseif (arg1 == "dgks_snd") then
if arg2 == "KSSOUND1" then
dgks:dgks_PlaySoundFile(KSSOUND1);
elseif arg2 == "KSSOUND2" then
dgks:dgks_PlaySoundFile(KSSOUND2);
elseif arg2 == "KSSOUND3" then
dgks:dgks_PlaySoundFile(KSSOUND3);
elseif arg2 == "KSSOUND4" then
dgks:dgks_PlaySoundFile(KSSOUND4);
elseif arg2 == "KSSOUND5" then
dgks:dgks_PlaySoundFile(KSSOUND5);
elseif arg2 == "KSSOUND6" then
dgks:dgks_PlaySoundFile(KSSOUND6);
elseif arg2 == "KSSOUND7" then
dgks:dgks_PlaySoundFile(KSSOUND7);
elseif arg2 == "KSSOUND8" then
dgks:dgks_PlaySoundFile(KSSOUND8);
elseif arg2 == "KSSOUND9" then
dgks:dgks_PlaySoundFile(KSSOUND9);
elseif arg2 == "KSSOUND10" then
dgks:dgks_PlaySoundFile(KSSOUND10);
elseif arg2 == "KSSOUND11" then
dgks:dgks_PlaySoundFile(KSSOUND11);
elseif arg2 == "KSSOUND12" then
dgks:dgks_PlaySoundFile(KSSOUND12);
elseif arg2 == "KSSOUND13" then
dgks:dgks_PlaySoundFile(KSSOUND13);
elseif arg2 == "KSSOUNDM1" then
dgks:dgks_PlaySoundFile(KSSOUNDM1);
elseif arg2 == "KSSOUNDM2" then
dgks:dgks_PlaySoundFile(KSSOUNDM2);
elseif arg2 == "KSSOUNDM3" then
dgks:dgks_PlaySoundFile(KSSOUNDM3);
elseif arg2 == "KSSOUNDM4" then
dgks:dgks_PlaySoundFile(KSSOUNDM4);
elseif arg2 == "KSSOUNDH" then
dgks:dgks_PlaySoundFile(KSSOUNDH);
end
elseif (arg1 == "dgks_txt") then
dgks:dgks_Print(arg2);
end
end
end
function dgks:ZONE_CHANGED_NEW_AREA()
local dgks_newzone = GetZoneText();
if ((dgks_newzone == "Warsong Gulch") or (dgks_newzone == "Arathi Basin") or (dgks_newzone == "Alterac Valley")) then
self:RegisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH");
self:RegisterEvent("PLAYER_DEAD");
self:RegisterEvent("CHAT_MSG_ADDON");
self:RegisterEvent("PLAYER_TARGET_CHANGED");
else
if self:IsEventRegistered("CHAT_MSG_COMBAT_HOSTILE_DEATH") then
self:UnregisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH");
self:UnregisterEvent("PLAYER_DEAD");
self:UnregisterEvent("CHAT_MSG_ADDON");
self:UnregisterEvent("PLAYER_TARGET_CHANGED");
end
end
end
function dgks:PLAYER_TARGET_CHANGED()
-- Make sure a unit is selected, is a player and is hostile.
if (UnitExists("target") and UnitIsPlayer("target") and not UnitIsFriend("player", "target")) then
-- Get the unit's name and make sure it's valid before adding it to the recently selected player's list.
local playerName = UnitName("target");
if (playerName) then
recentlySelectedPlayers[playerName] = 0;
end
end
end
function dgks:dgks_Print(msg)
-- New school Ace2 style
dgks:Print(msg);
end
function dgks:dgks_Blamo(msg)
if (IsAddOnLoaded("Blizzard_CombatText")) then
-- If Blizzard CombatText enable send msg there
CombatText_AddMessage(msg, CombatText_StandardSCroll, 1, 0.1, 0.1, "crit", 0);
elseif (IsAddOnLoaded("SCT")) then
-- If SCT is loaded send msg there
color = {r=1.0, g=0.1, b=0.1};
SCT:DisplayText(msg, color, 1, "event", 1, 1);
elseif (IsAddOnLoaded("MikScrollingBattleText")) then
-- If Mik's Scrolling Battle Text is loaded send msg here
MikSBT.DisplayMessage(msg, MikSBT.DISPLAYTYPE_OUTGOING, false, 0, 0, 255);
end
-- Last and least just send it to the text box if no scrolling text available.
dgks:dgks_Print(msg);
end
function dgks:dgks_Killshot(arg1, arg2)
-- Do some PC/NPC checking before we get all excited and flag a kill
-- There has got to be a better way to do this, but as of now this is my rig
local npc = 1;
-- Make sure arg2 is not nil
if (arg2 == nil) then
arg2 = 0;
end
-- If arg1 is nil then this must be a test
if (arg1 == nil) then
arg1 = "You have slain Test."
npc = 0;
-- DEBUG arg2 = arg2 - 1;
end
-- Get name from kill string
local dgks_victimname = string.sub(arg1,16,-2);
-- Check if the current target is the slain enemy and is a player, or the slain target is on the recently
-- selected players list.
if ((UnitExists("target") and (UnitName("target") == dgks_victimname) and UnitIsPlayer("target")) or (recentlySelectedPlayers[dgks_victimname] ~= nil)) then
npc = 0;
end
if npc==0 then
-- PLAYER GOT KILLSHOT
-- Emote Enabled
if (self.db.profile.emote) then
SendChatMessage("has destroyed " .. dgks_victimname, "EMOTE");
end
-- Print to SCT or Text Box
dgks:dgks_Blamo(dgks_playername .. " has killed " .. dgks_victimname);
dgks:dgks_SendAddonMessage("dgks", " has killed " .. dgks_victimname, "RAID");
-- Play correct sounds and send to raid
if (arg2 < KSRANK1) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND1", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND1);
elseif (arg2 < KSRANK2) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND2", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND2);
elseif (arg2 < KSRANK3) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND3", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND3);
elseif (arg2 < KSRANK4) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND4", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND4);
elseif (arg2 < KSRANK5) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND5", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND5);
elseif (arg2 > (KSRANK5 - 1)) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUND6", "RAID");
dgks:dgks_PlaySoundFile(KSSOUND6);
end
-- Check for multikill
local dgks_thiskill = GetTime();
if((dgks_lastkill + 5) > dgks_thiskill) then
-- multikill!!
dgks_multikill = dgks_multikill + 1;
if (dgks_multikill == 2) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUNDM1", "RAID");
dgks:dgks_SendAddonMessage("dgks_txt", dgks_playername .. " has got a " .. KSTEXTM1, "RAID");
dgks:Print(dgks_playername .. " has got a " .. KSTEXTM1);
dgks:dgks_PlaySoundFile(KSSOUNDM1);
elseif (dgks_multikill == 3) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUNDM2", "RAID");
dgks:dgks_SendAddonMessage("dgks_txt", dgks_playername .. " has got a " .. KSTEXTM2, "RAID");
dgks:Print(dgks_playername .. " has got a " .. KSTEXTM2);
dgks:dgks_PlaySoundFile(KSSOUNDM2);
elseif (dgks_multikill == 4) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUNDM3", "RAID");
dgks:dgks_SendAddonMessage("dgks_txt", dgks_playername .. " has got a " .. KSTEXTM3, "RAID");
dgks:Print(dgks_playername .. " has got a " .. KSTEXTM3);
dgks:dgks_PlaySoundFile(KSSOUNDM3);
elseif (dgks_multikill > 4) then
dgks:dgks_SendAddonMessage("dgks_snd", "KSSOUNDM4", "RAID");
dgks:dgks_SendAddonMessage("dgks_txt", dgks_playername .. " has got a " .. KSTEXTM4, "RAID");
dgks:Print(dgks_playername .. " has got a " .. KSTEXTM4);
dgks:dgks_PlaySoundFile(KSSOUNDM4);
end
else
-- last kill was more than 5 seconds ago
dgks_multikill = 1;
end
dgks_lastkill = dgks_thiskill;
-- Increment killingblow streak
return arg2+1;
end
-- Since it was an npc dont increment our killingblow streak
return arg2;
end
function dgks:dgks_PlaySoundFile(arg1)
if(self.db.profile.sound) then
if not (PlaySoundFile(arg1)) then
self:ScheduleEvent("dgks_PlaySoundFile", 0.2 , arg1);
end
end
end
function dgks:dgks_SendAddonMessage(arg1, arg2, arg3)
if(self.db.profile.raid) then
SendAddonMessage(arg1, arg2, arg3);
end
end
function dgks:dgks_KillingStreak()
dgks:dgks_Print("KillingStreak: " .. killingstreak);
end
function dgks:dgks_toggleConfig()
if not dgks_configframe then
dgks_configframe = CreateFrame("Frame",nil,UIParent);
dgks_configframe:SetFrameStrata("BACKGROUND");
dgks_configframe:SetWidth(128); -- Set These to whatever height/width is needed
dgks_configframe:SetHeight(64); -- for your Texture
dgks_configtexture = dgks_configframe:CreateTexture(nil,"BACKGROUND");
dgks_configtexture:SetTexture("Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Factions.blp");
dgks_configtexture:SetAllPoints(dgks_configframe);
dgks_configframe.texture = dgks_configframe;
dgks_configframe:SetPoint("CENTER",0,0);
dgks_configframe:Show();
end
if(dgks_configframe:IsVisible()) then
dgks_configframe:Hide();
else
dgks_configframe:Show();
end
end
Very seldom do I hear a sound effect played. When I do, it's very fast and high pitched in a "chipmunk" voice. Never happens as the result of a killing blow. Sometimes fires off when I change targets or mid fight.
Any hope of an update?
Update on my issue.. it's bugsack that's spouting the chipmunk sound.
dgks, evidently, does not work at all and never makes a peep.
and i finally decided to try it out
and its not working
sadface.
What happens when you run '/ks test'?
Are you running the version from SVN or from a modsite?
Added Eye of the Storm support.
I will work on some more formal documentation.
Leech is letting me work on this project for a while, since he hasn't had a lot of time to update it lately.
Biggest changes of the latest version: 20300.0.01
-Support for sound packs
-More kill ranks
-raidscore command
Two sound packs have been released to work with this version:
dgks_female
dgks_sexy
They are separate AddOns that go in your AddOns folder.
Once you have one installed you can change your sound pack by entering one of the following commands:
"/dgks soundpack male" <default>
"/dgks soundpack female"
"/dgks soundpack sexy"
download the latest versions from WowAce.
dgks now includes all killing ranks from UT2004.
By request of Lightbender of Kil'Jaeden, the new /raidscore command will print your killing streak to raid (killing streak = kills without dying)
A lot of people have been editing the LUA file to use custom kill messages, example: "Delthis has totally pwnd Clothahump". For this reason, a new slash command has been quietly added to allow you to more easily make your own kill message. However, due to obscene messages being used, the next version will either have a toggle to turn off others' custom messages, or force the standard message. It depends on the complications of implementation and compatibility with older versions.
-----------
Always get the latest version from WowAce, other websites have severly outdated copies. I will update them once I have rights.
Thanks to Ratchet(Leech) and Badandy for letting me work on your awesome mod! :D
Please post bugs here.
Thanks,
Delthis of Kil'Jaeden
I was hoping it would constantly announce my combos to raid/bg chat for entertainment purposes, but it doesn't. Is something like that planned for the future?
My guild have had a lot of fun with the new custom messages feature, but do you think you could implement the option to have a list of messages, picked at random on each kill? At the moment I have macros set up to change the message between kills so it'd be great to just shove them all straight into the addon.
Some sounds I found missing:
firstblood
flawless
PrepareForBattle
triplekill