/trunk
-------------------------------------------------------------------------- |
-- LevelSnap.lua |
-------------------------------------------------------------------------- |
--[[ |
-- Author |
Ryan "Gryphon" Snook (rsnook@gmail.com) |
"Allied Tribal Forces" of "US - Mal'Ganis - Alliance". |
www.AlliedTribalForces.com |
-- Request |
Please do not re-release this AddOn as "Continued", "Resurrected", etc... |
if you have updates/fixes/additions for it, please contact me. If I am |
no longer active in WoW I will gladly pass on the maintenance to someone |
else, however until then please assume I am still active in WoW. |
-- AddOn Description |
Automatically snaps a screen shot when you level. |
-- Dependencies |
Chronos - Embedded |
Portfolio - Embedded |
-- Changes |
1.4.2 - Added Portfolio registration |
- Removed Khaos registration |
- Removed Slash Commands |
- Change version format |
1.4.1 - Bugfix |
1.4.0 - Level Cap 80 |
1.31 - Updated TOC for 2.4 |
1.30 - Shows /played in screenshots |
- Removed hide ui option |
1.24 - Updated TOC for 2.1 |
1.23 - Updated TOC for 2.0 |
1.22 - Updated TOC for 1.12 |
1.21 - Updated TOC for 1.11 |
1.20 - Added the option to close open windows prior to screen shot |
- Added Localization support |
1.10 - Added Khaos support |
1.00 - Initial Release |
-- SVN info |
$Id$ |
$Rev$ |
$LastChangedBy$ |
$Date$ |
]]-- |
LS_Setting = { |
Version = GetAddOnMetadata("LevelSnap", "Version"); |
Revision = tonumber(strsub("$Rev$", 7, strlen("$Rev$") - 2)); |
} |
LS_Options = { |
Active = 1; |
MinLevel = 1; |
MaxLevel = 80; |
CloseWindows = 1; |
} |
LS_On = { |
Load = function() |
LS_Register.RegisterEvent("PLAYER_LEVEL_UP") |
LS_Register.SlashCommands() |
end; |
Event = function(event) |
if (event == "PLAYER_LEVEL_UP" and LS_Options.Active == 1) then |
if (arg1 >= LS_Options.MinLevel and arg1 <= LS_Options.MaxLevel) then |
if (LS_Options.CloseWindows == 1) then |
CloseAllWindows() |
RequestTimePlayed() |
LS_Function.TakeScreenshot() |
else |
RequestTimePlayed() |
LS_Function.TakeScreenshot() |
end |
end |
end |
end; |
} |
LS_Register = { |
RegisterEvent = function(event) |
this:RegisterEvent(event) |
end; |
SlashCommands = function() |
SLASH_LS_HELP1 = "/ls"; |
SLASH_LS_HELP2 = "/levelsnap"; |
SlashCmdList["LS_HELP"] = LS_Command; |
end; |
} |
LS_Function = { |
TakeScreenshot = function() |
Chronos.schedule(1, TakeScreenshot) |
end; |
} |
LS_Out = { |
Print = function(msg) |
local color = NORMAL_FONT_COLOR; |
DEFAULT_CHAT_FRAME:AddMessage(LS_TITLE..": "..msg, color.r, color.g, color.b) |
end; |
Status = function() |
local active = LS_Color.Green(LS_ENABLED) |
local uihide = LS_Color.Green(LS_ENABLED) |
local closeall = LS_Color.Green(LS_ENABLED) |
if (LS_Options.Active == 0) then |
active = LS_Color.Red(LS_DISABLED) |
end |
if (LS_Options.CloseWindows == 0) then |
closeall = LS_Color.Red(LS_DISABLED) |
end |
LS_Out.Print("AddOn "..active..". "..string.format(LS_MINMAXSET2, LS_MINIMUM, LS_Color.Green(LS_Options.MinLevel)).." "..string.format(LS_MINMAXSET2, LS_MAXIMUM, LS_Color.Green(LS_Options.MaxLevel)).." "..string.format(LS_CLOSEALL, closeall).." "..string.format(LS_SHOWHIDE, uihide)) |
end; |
Version = function() |
local version = LS_Setting.Version.."."..LS_Setting.Revision |
LS_Out.Print(LS_VERSION..": "..LS_Color.Green(version)) |
end; |
} |
LS_Color = { |
Green = function(msg) |
return "|cff00cc00"..msg.."|r"; |
end; |
Red = function(msg) |
return "|cffff0000"..msg.."|r"; |
end; |
} |
LS_Command = function(msg) |
local cmd = string.lower(msg) |
if (cmd == "" or cmd == "help") then |
LS_Out.Print("/ls on|off, "..LS_HELP_ONOFF) |
LS_Out.Print("/ls min #, "..LS_HELP_MIN) |
LS_Out.Print("/ls max #, "..LS_HELP_MAX) |
LS_Out.Print("/ls closewin on|off, "..LS_HELP_CLOSEWIN) |
LS_Out.Print("/ls ui on|off, "..LS_HELP_UI) |
LS_Out.Print("/ls status, "..LS_HELP_STATUS) |
LS_Out.Print("/ls version, "..LS_HELP_VERSION) |
end |
if (cmd == "version") then |
LS_Out.Version() |
end |
if (cmd == "status") then |
LS_Out.Status() |
end |
if (cmd == "on") then |
LS_Options.Active = 1; |
LS_Out.Print(LS_Color.Green(LS_ENABLED)) |
end |
if (cmd == "off") then |
LS_Options.Active = 0; |
LS_Out.Print(LS_Color.Red(LS_DISABLED)) |
end |
if (strsub(msg, 1, 3) == "min") then |
local num = tonumber(strsub(msg, 4)) |
LS_Options.MinLevel = num; |
LS_Out.Print(string.format(LS_MINMAXSET2, LS_MINIMUM, LS_Color.Green(num))) |
end |
if (strsub(msg, 1, 3) == "max") then |
local num = tonumber(strsub(msg, 4)) |
LS_Options.MaxLevel = num; |
LS_Out.Print(string.format(LS_MINMAXSET2, LS_MAXIMUM, LS_Color.Green(num))) |
end |
if (strsub(msg, 1, 8) == "closewin") then |
local state = strsub(msg, 10) |
if (state == "on") then |
LS_Options.CloseWindows = 1; |
LS_Out.Print(string.format(LS_CLOSEALL, LS_ENABLED)) |
elseif (state == "off") then |
LS_Options.CloseWindows = 0; |
LS_Out.Print(string.format(LS_CLOSEALL, LS_DISABLED)) |
end |
end |
end; |
## Interface: 30000 |
## Version: 1.4.0 |
## Title: LevelSnap |
## Notes: Automatically snaps a screen shot when you level. |
## RequiredDeps: Chronos, Portfolio |
## SavedVariablesPerCharacter: LS_Options |
## Author: Ryan "Gryphon" Snook |
## X-Website: http://www.wowinterface.com/downloads/info5028-LevelSnap.html |
LevelSnap.xml |
-------------------------------------------------- |
-- localization.ru.lua (Russian) |
-- $LastChangedBy$ |
-- $Date$ |
-- Translated: |
if ( GetLocale() == "ruRU" ) then |
-- Please submit your translation to rsnook@gmail.com |
end |
-------------------------------------------------- |
-- localization.es.lua (Spanish) |
-- $LastChangedBy$ |
-- $Date$ |
-- Translated: |
if ( GetLocale() == "esES" ) then |
-- Please submit your translation to rsnook@gmail.com |
end |
-------------------------------------------------- |
-- localization.fr.lua (French) |
-- $LastChangedBy$ |
-- $Date$ |
-- Translated: |
if ( GetLocale() == "frFR" ) then |
-- Please submit your translation to rsnook@gmail.com |
end |
-------------------------------------------------- |
-- localization.us.lua (American English) |
-- $LastChangedBy$ |
-- $Date$ |
-- Translated: Gryphon |
--if ( GetLocale() == "enUS" ) then |
LS_TITLE = "LevelSnap"; |
LS_INFO = "Automatically snaps a screen shot when you level."; |
LS_ENABLED = "Enabled"; |
LS_DISABLED = "Disabled"; |
LS_VERSION = "Version"; |
LS_STATUS = "Status"; |
LS_HIDEUI = "Hide UI"; |
LS_CLOSEWIN = "Close Windows"; |
LS_MAXIMUM = "Maximum"; |
LS_MINIMUM = "Minimum"; |
LS_MINMAXSET2 = "%s level set to %s."; |
LS_SHOWHIDE = "Automatically hide UI is %s."; |
LS_CLOSEALL = "Automatically close all windows %s."; |
LS_HELP_ONOFF = "Enable/Disable LevelSnap."; |
LS_HELP_MIN = "Set the minimum level in which LevelSnap is active."; |
LS_HELP_MAX = "Set the maximum level in which LevelSnap is active."; |
LS_HELP_CLOSEWIN = "Closes all open windows before LevelSnap takes a screen shot."; |
LS_HELP_UI = "Hides the UI when LevelSnap takes a screen shot."; |
LS_HELP_STATUS = "Displays current LevelSnap option settings."; |
LS_HELP_VERSION = "Displays version info."; |
--end |
-------------------------------------------------- |
-- localization.de.lua (German) |
-- $LastChangedBy$ |
-- $Date$ |
-- Translated: |
if ( GetLocale() == "deDE" ) then |
-- Please submit your translation to rsnook@gmail.com |
end |
-------------------------------------------------- |
-- localization.gb.lua (British English) |
-- $LastChangedBy$ |
-- $Date$ |
-- Translated: |
if ( GetLocale() == "enGB" ) then |
-- Please submit your translation to rsnook@gmail.com |
end |
-------------------------------------------------- |
-- localization.tw.lua (Chinese Traditional) |
-- $LastChangedBy$ |
-- $Date$ |
-- Translated: |
if ( GetLocale() == "zhTW" ) then |
-- Please submit your translation to rsnook@gmail.com |
end |
-------------------------------------------------- |
-- localization.kr.lua (Korean) |
-- $LastChangedBy$ |
-- $Date$ |
-- Translated: |
if ( GetLocale() == "koKR" ) then |
-- Please submit your translation to rsnook@gmail.com |
end |
-------------------------------------------------- |
-- localization.cn.lua (Chinese) |
-- $LastChangedBy$ |
-- $Date$ |
-- Translated: |
if ( GetLocale() == "zhCN" ) then |
-- Please submit your translation to rsnook@gmail.com |
end |
<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$ --> |
<!-- Embedded Libs --> |
<Script file="Libs\Chronos\Chronos.lua"/> |
<Script file="Libs\Portfolio\Portfolio.lua"/> |
<!-- Default Localization --> |
<Script file="localization.us.lua"/> |
<!-- Secondary Localizations --> |
<Script file="localization.cn.lua"/> |
<Script file="localization.de.lua"/> |
<Script file="localization.fr.lua"/> |
<Script file="localization.gb.lua"/> |
<Script file="localization.kr.lua"/> |
<Script file="localization.ru.lua"/> |
<Script file="localization.es.lua"/> |
<Script file="localization.tw.lua"/> |
<!-- Scripts --> |
<Script file="LevelSnap.lua"/> |
<Script file="PortfolioRegistration.lua"/> |
<!-- Frames --> |
<Frame name="LevelSnapFrame" hidden="true"> |
<Scripts> |
<OnLoad> |
LS_On.Load(); |
</OnLoad> |
<OnEvent> |
LS_On.Event(event); |
</OnEvent> |
</Scripts> |
</Frame> |
</Ui> |
-- <= == == == == == == == == == == == == => |
-- => Option Registration |
-- <= == == == == == == == == == == == == => |
if (not LevelSnap) then |
LevelSnap = {} |
end |
local Portfolio = LibStub and LibStub("Portfolio") |
if not Portfolio then return end |
local optionTable = { |
id = "LevelSnap"; |
options = { |
{ |
id = "LS_Active"; |
text = LS_ENABLED; |
tooltipText = LS_HELP_ONOFF; |
type = CONTROLTYPE_CHECKBOX; |
defaultValue = "1"; |
callback = function(value) |
LS_Options.Active = value; |
end; |
}; |
{ |
id = "LS_MinLevel"; |
text = LS_MINIMUM; |
tooltipText = LS_HELP_MIN; |
type = CONTROLTYPE_SLIDER; |
minText = "Min", |
maxText = "Max", |
defaultValue = LS_Options.MinLevel; |
minValue = "1"; |
maxValue = "80"; |
valueStep = "1"; |
callback = function(value) |
if (value >= LS_Options.MaxLevel) then |
LS_Options.MaxLevel = value; |
end; |
LS_Options.MinLevel = value; |
end; |
}; |
{ |
id = "LS_MaxLevel"; |
text = LS_MAXIMUM; |
tooltipText = LS_HELP_MAX; |
type = CONTROLTYPE_SLIDER; |
minText = "Min", |
maxText = "Max", |
defaultValue = LS_Options.MaxLevel; |
minValue = "1"; |
maxValue = "80"; |
valueStep = "1"; |
callback = function(value) |
if (value <= LS_Options.MinLevel) then |
LS_Options.MinLevel = value; |
end; |
LS_Options.MaxLevel = value; |
end; |
}; |
{ |
id = "LS_CloseWindows"; |
text = LS_CLOSEWIN; |
tooltipText = LS_HELP_CLOSEWIN; |
type = CONTROLTYPE_CHECKBOX; |
defaultValue = "1"; |
callback = function(value) |
LS_Options.CloseWindows = value; |
end; |
}; |
}; |
savedVarTable = "LS_Options"; |
} |
Portfolio.RegisterOptionSet(optionTable) |