/trunk
## Interface: 20400 |
## Title : Famous Last Words |
## Notes: This addon gives you the last words of the critters you kill. |
## Author: Sekrin@Argent Dawn-EU |
## Version: 1.3 |
## SavedVariablesPerCharacter: lastwords_options |
LastWords_Critters.lua |
LastWords.lua |
LastWords_FLW.lua |
-- This file is part of the Last Words Addon for World of Warcraft by Sekrin of Argent Dawn - EU |
-- The contents of this file are subject to copyright. |
-- This file contains the replies that critters make when you kill them. |
-- You can customise this file to add new replies if you so wish. Last Words will replace the following tokens in the text: |
-- #n - Player's Name |
-- #c - Player's Class |
LastWords_FLW = { |
"You got me, #n!", |
"I always knew that #cs were Bullies!", |
"Scoundrel!", |
"Argh!", |
"Oo, that smarts!" |
} |
Last Words: README |
------------------ |
About Last Words |
---------------- |
For years the critters of Azeroth have been a silent minority. Slaughtered in their millions by so-called "Adventurers" they have, until now, been denied a voice. However, thanks to the latest developments in goblin engineering, they have been given that voice. |
Whenever you kill a critter, their final words will be translated and presented to you in the default chat frame. In addition, Last Words will keep a running total of how many of each critter you have mercilessly slaughtered. |
Installation |
------------ |
Just drop the entire folder into your World of Warcraft/Interface/AddOns/ folder. |
Commands |
-------- |
Three commands are provided: |
/lastwords reset |
Resets the addon, clearing any added critters (using /lastwords add) and returning the running totals for all critters to 0. |
/lastwords add |
Adds your current target to the list of "critters". |
/lastwords report |
Outputs a list of the critters you have brutally massacred to the default chat frame. |
You may also use /lw instead of /lastwords. |
function Initialise_LastWord_Options() |
lastwords_options = {} |
lastwords_options = { |
["Adder"] = 0, |
["Beetle"] = 0, |
["Biletoad"] = 0, |
["Black Cat"] = 0, |
["Black Rat"] = 0, |
["Brown Marmot"] = 0, |
["Cat"] = 0, |
["Chicken"] = 0, |
["Crab"] = 0, |
["Deeprun Rat"] = 0, |
["Dig Rat"] = 0, |
["Fire Beetle"] = 0, |
["Frog"] = 0, |
["Giant Marsh Frog"] = 0, |
["Hare"] = 0, |
["Huge Toad"] = 0, |
["Infected Squirrel"] = 0, |
["Jungle Toad"] = 0, |
["Larva"] = 0, |
["Lava Crab"] = 0, |
["Maggot"] = 0, |
["Moccasin"] = 0, |
["Mouse"] = 0, |
["Parrot"] = 0, |
["Prairie Dog"] = 0, |
["Rabbit"] = 0, |
["Rat"] = 0, |
["Roach"] = 0, |
["Scorpion"] = 0, |
["Sewer Crocolisk"] = 0, |
["Sewer Rat"] = 0, |
["Skittering Cavern Crawler"] = 0, |
["Skunk"] = 0, |
["Snake"] = 0, |
["Spider"] = 0, |
["Squirrel"] = 0, |
["Tainted Cockroach"] = 0, |
["Tainted Rat"] = 0, |
["Toad"] = 0 |
}; |
end |
function LastWords_OnEvent() |
if (event=="COMBAT_LOG_EVENT_UNFILTERED") then |
if (arg2=="PARTY_KILL") and (arg3==UnitGUID("player")) then |
if lastwords_options[arg7]~=nil then |
local iFLW = random(#(LastWords_FLW)); |
local LW_Message = LastWords_FLW[iFLW] |
LW_Message = gsub(LW_Message, "#n", (UnitName("player"))) |
LW_Message = gsub(LW_Message, "#c", (UnitClass("player"))) |
DEFAULT_CHAT_FRAME:AddMessage("|cFFFF8800"..arg7.." said:|r "..LW_Message); |
lastwords_options[arg7] = lastwords_options[arg7] + 1 |
end |
end |
end |
end |
function LastWords_Command(cmd) |
local tbl = {} |
for v in string.gmatch(cmd, "[^ ]+") do |
tinsert(tbl, v) |
end |
if tbl[1] == "reset" then |
Initialise_LastWord_Options(); |
DEFAULT_CHAT_FRAME:AddMessage("|cFFFF8800Last Words Reset Successfully!|r"); |
elseif tbl[1] == "add" then |
if (UnitName("target")) ~=nil then |
lastwords_options[(UnitName("target"))] = 0; |
DEFAULT_CHAT_FRAME:AddMessage("|cFFFF8800"..(UnitName("target")).." added.|r"); |
else |
DEFAULT_CHAT_FRAME:AddMessage("|cFFFF8800".."You need to target the critter you wish to add!|r"); |
end |
elseif tbl[1] == "report" then |
local output |
output = "" |
for index,value in pairs(lastwords_options) do |
if value ~= 0 then |
if value ==1 then |
output = output..value.." "..index..", "; |
else |
local CName |
if strsub(index, -1) == "y" then |
CName = strsub(index,1, -1).."ies" |
elseif strsub(index, -2) == "ch" then |
CName = index.."es" |
else |
CName = strsub(index,1, -1).."s" |
output = output..value.." "..CName..", "; |
end |
end |
end |
end |
if strlen(output)==0 then |
output = "|cFFFF8800So far you have mercilessly slaughtered:|r Nothing! Hoorah!"; |
else |
output = strsub(output, 1, -3) |
output = "|cFFFF8800So far you have slaughtered:|r "..output..". You Rotter!"; |
end |
DEFAULT_CHAT_FRAME:AddMessage(output); |
else |
DEFAULT_CHAT_FRAME:AddMessage("|cFFFF8800Last Words accepts the following commands:|r") |
DEFAULT_CHAT_FRAME:AddMessage("|cFFFF8800reset:|r Resets all options to their default values.") |
DEFAULT_CHAT_FRAME:AddMessage("|cFFFF8800add:|r Adds your current target to the list of critters.") |
DEFAULT_CHAT_FRAME:AddMessage("|cFFFF8800report:|r Sends a list of the critters you have slaughtered to the chat frame.") |
end |
end |
if lastwords_options == nil then |
Initialise_LastWord_Options(); |
end |
local frame = CreateFrame("Frame", "MyAddOnFrame"); |
frame:SetScript("OnEvent", LastWords_OnEvent); |
frame:SetScript("OnLoad", LastWords_OnLoad); |
frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED"); |
SLASH_LASTWORDS1 = "/lastwords" |
SLASH_LASTWORDS2 = "/lw" |
SlashCmdList["LASTWORDS"] = LastWords_Command; |
DEFAULT_CHAT_FRAME:AddMessage("|cFFFF8800Last Words Loaded Successfully!|r"); |