-- @Author: Cody Smith -- @Date: 2015-08-11 12:49:48 -- @Last Modified by: Cody Smith -- @Last Modified time: 2015-08-11 13:51:47 local LAM2 = LibStub("LibAddonMenu-2.0") local GNM = {} GNM.Defaults = {} function getSavedNotes(playername) --access save table and return table of notes only neccesary for double checking that we have information saved. -- do some checking to make sure that our gid hasn't changed first and fix tables around if it did local table = {} if savedtable[GNM.gid].name == nil then --TODO: finish this. Check guild names and gids against items in db end function readNotes(playername) local tbl = {} local numGuildMembers = GetNumGuildMembers(GNM.gid) for i = 1, numGuildMembers do local name,note,rankIndex = GetGuildMemberInfo(GNM.gid, i) if name == playername then tbl = parseNotes(note) end end return tbl end function saveNotes(table,playername) --save any notes in our table of notes end function parseNotes(noteString) local tbl = {} for k,v in string.gmatch(noteString,"([^[]+):([^]]+)") do tbl[k] = v end return tbl end local function dateRecruited() --get current date and build our string to add to the notes. end local function onMemberAdd(eventCode, guildId, DisplayName) if guildId == GNM.gid then local notes = readNotes(DisplayName) if notes ~= "" then --operate on notes end end end ---------------------LAM 2.0 SETTINGS-------------------------- local function CreateSettingsMenu() local colorYellow = "|cFFFF22" local panelData = { type = "panel", name = "Guild Note Manager", displayName = colorYellow.."Talen-Shei's Guild Note Manager", author = "Talen-Shei", version = GNM.CODE_VERSION, slashCommand = "/gnm", registerForRefresh = true, registerForDefaults = true, } local cntrlOptionsPanel = LAM2:RegisterAddonPanel("GNM_Options", panelData) optionsData = { [1] = { type = "header", name = colorYellow.."Loading", width = "full", }, [2] = { type = "description", text = "A Tool to manage guild notes and automated deletion.", }, } LAM2:RegisterOptionControls("GNM_Options", optionsData) end local function Initialize() --set up settings files and such end local function OnLoad(event,addon) if addon ~= "GuildNoteManager" then return end Initialize() CreateSettingsMenu() EVENT_MANAGER:RegisterForEvent(EVENT_GUILD_MEMBER_ADDED, onMemberAdd) end EVENT_MANAGER:RegisterForEvent("GuildNoteManager", EVENT_ADD_ON_LOADED, OnLoad)