changes to logging

git [04-17-18 - 06:23]
changes to logging
Filename
DailyAutoShare/DASData.lua
DailyAutoShare/DASMenu.lua
DailyAutoShare/DASUserSettingsAdapter.lua
DailyAutoShare/DailyAutoShare.txt
DailyAutoShare/DasGui.lua
DailyAutoShare/DasGuiStringBuilder.lua
DailyAutoShare/locale/en.lua
DailyAutoShare/questData/GuildQuests.lua
DailyAutoShare/questData/Morrowind.lua
DailyAutoShare/startup.lua
diff --git a/DailyAutoShare/DASData.lua b/DailyAutoShare/DASData.lua
index d865809..d7d63da 100644
--- a/DailyAutoShare/DASData.lua
+++ b/DailyAutoShare/DASData.lua
@@ -42,7 +42,7 @@ function PrintZoneId() d(GetZoneId(GetUnitZoneIndex('player'))) end

 function DAS.GetZoneQuests(zoneId)
 	zoneId = zoneId or DAS.GetZoneId()
-    zoneId = DAS.subzones[zoneId] or DAS.festivals[zoneId] or zoneId
+    zoneId = DAS.subzones[zoneId] or zoneId
 	return DAS.shareables[zoneId] or {}
 end

@@ -118,7 +118,7 @@ function DAS.GetActiveQuestNames()
 	local questLabel
 	for i=1, #DAS.labels do
 		questLabel = DAS.labels[i]
-		if (questLabel.dataQuestState == DAS_STATUS_ACTIVE) or (questLabel.dataQuestState == DAS_STATUS_TRACKED) then
+		if not questLabel:IsHidden() and (questLabel.dataQuestState == DAS_STATUS_ACTIVE) or (questLabel.dataQuestState == DAS_STATUS_TRACKED) then
 			table.insert(ret, questLabel.dataQuestName)
 		end
 	end
diff --git a/DailyAutoShare/DASMenu.lua b/DailyAutoShare/DASMenu.lua
index 9b64689..5aaf4cc 100644
--- a/DailyAutoShare/DASMenu.lua
+++ b/DailyAutoShare/DASMenu.lua
@@ -53,7 +53,7 @@ function DAS.CreateMenu(savedVars, defaults)
 		},
 		{ -- checkbox: don't use bingo
 			type    = "checkbox",
-			name    = "Soeak in whole sentences?",
+			name    = "Speak in whole sentences?",
 			tooltip = "While this is optional, you will sound far less ludicrous if you don't talk like a telegram.\nIf you don't know what that is, please get older before unchecking this box.",
 			getFunc = function() return not DAS.GetSpeakStupid() end,
 			setFunc = function(value) DAS.SetSpeakStupid(not value) end
@@ -261,6 +261,16 @@ function DAS.CreateMenu(savedVars, defaults)
 					getFunc = function() return DAS.GetActiveIn(888) end,
 					setFunc = function(value) DAS.SetActiveIn(888, value) end
 				},
