Added more stuffs. Still a bit confused.

Talen-Shei [08-12-15 - 00:01]
Added more stuffs. Still a bit confused.
Filename
AutomatedGuildManager.lua
diff --git a/AutomatedGuildManager.lua b/AutomatedGuildManager.lua
index 5ec77a6..525a01c 100644
--- a/AutomatedGuildManager.lua
+++ b/AutomatedGuildManager.lua
@@ -1,7 +1,7 @@
 -- @Author: Cody Smith
 -- @Date:   2015-08-11 12:49:48
 -- @Last Modified by:   Cody Smith
--- @Last Modified time: 2015-08-11 15:46:35
+-- @Last Modified time: 2015-08-11 16:59:13
 local LAM2 = LibStub("LibAddonMenu-2.0")

 local AGM = {}
@@ -16,6 +16,7 @@ AGM.Defaults.Account.gid = 1
 AGM.Defaults.Account.Notes = {}
 AMG.ValidNotes = {}
 AGM.ValidNotes.Recruited = "Date Recruited"
+AGM.Account.ValidRanks = {}


 function getSavedNotes(playername)
@@ -50,20 +51,21 @@ function parseNotes(noteString)
 	return tbl
 end

-local function dateRecruited()
+local function dateRecruited(memberID)
 	local date = os.time("%x")
 	local str = "["..AGM.ValidNotes.Recruited..":"..date"]"
 	--get current date and build our string to add to the notes.
 	return str
 end

-local function onMemberAdd(eventCode, guildId, DisplayName)
+local function onMemberAdd(eventCode, guildId, DisplayName,vald)
+	d(eventCode.."  :  "..guildId.."  :  "..DisplayName.."  :  "..vald)
 	if guildId == AGM.Account.gid then
 		local notes = readNotes(DisplayName)
 		if notes ~= "" then
 			--operate on notes
 		else
-			notes = dateRecruited()
+			notes = dateRecruited(guildId)
 			d(notes)
 		end
 	end
@@ -87,6 +89,32 @@ function listGuilds()
 	AGM.Account.Guilds = tbl
 	return tbl
 end
+
+function populateRanks()
+	local gid = AGM.Account.gid
+	local numRanks = GetNumGuildRanks(gid)
+	local tbl = {}
+	for i=1, numRanks do
+		rname = GetGuildRankCustomName(gid,i)
+		tbl[i] = rname
+	end
+	AGM.Account.ValidRanks = tbl
+end
+
+function getGuildMemberIndexByName(displayName)
+	local num = GetNumGuildMembers(AGM.Account.gid)
+	for i = 1, num do
+		local name,note,rankIndex = GetGuildMemberInfo(i)
+		if name == displayName then
+			return i
+		end
+	end
+end
+
+function addNote()
+	--validate that this note is not already there then add
+end
+
 ---------------------LAM 2.0 SETTINGS--------------------------

 local function CreateSettingsMenu()
@@ -115,16 +143,16 @@ local function CreateSettingsMenu()
 			type = "description",
 			text = "A Tool to manage guild notes and automated deletion.",
 		},
-		[4] = {
+		[3] = {
 			type = "dropdown",
 			name = "Guild",
 			choices = AGM.Account.Guilds,
-			tooltip = "Profile to load/save to",
+			tooltip = "Guild to manage",
 			sort = "name-up",
-			reference = "KBSProfiles",
+			reference = "AGMGuild",
 			default = AGM.Account.Guilds[AGM.Account.gid],
 			getFunc = function() local Guild = AGM.Accounts.Guilds[AGM.Account.gid] return Guild end,
-			setFunc = function(bValue) setBindingTarget(bValue) end,
+			setFunc = function(bValue) setGuild(bValue) end,
 			 -- KBS.Character.BindingTarget = bValue end,
 		},
 	}