an error fix

git [06-02-18 - 07:02]
an error fix
Filename
00_startup.lua
DASData.lua
DASHelper.lua
DASUserSettingsAdapter.lua
DasChatMessage.lua
DasTooltip.lua
libs/LibCustomTitles/LibCustomTitles.lua
questData/Summerset.lua
diff --git a/00_startup.lua b/00_startup.lua
index 9aab11b..ffb85cb 100644
--- a/00_startup.lua
+++ b/00_startup.lua
@@ -1,8 +1,7 @@
 DailyAutoShare              = DailyAutoShare or {}
 DAS                         = DailyAutoShare
-local DailyAutoShare        = DailyAutoShare

-DAS.name                    = "DailyAutoshare"
+DAS.name                    = "DailyAutoShare"
 DAS.version                 = "3.3.1"
 DAS.author                  = "manavortex"
 DAS.settings                = {}
@@ -38,6 +37,8 @@ local activeInCurrentZone   = false
 DAS.fullBingoString         = ""
 local fullBingoString       = DAS.fullBingoString

+UNITTAG_PLAYER              = UNITTAG_PLAYER or "player"
+
 local defaults = {

 	["singleDailies"]               = {},
@@ -129,7 +130,7 @@ local defaults = {
 	listenInGuilds,
     whisperOnly                 = false,
     whisperString               = "whisper + for an instant invite",
-    ["tracked"] = {
+    tracked = {
 		[684] = true,
 		[823] = true,
 		[849] = true,	    -- Vvardenfell
@@ -208,7 +209,7 @@ local function pointerUpSubzones()
 end
 pointerUpSubzones()

-local characterName     = zo_strformat(GetUnitName('player'))
+local characterName     = zo_strformat(GetUnitName(UNITTAG_PLAYER))

 local allDailyQuestIds = DAS_QUEST_IDS

@@ -245,7 +246,7 @@ end
 --==============================

 local function OnGroupTypeChanged(eventCode, unitTag)
-	if IsUnitGrouped("player") then
+	if IsUnitGrouped(UNITTAG_PLAYER) then
         if not DAS.GetAutoShare() and DAS.GetResetAutoShareOnNewGroup() then
             DAS.SetAutoShare(true)
         end
@@ -415,9 +416,10 @@ end
 -- Keep outside of function namespace so we can overwrite it for debugging
 local afterEight = tonumber(GetTimeString():sub(0, 2)) >= 08
 local function handleLog(forceReset)
+    DAS.globalSettings.completionLog = DAS.globalSettings.completionLog or {}
     local allLogs = DAS.globalSettings.completionLog
     local currentDate = tonumber(GetDate())
-    DAS.globalSettings.completionLog[currentDate] = DAS.globalSettings.completionLog[currentDate] or {}
+    allLogs[currentDate] = allLogs[currentDate] or {}

     local logSize, lastDate = NonContiguousCount(DAS.globalSettings.completionLog)

@@ -458,16 +460,16 @@ end

 function DailyAutoShare_Initialize(eventCode, addonName)

-	if addonName ~="DailyAutoShare" then return end
+	if addonName ~= DAS.name then return end

-	DailyAutoShare.settings = ZO_SavedVars:New("DAS_Settings", 0.2, nil, defaults)
-	DailyAutoShare.globalSettings = ZO_SavedVars:NewAccountWide("DAS_Globals", 0.2, "DAS_Global", defaults)
-    DAS.pdn = GetUnitDisplayName('player')
+	DAS.settings        = ZO_SavedVars:New("DAS_Settings", 1, "DAS_Settings", defaults)
+	DAS.globalSettings  = ZO_SavedVars:NewAccountWide("DAS_Globals", 1, "DAS_Global", defaults)
+    DAS.pdn = GetUnitDisplayName(UNITTAG_PLAYER)

 	RegisterEventHooks()

-	DailyAutoShare.CreateMenu(DailyAutoShare.settings, defaults)
-	DAS.CreateGui()
+	DAS.CreateMenu(DAS.settings, defaults)
+	DAS.CreateGui()

     -- local timetoreset = (GetTimeStamp() - 60*60*7)%86400
     -- zo_callLater(resetQuests, timetoreset)
diff --git a/DASData.lua b/DASData.lua
index 9677541..383cf0b 100644
--- a/DASData.lua
+++ b/DASData.lua
@@ -38,8 +38,8 @@ DAS.festivals = {
 }


-function DAS.GetZoneId() return GetZoneId(GetUnitZoneIndex('player')) or 0 end
-function PrintZoneId() d(GetZoneId(GetUnitZoneIndex('player'))) end
+function DAS.GetZoneId() return GetZoneId(GetUnitZoneIndex(UNITTAG_PLAYER)) or 0 end
+function PrintZoneId() d(GetZoneId(GetUnitZoneIndex(UNITTAG_PLAYER))) end

 function DAS.GetZoneQuests(zoneId)
 	zoneId = zoneId or DAS.GetZoneId()
diff --git a/DASHelper.lua b/DASHelper.lua
index c6930d8..e32a516 100644
--- a/DASHelper.lua
+++ b/DASHelper.lua
@@ -45,7 +45,7 @@ DAS.RefreshQuestLogs = refreshQuestLogs

 function DAS.TryDisableAutoShare(fromName, messageText)
 	if type(messageText) ~= "string" then return false end
-	if (DAS.IsMatch(messageText, GetUnitName('player'))
+	if (DAS.IsMatch(messageText, GetUnitName(UNITTAG_PLAYER))
 	or (DAS.IsMatch(messageText, DAS.GetBingoStringFromQuestName():gsub("+", ""))
 	and DAS.IsMatch(messageText "sharing")))
 	then
diff --git a/DASUserSettingsAdapter.lua b/DASUserSettingsAdapter.lua
index e46e30b..928a68d 100644
--- a/DASUserSettingsAdapter.lua
+++ b/DASUserSettingsAdapter.lua
@@ -1,5 +1,5 @@
 local DAS               = DailyAutoShare
-local groupTagPlayer    = "player"
+local groupTagPlayer    = UNITTAG_PLAYER

 -- called from settings
 function DAS.GetUseGlobalSettings()
@@ -170,7 +170,7 @@ function DAS.GetAutoInvite()
 end
 function DAS.SetAutoInvite(value)

-    value = value and IsUnitSoloOrGroupLeader('player') and DAS.HasActiveDaily()
+    value = value and IsUnitSoloOrGroupLeader(UNITTAG_PLAYER) and DAS.HasActiveDaily()

 	GetSettings().autoInvite = value
     DAS.autoInviting = value
@@ -181,11 +181,13 @@ end
 -- called from settings and from internal helper
 function DAS.GetActiveIn(zoneIndex)
     zoneIndex = zoneIndex or DAS.GetZoneId()
+    if not zoneIndex then return end
 	zoneIndex = DAS.subzones[zoneIndex] or zoneIndex
-	return GetSettings()["tracked"][zoneIndex]
+	return GetSettings().tracked[zoneIndex]
 end
-function DAS.SetActiveIn(zoneIndex, value)
-	if (nil == zoneIndex) then zoneIndex = DAS.GetZoneId() end
+function DAS.SetActiveIn(zoneIndex, value)
+    zoneIndex = zoneIndex or DAS.GetZoneId()
+    if not zoneIndex then return end
 	GetSettings()["tracked"][zoneIndex] = value
 	zo_callLater(function() DailyAutoShare.RefreshGui(not DAS.GetActiveIn()) end, 500)
 end
@@ -362,7 +364,7 @@ local function assertSettingArray(settings, dateNumber, characterName)

 	local dateNumber = tonumber(GetDate()) -- 20160411
 	local afterEight = (tonumber(GetTimeString():sub(0, 2)) >= 08) --08:17:02
-	local characterName = GetUnitName('player')
+	local characterName = GetUnitName(UNITTAG_PLAYER)
 	if nil == settings[dateNumber] then settings[dateNumber] = {} end
 	if nil == settings[dateNumber][characterName] then settings[dateNumber][characterName] = {} end

@@ -386,7 +388,7 @@ local timeStringNumber
 local settings = DAS.todaysLog
 local function getSettingsArray()
 	dateNumber		 = dateNumber 		or tonumber(GetDate())
-	characterName 	 = characterName 	or GetUnitName('player')
+	characterName 	 = characterName 	or GetUnitName(UNITTAG_PLAYER)
 	timeStringNumber = timeStringNumber or tonumber(GetTimeString():sub(1,2))
 	if nil == settings then
 		DAS.globalSettings.completionLog = DAS.globalSettings.completionLog or {}
diff --git a/DasChatMessage.lua b/DasChatMessage.lua
index e658d4c..273c7f3 100644
--- a/DasChatMessage.lua
+++ b/DasChatMessage.lua
@@ -1,5 +1,5 @@
 local messageQueue              = {}
-local unittagplayer             = 'player'
+local unittagplayer             = UNITTAG_PLAYER
 local share                     = "share"
 local stopsharing               = "stop sharing"

diff --git a/DasTooltip.lua b/DasTooltip.lua
index e2056d5..495aa7b 100644
--- a/DasTooltip.lua
+++ b/DasTooltip.lua
@@ -72,7 +72,7 @@ function DAS.CreateLabelTooltip(control)
     else
         local state = DAS.GetCompleted(questName)
         if control.dataQuestState == DAS_STATUS_COMPLETE then
-            tooltipText = (questName .. " completed today with " .. GetUnitName('player'))
+            tooltipText = (questName .. " completed today with " .. GetUnitName(UNITTAG_PLAYER))
         else
             local bingoString = control["dataBingoString"] or ""
             local bingoTooltip = (bingoString ~= "" and "\n The bingo code is " .. bingoString) or ""
diff --git a/libs/LibCustomTitles/LibCustomTitles.lua b/libs/LibCustomTitles/LibCustomTitles.lua
index 441c396..9d9e817 100644
--- a/libs/LibCustomTitles/LibCustomTitles.lua
+++ b/libs/LibCustomTitles/LibCustomTitles.lua
@@ -541,7 +541,7 @@ function LibCustomTitles:Init()
 	GetTitle = function(index)
 		local titleOriginal = GetTitle_original(index)
 		local displayName = GetDisplayName()
-		local characterName = GetUnitName("player")
+		local characterName = GetUnitName(UNITTAG_PLAYER)
 		local registerType = GetCustomTitleType(displayName, characterName)
 		if registerType ~= CT_NO_TITLE then
 			return GetModifiedTitle(titleOriginal, displayName, characterName, registerType)
diff --git a/questData/Summerset.lua b/questData/Summerset.lua
index c75bd50..118cda8 100644
--- a/questData/Summerset.lua
+++ b/questData/Summerset.lua
@@ -8,7 +8,7 @@ local tbl2 = {}


 table.insert(tbl, GetString(DAS_ELF_ALCHE))
-table.insert(tbl2, {[1] = "welenkin",  [2] = "korgen"})
+table.insert(tbl2, {[1] = "welenkin",  [2] = "korgen", [3] = "korg"})
 table.insert(tbl, GetString(DAS_ELF_GRAVE))
 table.insert(tbl2, {[1] = "graveld",  [2] = "grave"})
 table.insert(tbl, GetString(DAS_ELF_QUEEN))