+				{ -- checkbox: Fighters Guild dailies?
+					type    = "checkbox",
+					tooltip = "Fighters/Mages Guild and Undaunted dailies? This is work in progress.",
+					name    = "Guild quests?",
+					getFunc = function() return DAS.GetActiveIn(57) end,
+					setFunc = function(value)
+                        DAS.SetActiveIn(57, value)
+                    end
+				},
+
 				{
 					type        = "submenu",
 					name        = "Festivals",
diff --git a/DailyAutoShare/DASUserSettingsAdapter.lua b/DailyAutoShare/DASUserSettingsAdapter.lua
index bf0a1e6..2e7992a 100644
--- a/DailyAutoShare/DASUserSettingsAdapter.lua
+++ b/DailyAutoShare/DASUserSettingsAdapter.lua
@@ -362,7 +362,7 @@ end
 local characterName
 local dateNumber
 local timeStringNumber
-local settings
+local settings = DAS.todaysLog
 local function getSettingsArray()
 	dateNumber		 = dateNumber 		or tonumber(GetDate())
 	characterName 	 = characterName 	or GetUnitName('player')
@@ -375,6 +375,7 @@ local function getSettingsArray()
 	end
 	return settings
 end
+DAS.GetSettingsArray = getSettingsArray
 DAS.lbe = LBE

 function DAS.GetCompleted(questName)
@@ -390,9 +391,14 @@ function DAS.GetCompleted(questName)
 function DAS.LogQuest(questName, completed)
 	if nil == questName then return end
 	local settings 	 	=  getSettingsArray()
-	local afterEight 	= (timeStringNumber > 08)   --08:17:02
+	local afterEight 	= (timeStringNumber > 08) -- 08:17:02
+    for questId, questData in pairs(settings) do
+        if questData.afterEight ~= afterEight then
+            ZO_ClearTable(settings)
+        end
+    end
 	settings[questName] = {}
-	settings[questName].completed	= completed
+	settings[questName].completed  = completed
 	settings[questName].afterEight = afterEight
 end
 function DAS.GetQuestStatus(questName, questList, zoneId)
diff --git a/DailyAutoShare/DailyAutoShare.txt b/DailyAutoShare/DailyAutoShare.txt
index e375e31..6525f98 100644
--- a/DailyAutoShare/DailyAutoShare.txt
+++ b/DailyAutoShare/DailyAutoShare.txt
@@ -36,6 +36,7 @@ locale/$(language).lua
 startup.lua

 questData/BingoClean.lua
+questData/GuildQuests.lua
 questData/Festival.lua
 questData/Wrothgar.lua
 questData/Morrowind.lua
diff --git a/DailyAutoShare/DasGui.lua b/DailyAutoShare/DasGui.lua
index 995855b..9197242 100644
--- a/DailyAutoShare/DasGui.lua
+++ b/DailyAutoShare/DasGui.lua
@@ -153,28 +153,13 @@ local function shouldHideLabel(questName, questList, zoneId)
 	end
 	return false
 end
-
-function DAS.RefreshLabels(forceQuestRefresh, forceSkipQuestRefresh)
-	cacheVisibilityStatus(true)
-	setButtonStates()
-
-    DAS.activeZoneQuests = {}
-	local trackedIndex = 0
-	if QUEST_TRACKER and QUEST_TRACKER.assistedData then
-		trackedIndex = QUEST_TRACKER.assistedData.arg1
-	end
-
-	local buttonIndex = 1
-
-	local hideCompleted = DAS.GetHideCompleted()
-	local hidden 		= DasList:IsHidden()
-	local label, questIndex, tracked
-	if not forceSkipQuestRefresh then
-		DAS.RefreshQuestLogs(forceQuestRefresh)
-	end
-	local zoneId = DAS.GetZoneId()
-	local questList = DAS.QuestLists[zoneId]
-	for index, questName in pairs(DAS.GetZoneQuests()) do
+local typeTable = "table"
+function DAS.setLabels(zoneQuests, questList, buttonIndex)
+
+	for index, questName in pairs(zoneQuests) do
+        if type(questName) == typeTable then
+            return DAS.setLabels(questName, questList, buttonIndex)
+        end
 		label = DAS.labels[buttonIndex] -- despite the name these are actually buttons

 		if nil ~= label then
@@ -209,6 +194,33 @@ function DAS.RefreshLabels(forceQuestRefresh, forceSkipQuestRefresh)
 		end -- nil check end

 	end -- for loop end
+
+    return buttonIndex
+end
+
+function DAS.RefreshLabels(forceQuestRefresh, forceSkipQuestRefresh)
+	cacheVisibilityStatus(true)
+	setButtonStates()
+
+    DAS.activeZoneQuests = {}
+	local trackedIndex = 0
+	if QUEST_TRACKER and QUEST_TRACKER.assistedData then
+		trackedIndex = QUEST_TRACKER.assistedData.arg1
+	end
+
+	local buttonIndex = 1
+
+	local hideCompleted = DAS.GetHideCompleted()
+	local hidden 		= DasList:IsHidden()
+	local label, questIndex, tracked
+	if not forceSkipQuestRefresh then
+		DAS.RefreshQuestLogs(forceQuestRefresh)
+	end
+	local zoneId = DAS.GetZoneId()
+	local questList = DAS.QuestLists[zoneId]
+    local zoneQuests = DAS.GetZoneQuests()
+
+    buttonIndex = DAS.setLabels(zoneQuests, questList, 1)


 	for buttonIndex=#DAS.GetZoneQuests()+1, #DAS.labels do
diff --git a/DailyAutoShare/DasGuiStringBuilder.lua b/DailyAutoShare/DasGuiStringBuilder.lua
index eeafa7a..d3772ea 100644
--- a/DailyAutoShare/DasGuiStringBuilder.lua
+++ b/DailyAutoShare/DasGuiStringBuilder.lua
@@ -77,27 +77,27 @@ local function GenerateBingoString(activeQuestNames, verbose)
 	activeQuestNames = getEnglishQuestNames(activeQuestNames)

 	local bingoCodes = {}
-	local ret = ""
+	local bingo, questNames = "", ""
     local bingoString = (DAS.fullBingoString or ""):gsub("%+any", "")
 	if DAS.GetAutoInvite() then
-        ret = "I can give a DailyAutoShare for "
-
+        local questCount = 0
 		for _, questName in ipairs(activeQuestNames) do
+            questCount = questCount +1
 			if DAS.IsQuestActive(questName) then
-				ret = ret .. questName .. ", "
+				questNames = questNames .. questName .. ", "
 			end
 		end
         if #DAS.fullBingoString > 0 then
-			ret = ret .. "type " .. ((#activeQuestNames >1 and "either of ") or "") .. bingoString .. "for an instant invite"
+            bingo = ((#activeQuestNames > 1 and "either of ") or "") .. bingoString
 		end
-        return ret
+        return zo_strformat(DAS.GetSettings().questShareString, questNames, bingoString)
     end

     if NonContiguousCount(DAS.GetShareableLog()) == 0 and #activeQuestNames == 0 then
-        return (verbose and GetString(DAS_SI_VERBOSE_ANY)) or "+any"
+        return "+any"
     end
     activeQuestNames = DAS.GetOpenQuestNames()
-    return ret .. ((verbose and "Looking for " .. askForQuest(activeQuestNames)) or "") .. generateQuestSpam(activeQuestNames)
+    return generateQuestSpam(activeQuestNames)

 end
 DAS.GenerateBingoString = GenerateBingoString
diff --git a/DailyAutoShare/locale/en.lua b/DailyAutoShare/locale/en.lua
index c98f50d..60fab5c 100644
--- a/DailyAutoShare/locale/en.lua
+++ b/DailyAutoShare/locale/en.lua
@@ -155,8 +155,11 @@ local strings  = {

     DAS_QUEST_DB_ARVINA     = "Cleric Arvina",

-    DAS_QUEST_DB_BOUNTY     = "Bounty Board",
+    DAS_QUEST_DB_BOUNTY     = "Bounty Board",

+    DAS_QUEST_CAP_CARDEA    = "Cardea Gallus",
+    DAS_QUEST_CAP_ALVUR     = "Alvur Baren",
+    DAS_QUEST_CAP_BOLGRUL   = "Bolgrul",

     -- don't need translation for anyone but the russians - I think

diff --git a/DailyAutoShare/questData/GuildQuests.lua b/DailyAutoShare/questData/GuildQuests.lua
new file mode 100644
index 0000000..21143f0
--- /dev/null
+++ b/DailyAutoShare/questData/GuildQuests.lua
@@ -0,0 +1,37 @@
+DAS.shareables 	        = DAS.shareables    or {}
+DAS.bingo 		        = DAS.bingo 	    or {}
+DAS.questFinisher       = DAS.questFinisher    or {}
+DAS.questStarter        = DAS.questStarter     or {}
+
+local zoneId    = 57    -- Deshaan
+local zoneId2   = 19    -- Stormhaven
+local zoneId3   = 383   -- Grahtwood
+
+DAS.shareables[zoneId] = {
+
+}
+DAS.shareables[zoneId2] = DAS.shareables[zoneId]
+DAS.shareables[zoneId3] = DAS.shareables[zoneId]
+
+DAS.bingo[zoneId]       = {
+
+}
+DAS.bingo[zoneId2]      = DAS.bingo[zoneId]
+DAS.bingo[zoneId3]      = DAS.bingo[zoneId]
+
+
+DAS.questStarter[zoneId] = {
+    [GetString(DAS_QUEST_CAP_CARDEA)]     = true,   -- Cardea Gallus,   FG
+    [GetString(DAS_QUEST_CAP_ALVUR)]      = true,   -- Alvur Baren,     MG
+    [GetString(DAS_QUEST_CAP_BOLGRUL)]    = true,   -- Bolgrul,         UD
+}
+DAS.questStarter[zoneId2] = DAS.questStarter[zoneId]
+DAS.questStarter[zoneId3] = DAS.questStarter[zoneId]
+
+DAS.questFinisher[zoneId] = {
+    [GetString(DAS_QUEST_CAP_CARDEA)]     = true,   -- Cardea Gallus,   FG
+    [GetString(DAS_QUEST_CAP_ALVUR)]      = true,   -- Alvur Baren,     MG
+    [GetString(DAS_QUEST_CAP_BOLGRUL)]    = true,   -- Bolgrul,         UD
+}
+DAS.questFinisher[zoneId2] = DAS.questFinisher[zoneId]
+DAS.questFinisher[zoneId3] = DAS.questFinisher[zoneId]
\ No newline at end of file
diff --git a/DailyAutoShare/questData/Morrowind.lua b/DailyAutoShare/questData/Morrowind.lua
index 5054974..0fd4b47 100644
--- a/DailyAutoShare/questData/Morrowind.lua
+++ b/DailyAutoShare/questData/Morrowind.lua
@@ -62,7 +62,7 @@ table.insert(tbl2, {[1] ="nil", [2] = "nilthog", [3] = "oxen"})
 table.insert(tbl, GetString(DAS_M_BOSS_SALOT))
 table.insert(tbl2, {[1] ="salo", [2] = "salothan", [3] = "sal"})
 table.insert(tbl, GetString(DAS_M_BOSS_SIREN))
-table.insert(tbl2, {[1] ="siren", [2] = "song", [3] = "songbird", [4] = "ss"})
+table.insert(tbl2, {[1] ="siren", [2] = "song", [3] = "songbird", [4] = "ss", [5] = "sirene"})
 table.insert(tbl, GetString(DAS_M_BOSS_APPRE))
 table.insert(tbl2, {[1] = "dub", [2] = "dubdil" })

diff --git a/DailyAutoShare/startup.lua b/DailyAutoShare/startup.lua
index c8eab59..a3af906 100644
--- a/DailyAutoShare/startup.lua
+++ b/DailyAutoShare/startup.lua
@@ -135,6 +135,10 @@ local function pointerUpSubzones()
     -- Gold Coast
     defaults[825]                       = defaults[823]

+    -- Capitals
+    defaults[19]                       = defaults[57]
+    defaults[383]                      = defaults[57]
+
     -- Clockwork City
     defaults[981]                       = defaults[980]
     defaults[981]                       = defaults[980]
@@ -304,9 +308,7 @@ local function OnQuestToolUpdate()
 	DAS.RefreshControl(true)
 end

-local function resetQuests()
-    DAS.handleLog(true)
-end
+

 local function OnQuestRemoved(eventCode, isCompleted, journalIndex, questName, zoneIndex, poiIndex, questId)

@@ -375,37 +377,41 @@ local function RegisterEventHooks()
 	-- DailyAutoShare.SaveControlLocation(self)
 end

+local currentDate = tonumber(GetDate())
+local function resetQuests()
+    DAS.todaysLog = {}
+    DAS.globalSettings.completionLog[currentDate] = DAS.todaysLog
+    DAS.RefreshControl(true)
+end
+
 local function handleLog(forceReset)

-    local currentDate = tonumber(GetDate())
-    if forceReset then
-        DAS.globalSettings.completionLog[currentDate] = {}
-        DAS.RefreshControl(true)
-        return
+    local afterEight = tonumber(GetTimeString():sub(0, 2)) >= 08 -- has to be a local var, lua error if not
+    DAS.todaysLog = DAS.globalSettings.completionLog[currentDate] or {}
+    local lastDate, logSize, counter = _, NonContiguousCount(DAS.todaysLog), 0
+
+    if forceReset then
+        return resetQuests()
     end

-    local afterEight = tonumber(GetTimeString():sub(0, 2)) >= 08
-    local lastDate
-    local completionLog = DAS.globalSettings.completionLog or {}
-    local logSize = NonContiguousCount(completionLog)
-    local counter = 0
-    for dateString, dateLog in pairs(completionLog) do
-        counter = counter +1
-        if counter < logSize -2 and dateString < currentDate then
+    for dateString, dateLog in pairs(DAS.todaysLog) do
+        counter = counter + 1
+        if counter < logSize-2 and dateString < currentDate then
             DAS.globalSettings.completionLog[dateString] = nil
         else
             lastDate = dateString
         end
     end
-    if not afterEight then
-        DAS.globalSettings.completionLog[currentDate] = DAS.globalSettings.completionLog[dateString]
+
+    if (not afterEight) and DAS.todaysLog == {} and lastDate ~= dateString then
+        DAS.todaysLog = DAS.globalSettings.completionLog[lastDate]
     end
-    DAS.globalSettings.completionLog = completionLog
+    DAS.globalSettings.completionLog[currentDate] = DAS.todaysLog
 end
 DAS.handleLog = handleLog

 local function minimiseOnStartup()
-	DasList:SetHidden(DAS.GetSettings().startupMinimized)
+	DAS.SetMinimized(DAS.GetSettings().startupMinimized)
 end
 --==============================
 --===== Rise, my minion!  ======
@@ -432,9 +438,9 @@ function DailyAutoShare_Initialize(eventCode, addonName)
         DAS.GetSettings().questShareString = defaults.questShareString
     end

+    handleLog()
     zo_callLater(OnPlayerActivated, 5000)
     zo_callLater(minimiseOnStartup, 5500)
-    -- handleLog()
 	EVENT_MANAGER:UnregisterForEvent("DailyAutoShare", EVENT_ADD_ON_LOADED)

 end