WoWInterface SVN DeathSnap

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 7 to Rev 8
    Reverse comparison

Rev 7 → Rev 8

DeathSnap/DeathSnap.lua
18,14 → 18,17
 
-- Dependencies
Chronos - Embedded
Khaos - Optional
Portfolio - Embedded
 
-- Changes
1.1.0 - Added Portfolio registration
- Removed Khaos registration
- Removed Slash Commands
1.0.2 - German translation provided by Lakar EU-Azshara
1.0.1 - Level Cap 80
1.0.0 - Initial Release
 
-- SVN info
-- SVN info
$Id: DeathSnap.lua 1056 2008-10-24 22:50:07Z gryphon $
$Rev: 1056 $
$LastChangedBy: gryphon $
33,228 → 36,75
 
]]--
 
DS_Setting = {
local CHARACTER_MAXLEVEL = 80;
 
DeathSnap = {
 
Setting = {
Version = GetAddOnMetadata("DeathSnap", "Version");
Revision = tonumber(strsub("$Rev: 1056 $", 7, strlen("$Rev: 1056 $") - 2));
}
},
 
DS_Options = {
Active = 1;
MinLevel = 1;
MaxLevel = 80;
CloseWindows = 0;
}
On = {
 
DS_On = {
 
Load = function()
 
DS_Register.RegisterEvent("UNIT_DIED")
DS_Register.RegisterEvent("PLAYER_DEAD")
 
if (Khaos) then
DS_Register.Khaos();
else
DS_Register.SlashCommands()
end
 
end;
 
Event = function(event)
 
if ( ( event == "UNIT_DIED" or event == "PLAYER_DEAD" ) and DS_Options.Active == 1 ) then
if (UnitLevel("player") >= DS_Options.MinLevel and UnitLevel("player") <= DS_Options.MaxLevel) then
if (DS_Options.CloseWindows == 1) then
if ( ( event == "UNIT_DIED" or event == "PLAYER_DEAD" ) and DeathSnap_SavedVars.Enabled ) then
if (UnitLevel("player") >= DeathSnap_SavedVars.MinLevel and UnitLevel("player") <= DeathSnap_SavedVars.MaxLevel) then
if (DeathSnap_SavedVars.CloseWindows) then
CloseAllWindows()
RequestTimePlayed()
DS_Function.TakeScreenshot()
DeathSnap.Function.TakeScreenshot()
else
RequestTimePlayed()
DS_Function.TakeScreenshot()
DeathSnap.Function.TakeScreenshot()
end
end
end
 
end;
 
}
},
 
DS_Register = {
Function = {
 
RegisterEvent = function(event)
this:RegisterEvent(event)
end;
 
SlashCommands = function()
SLASH_DS_HELP1 = "/ds";
SLASH_DS_HELP2 = "/deathsnap";
SlashCmdList["DS_HELP"] = DS_Command;
end;
 
Khaos = function()
local version = DS_Setting.Version.."."..DS_Setting.Revision
 
local optionSet = {
id = "DeathSnap";
text = function() return DS_TITLE end;
helptext = function() return DS_INFO end;
difficulty = 1;
default = true;
callback = function(checked)
DS_Options.Active = checked and 1 or 0;
end;
options = {
{
id = "Header";
text = function() return DS_TITLE.." "..DS_Color.Green("v"..version) end;
helptext = function() return DS_INFO end;
type = K_HEADER;
difficulty = 1;
};
 
{
id="DS_MinLevel";
type = K_SLIDER;
text = function() return DS_MINIMUM end;
helptext = function() return DS_HELP_MIN end;
difficulty = 1;
feedback = function(state)
return string.format(DS_MINMAXSET2, DS_MINIMUM, state.slider);
end;
callback = function(state)
if (state.slider >= DS_Options.MaxLevel) then
Khaos.setSetKeyParameter("DeathSnap","DS_MaxLevel", "slider", state.slider);
Khaos.refresh(false, false, true);
end;
DS_Options.MinLevel = state.slider;
end;
default = { checked = true; slider = 1 };
disabled = { checked = false; slider = 1 };
setup = {
sliderMin = 1;
sliderMax = 80;
sliderStep = 1;
sliderDisplayFunc = function(val)
return val;
end;
};
};
 
 
{
id="DS_MaxLevel";
type = K_SLIDER;
text = function() return DS_MAXIMUM end;
helptext = function() return DS_HELP_MAX end;
difficulty = 1;
feedback = function(state)
return string.format(DS_MINMAXSET2, DS_MAXIMUM, state.slider);
end;
callback = function(state)
if (state.slider <= DS_Options.MinLevel) then
Khaos.setSetKeyParameter("DeathSnap","DS_MinLevel", "slider", state.slider);
Khaos.refresh(false, false, true);
end;
DS_Options.MaxLevel = state.slider;
end;
default = { checked = false; slider = 80 };
disabled = { checked = false; slider = 80 };
setup = {
sliderMin = 1;
sliderMax = 80;
sliderStep = 1;
sliderDisplayFunc = function(val)
return val;
end;
};
};
 
{
id = "DS_CloseWindows";
type = K_TEXT;
text = function() return DS_CLOSEWIN end;
helptext = function() return DS_HELP_CLOSEWIN end;
difficulty = 1;
feedback = function(state)
if (state.checked) then
return string.format(DS_CLOSEALL, DS_ENABLED);
else
return string.format(DS_CLOSEALL, DS_DISABLED);
end
end;
callback = function(state)
if (state.checked) then
DS_Options.CloseWindows = 1;
else
DS_Options.CloseWindows = 0;
end
end;
check = true;
default = { checked = false };
disabled = { checked = true };
};
 
{
id = "DS_Status";
type = K_BUTTON;
text = function() return DS_STATUS end;
helptext = function() return DS_HELP_STATUS end;
difficulty = 1;
callback = function(state)
DS_Out.Status()
end;
feedback = function(state) end;
setup = { buttonText = function() return DS_STATUS end; };
};
 
};
};
Khaos.registerOptionSet(
"other",
optionSet
);
 
end;
 
}
 
DS_Function = {
 
TakeScreenshot = function()
Chronos.schedule(1, TakeScreenshot)
end;
 
}
},
 
DS_Out = {
Out = {
 
Print = function(msg)
local color = NORMAL_FONT_COLOR;
DEFAULT_CHAT_FRAME:AddMessage(DS_TITLE..": "..msg, color.r, color.g, color.b)
DEFAULT_CHAT_FRAME:AddMessage(DS_TITLE..": "..msg, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b)
end;
 
Status = function()
local active = DS_Color.Green(DS_ENABLED)
local closeall = DS_Color.Green(DS_ENABLED)
Status = function()
local active = DeathSnap.Color.Green(DS_ENABLED)
local closeall = DeathSnap.Color.Green(DS_ENABLED)
 
if (DS_Options.Active == 0) then
active = DS_Color.Red(DS_DISABLED)
if (not DeathSnap_SavedVars.Enabled) then
active = DeathSnap.Color.Red(DS_DISABLED)
end
if (DS_Options.CloseWindows == 0) then
closeall = DS_Color.Red(DS_DISABLED)
if (not DeathSnap_SavedVars.CloseWindows) then
closeall = DeathSnap.Color.Red(DS_DISABLED)
end
 
DS_Out.Print("AddOn "..active..". "..string.format(DS_MINMAXSET2, DS_MINIMUM, DS_Color.Green(DS_Options.MinLevel)).." "..string.format(DS_MINMAXSET2, DS_MAXIMUM, DS_Color.Green(DS_Options.MaxLevel)).." "..string.format(DS_CLOSEALL, closeall))
end;
DeathSnap.Out.Print("AddOn "..active)
DeathSnap.Out.Print(format(DS_MINMAXSET2, DS_MINIMUM, DeathSnap.Color.Green(DeathSnap_SavedVars.MinLevel)))
DeathSnap.Out.Print(format(DS_MINMAXSET2, DS_MAXIMUM, DeathSnap.Color.Green(DeathSnap_SavedVars.MaxLevel)))
DeathSnap.Out.Print(format(DS_CLOSEALL, closeall))
end;
 
Version = function()
local version = DS_Setting.Version.."."..DS_Setting.Revision
DS_Out.Print(DS_VERSION..": "..DS_Color.Green(version))
end;
Version = function()
local version = DeathSnap.Setting.Version.."."..DeathSnap.Setting.Revision
DeathSnap.Out.Print(DS_VERSION..": "..DeathSnap.Color.Green(version))
end;
 
}
},
 
DS_Color = {
Color = {
 
Green = function(msg)
return "|cff00cc00"..msg.."|r";
264,60 → 114,96
return "|cffff0000"..msg.."|r";
end;
 
},
 
}
 
DS_Command = function(msg)
if (not DeathSnapFrame) then
local frame = CreateFrame("Frame", "DeathSnapFrame")
frame:Hide()
frame:SetScript("OnEvent", DeathSnap.On.Event)
frame:RegisterEvent("UNIT_DIED")
frame:RegisterEvent("PLAYER_DEAD")
end
 
local cmd = string.lower(msg)
--[[ Portfolio Registration ]]--
 
if (cmd == "" or cmd == "help") then
DS_Out.Print("/ds on|off, "..DS_HELP_ONOFF)
DS_Out.Print("/ds min #, "..DS_HELP_MIN)
DS_Out.Print("/ds max #, "..DS_HELP_MAX)
DS_Out.Print("/ds closewin on|off, "..DS_HELP_CLOSEWIN)
DS_Out.Print("/ds status, "..DS_HELP_STATUS)
DS_Out.Print("/ds version, "..DS_HELP_VERSION)
end
local Portfolio = LibStub("Portfolio", true)
 
if (cmd == "version") then
DS_Out.Version()
end
if (Portfolio) then
 
if (cmd == "status") then
DS_Out.Status()
end
local optionTable = {
id = "DeathSnap";
options = {
{
id = "Enabled",
text = DS_ENABLED,
tooltipText = DS_HELP_ONOFF,
type = CONTROLTYPE_CHECKBOX,
defaultValue = 1,
},
{
id = "CloseWindows",
text = DS_CLOSEWIN,
tooltipText = DS_HELP_CLOSEWIN,
type = CONTROLTYPE_CHECKBOX,
defaultValue = 1,
},
{
id = "MinMaxLevelHeader",
text = DS_MINIMUM.." / "..DS_MAXIMUM,
subText = DS_HELP_MINMAX,
type = CONTROLTYPE_HEADER,
},
{
id = "MinLevel",
text = DS_MINIMUM,
subText = DS_HELP_MIN,
type = CONTROLTYPE_SLIDER,
minText = "Min",
maxText = "Max",
defaultValue = 1,
minValue = 1,
maxValue = CHARACTER_MAXLEVEL,
valueStep = 1,
callback = function(value)
if (value >= DeathSnap_SavedVars["MaxLevel"]) then
DeathSnap_SavedVars["MaxLevel"] = value
end
end,
},
{
id = "MaxLevel",
text = DS_MAXIMUM,
subText = DS_HELP_MAX,
type = CONTROLTYPE_SLIDER,
minText = "Min",
maxText = "Max",
defaultValue = CHARACTER_MAXLEVEL,
minValue = 1,
maxValue = CHARACTER_MAXLEVEL,
valueStep = 1,
callback = function(value)
if (value <= DeathSnap_SavedVars["MinLevel"]) then
DeathSnap_SavedVars["MinLevel"] = value
end
end,
point = {"TOPLEFT", "MinLevel", "TOPRIGHT", 80, 0},
},
--[[
{
id = "Status",
text = DS_STATUS,
tooltipText = DS_HELP_STATUS,
type = CONTROLTYPE_BUTTON,
callback = DeathSnap.Out.Status,
point = {nil, "MinLevel", nil, nil, nil},
},
]]--
},
savedVarTable = "DeathSnap_SavedVars",
}
 
if (cmd == "on") then
DS_Options.Active = 1;
DS_Out.Print(DS_Color.Green(DS_ENABLED))
end
Portfolio.RegisterOptionSet(optionTable)
 
if (cmd == "off") then
DS_Options.Active = 0;
DS_Out.Print(DS_Color.Red(DS_DISABLED))
end
 
if (strsub(msg, 1, 3) == "min") then
local num = tonumber(strsub(msg, 4))
DS_Options.MinLevel = num;
DS_Out.Print(string.format(DS_MINMAXSET2, DS_MINIMUM, DS_Color.Green(num)))
end
 
if (strsub(msg, 1, 3) == "max") then
local num = tonumber(strsub(msg, 4))
DS_Options.MaxLevel = num;
DS_Out.Print(string.format(DS_MINMAXSET2, DS_MAXIMUM, DS_Color.Green(num)))
end
 
if (strsub(msg, 1, 8) == "closewin") then
local state = strsub(msg, 10)
if (state == "on") then
DS_Options.CloseWindows = 1;
DS_Out.Print(string.format(DS_CLOSEALL, DS_ENABLED))
elseif (state == "off") then
DS_Options.CloseWindows = 0;
DS_Out.Print(string.format(DS_CLOSEALL, DS_DISABLED))
end
end
 
end;
\ No newline at end of file +end \ No newline at end of file
DeathSnap/Libs Property changes : Added: svn:externals + Portfolio svn://svn.wowinterface.com/Portfolio-318/trunk/Portfolio Chronos svn://svn.wowinterface.com/Chronos-309/trunk/Chronos
DeathSnap/DeathSnap.toc
1,16 → 1,11
## Interface: 30000
## Version: 1.0.2
## Version: 1.1.0
## Title: DeathSnap
## Notes: Automatically snaps a screen shot when you die.
## Notes-zhCN:
## Notes-deDE:
## Notes-esES:
## Notes-frFR:
## Notes-enGB:
## Notes-koKR:
## Notes-ruRU:
## Notes-zhTW:
## OptionalDeps: Chronos, Khaos
## SavedVariablesPerCharacter: DS_Options
## SavedVariablesPerCharacter: DeathSnap_SavedVars
## Author: Ryan "Gryphon" Snook
## X-Category: Miscellaneous
## X-Embeds: Chronos, Portfolio
## X-Email: rsnook@gmail.com
## X-Website: http://ryan.snook.cc, http://www.wowinterface.com/downloads/info11600-DeathSnap.html
DeathSnap.xml
\ No newline at end of file
DeathSnap/localization.us.lua
23,6 → 23,7
DS_CLOSEALL = "Automatically close all windows %s.";
 
DS_HELP_ONOFF = "Enable/Disable DeathSnap.";
DS_HELP_MINMAX = "Set the minimum / maximum level in which DeathSnap is active.";
DS_HELP_MIN = "Set the minimum level in which DeathSnap is active.";
DS_HELP_MAX = "Set the maximum level in which DeathSnap is active.";
DS_HELP_CLOSEWIN = "Closes all open windows before DeathSnap takes a screen shot.";
DeathSnap/localization.de.lua
23,6 → 23,7
DS_CLOSEALL = "Schlie\195\159e alle Fenster automatisch %s.";
 
DS_HELP_ONOFF = "Aktiviere/Deaktiviere DeathSnap.";
DS_HELP_MINMAX = "Setzt Minimum-Level / Maximum-Level in welchem DeathSnap aktiv ist.";
DS_HELP_MIN = "Setzt Minimum-Level in welchem DeathSnap aktiv ist.";
DS_HELP_MAX = "Setzt Maximum-Level in welchem DeathSnap aktiv ist.";
DS_HELP_CLOSEWIN = "Schlie\195\159t alle offnen Fenster, bevor DeathSnap einen Screenshot schie\195\159t.";
DeathSnap/DeathSnap.xml
1,9 → 1,11
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
 
<!-- $Id: DeathSnap.xml 984 2008-05-08 16:49:28Z gryphon $ -->
<!-- $Id: LevelSnap.xml 10 2008-11-20 22:39:03Z Gryphon-19211 $ -->
 
<!-- Required Embeddable Libs -->
<Include file="Chronos\Chronos.xml"/>
<!-- Libs -->
<Include file="Libs\Chronos\Chronos.xml"/>
<Include file="Libs\Portfolio\Loader.xml"/>
 
<!-- Default Localization -->
<Script file="localization.us.lua"/>
21,16 → 23,4
<!-- Scripts -->
<Script file="DeathSnap.lua"/>
 
<!-- Frames -->
<Frame name="DeathSnap" hidden="true">
<Scripts>
<OnLoad>
DS_On.Load();
</OnLoad>
<OnEvent>
DS_On.Event(event);
</OnEvent>
</Scripts>
</Frame>
 
</Ui>
\ No newline at end of file