Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local frame = CreateFrame("FRAME", "FooAddonFrame");
- frame:RegisterEvent("PLAYER_LOGIN");
- frame:RegisterEvent("PLAYER_LOGOUT");
- local function eventHandler(self, event, ...)
- -- If the player is logging off, turn on the new models
- if event == "PLAYER_LOGOUT" then
- SetCVar("hdPlayerModels", 1);
- -- If the player is logging on, turn off the new models
- elseif event == "PLAYER_LOGIN" then
- SetCVar("hdPlayerModels", 0)
- end
- end
- frame:SetScript("OnEvent", eventHandler);
- local db; -- File-global handle to the Database
- local defaults = {
- profile = {
- LDBIconStorage = {}, -- LibDBIcon storage
- },
- };
- local ldbObject = {
- type = "launcher",
- icon = "Interface\\ICONS\\INV_MISC_FILM_01",
- --This is the icon used. Any .blp or .tga file is a valid icon.
- --This path is ALWAYS relative to the World of Warcraft
- --root (ie, "C:\Program Files\World of Warcraft" for
- --Windows and "/Applications/World of Warcraft" for Mac)
- label = "CharModFix",
- OnClick = function(self, button)
- -- Add a click handler here
- SetCVar("hdPlayerModels",1-GetCVar("hdPlayerModels"))
- end,
- OnTooltipShow = function(tooltip)
- tooltip:AddLine("Toggle Character Model");
- --Add text here. The first line is ALWAYS a "header" type.
- --It will appear slightly larger than subsequent lines of text
- end,
- };
- function updateDB(self, event, database)
- db = database.profile;
- LibStub("LibDBIcon-1.0"):Refresh("AddonLDBObjectName", db.LDBIconStorage);
- end
- local vars = LibStub("AceDB-3.0"):New("AddonSavedVarStorage", defaults);
- vars:RegisterCallback("OnProfileChanged", updateDB);
- vars:RegisterCallback("OnProfileCopied", updateDB);
- vars:RegisterCallback("OnProfileReset", updateDB);
- db = vars.profile;
- LibStub("LibDataBroker-1.1"):NewDataObject("AddonLDBObjectName", ldbObject);
- LibStub("LibDBIcon-1.0"):Register("AddonLDBObjectName", ldbObject, db.LDBIconStorage);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement