-- Addon: !AutoSave (version: 1.12.1) -- Autor: Platine (e-mail: platine.wow@gmail.com) -- Localization local AS_Messages = { loaded ="loaded.", -- loaded. saved ="Saved the form.", -- Character saved. active ="Enable AutoSave features", -- Enable AutoSave confirme="View your record", -- Print confirmation period ="Entry in the interval [sec]", -- Save-interval in [sec] combat ="Save the output from the fight", -- Run on exit of combat skill ="Sign in skills after promotion", -- Run on skill-up quest ="Save this post", -- Run on quest completed close ="Close", -- Close the window AFK_on ="You are now AFK: Away from Keyboard", -- System message from event CHAT_MSG_SYSTEM AFK_off ="You are no longer AFK." }; -- Global Variables local AutoSave_LastTime = GetTime(); -- last time made a record local AutoSave_MinimPeriod = 100; -- protection against excessively high burden on the server local AutoSave_PutSave = false; local AutoSave_AFKtime = false; local AutoSave_InCombat = false; local AS_OnDebug = false; function AS_OnLoad() SLASH_AUTOSAVE1 = "/autosave"; SLASH_AUTOSAVE2 = "/as"; SlashCmdList["AUTOSAVE"] = AS_OnShow; this:RegisterEvent("ADDON_LOADED"); this:RegisterEvent("PLAYER_REGEN_ENABLED"); this:RegisterEvent("PLAYER_REGEN_DISABLED"); this:RegisterEvent("CHAT_MSG_SAY"); this:RegisterEvent("CHAT_MSG_SKILL"); this:RegisterEvent("CHAT_MSG_SYSTEM"); this:RegisterEvent("PLAYER_LEVEL_UP"); this:RegisterEvent("PLAYER_TARGET_CHANGED"); this:RegisterEvent("QUEST_COMPLETE"); this:RegisterEvent("UNIT_AURA"); end function AS_OnEvent() if ((event == "ADDON_LOADED") and (arg1 == "!AutoSave")) then -- dodatek zaladowano AS_CheckVars(); if (DEFAULT_CHAT_FRAME) then DEFAULT_CHAT_FRAME:AddMessage("|cffffff00!AutoSave ver. 1.12.1 - "..AS_Messages.loaded); else UIErrorsFrame:AddMessage("!AutoSave ver. 1.12.1 - "..AS_Messages.loaded, 1.0, 1.0, 1.0, 1.0, UIERRORS_HOLD_TIME); end end if (AutoSave_PC["check1"]=="on") then -- działanie dodatku jest zezwolone if (GetTime()