1. #1

    [Development] Good practices

    I'm looking for some guides or good practices on how to handle multiple profiles (to be working correctly with reflux) and adding your addon options to default blizzard addon panel. Anyone can point me in correct direction? Cheers.


    Quote Originally Posted by Lich King
    "You speak of justice? Of cowardice? I will show you the justice of the grave... and the true meaning of fear."

  2. #2
    Deleted
    AceDB can be used to handle profiles in a pretty simple way and is also automatically supported by reflux.

  3. #3
    Quote Originally Posted by Treeston View Post
    AceDB can be used to handle profiles in a pretty simple way and is also automatically supported by reflux.
    Is there any standardized way to handle multiple profiles? I have seen many addon where their profile page looks exactly the same and I was wondering if it comes from usage of some common coding pattern?


    Quote Originally Posted by Lich King
    "You speak of justice? Of cowardice? I will show you the justice of the grave... and the true meaning of fear."

  4. #4
    Deleted
    That's AceConfigDialog-3.0, which AceDBOptions-3.0 can generate a profile select page for.

    Code:
    local defaults={profile={
        -- your defaults
    }}
    YourAddonObject.options = { -- this is an AceConfig-3.0 option table
        type="group",
        args={
        },
    }
    function YourAddonObject:OnProfileEnable()
        -- here you do stuff that you want to re-do when a new profile is loaded, f.e. positioning frames etc.
    end
    
    YourAddonObject:SetScript("OnEvent",function(self,event,arg1)
        if event == "ADDON_LOADED" and arg1 == "AddonFolderName" then
            self.db = LibStub("AceDB-3.0"):new("MySavedVar",defaults or {})
            self.db.RegisterCallback(self,"OnProfileChanged","OnProfileEnable")
            self.db.RegisterCallback(self,"OnProfileCopied","OnProfileEnable")
            self.db.RegisterCallback(self,"OnProfileReset","OnProfileEnable")
            self.opt = self.db.profile -- you'll use self.opt to access your current profile config
            self.options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db) -- this is where the options page is generated
            self.options.args.profiles.order = -1 -- set it to be the last page
            LibStub("AceConfig-3.0"):RegisterOptionsTable("YourAddonName", self.options)
            SlashCmdList["YOURADDON"]=function(input)
                LibStub("AceConfigDialog-3.0"):Open("YourAddonName")
            end
            SLASH_YOURADDON1 = "/yourslashcommand"
        end
    end)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •