diff --git a/00_startup.lua b/00_startup.lua index 8fcdb8e..6cf2b47 100644 --- a/00_startup.lua +++ b/00_startup.lua @@ -2,15 +2,15 @@ DailyAutoShare = DailyAutoShare or {} DAS = DailyAutoShare DAS.name = "DailyAutoShare" -DAS.version = "3.51" +DAS.version = "3.6" DAS.author = "manavortex" DAS.settings = {} DAS.globalSettings = {} -DAS.shareables = {} -DAS.bingo = {} +DAS.shareables = {} +DAS.bingo = {} DAS.bingoFallback = {} -DAS.subzones = {} +DAS.subzones = {} DAS.activeZoneQuests = {} DAS.questFinisher = {} @@ -18,7 +18,8 @@ DAS.questStarter = {} DAS.questIds = {} DAS.activeBingoIndices = {} DAS.prequests = {} -DAS.channelTypes = { + +DAS.channelTypes = { [CHAT_CHANNEL_PARTY] = true, [CHAT_CHANNEL_SAY ] = false, [CHAT_CHANNEL_YELL] = false, @@ -26,14 +27,14 @@ DAS.channelTypes = { [CHAT_CHANNEL_WHISPER] = true, } -DAS.locale = GetCVar("language.2") -DAS.autoInviting = false -DAS.guildInviteText = nil +DAS.locale = GetCVar("language.2") +DAS.autoInviting = false +DAS.guildInviteText = nil -DAS_STATUS_COMPLETE = 0 -DAS_STATUS_OPEN = 1 -DAS_STATUS_ACTIVE = 2 -DAS_STATUS_TRACKED = 3 +DAS_STATUS_COMPLETE = 0 +DAS_STATUS_OPEN = 1 +DAS_STATUS_ACTIVE = 2 +DAS_STATUS_TRACKED = 3 local activeInCurrentZone = false DAS.fullBingoString = "" @@ -55,7 +56,7 @@ local defaults = { y = 0, }, inactiveZones = { -hide = true, + hide = true, }, [849] = { relic = { @@ -63,7 +64,7 @@ hide = true, active = true, }, hunt = { -invisible = false, + invisible = false, active = true, }, delve = { @@ -124,7 +125,7 @@ invisible = false, autoHide = false, autoMinimize = false, - + minimised = false, locked = false, hidden = false, @@ -273,9 +274,7 @@ local function OnGroupTypeChanged(eventCode, unitTag) end -local function forceRefreshControl() - DAS.RefreshControl(true) -end +local function forceRefreshControl() DAS.RefreshControl(true) end local function OnQuestAdded(eventCode, journalIndex, questName, objectiveName) @@ -315,11 +314,14 @@ end local function OnQuestShared(eventCode, questId) - if not DAS.settings.autoAcceptShared then return end - local questName = GetOfferedQuestShareInfo(questId) + if not (DAS.GetActiveIn()) and DAS.settings.autoAcceptShared then return end + + local questName = GetOfferedQuestShareInfo(questId) p(zo_strformat("<<1>> \t <<2>>", questId, questName)) - local zoneQuestIds = DAS.questIds[DAS.GetZoneId()] or {} - if not (zoneQuestIds[questName] or DAS_QUEST_IDS[questId]) and DAS.GetActiveIn(zoneId) then return end + local zoneQuestIds = DAS.questIds[DAS.GetZoneId()] or {} + local zoneQuests = DAS.GetZoneQuests() or {} + + if not (zoneQuestIds[questName] or DAS_QUEST_IDS[questId] or ZO_IsElementInNumericallyIndexedTable(zoneQuests, questName)) then return end if zoneQuestIds[questId] then AcceptSharedQuest(questId) @@ -328,8 +330,8 @@ local function OnQuestShared(eventCode, questId) end end -local function OnChatMessage(eventCode, channelType, fromName, messageText, _, fromDisplayName) - return DAS.OnChatMessage(eventCode, channelType, fromName, messageText, _, fromDisplayName) +local function OnChatMessage(...) + DAS.OnChatMessage(...) end local function OnPlayerActivated(eventCode) @@ -348,12 +350,14 @@ local function OnUnitCreated(eventCode, unitTag) DAS.TryShareActiveDaily(unitZone) end -local function OnQuestToolUpdate() - forceRefreshControl() +local function OnQuestToolUpdate() + p("OnQuestToolUpdate") + forceRefreshControl() end local function OnQuestRemoved(eventCode, isCompleted, journalIndex, questName, zoneIndex, poiIndex, questId) + -- p("OnQuestRemoved called: <<1>> (journalIndex <<2>>, questId <<3>>)", questName, journalIndex, questId) local zoneId = DAS.GetZoneId() local zoneIds = DAS.questIds[zoneId] or {} -- is it a daily quest, and are we logging? @@ -372,45 +376,36 @@ local function OnQuestRemoved(eventCode, isCompleted, journalIndex, questName, z end zo_callLater(function() - DAS.SetAutoInvite(autoInvite) - forceRefreshControl() - DAS.RefreshLabelsWithDelay() + DAS.SetAutoInvite(autoInvite) + forceRefreshControl() + DAS.RefreshLabelsWithDelay() end, 5000) - end - - local function deleteYesterdaysLog() - -- kill yesterday's log, we don't need it - local currentDate = tonumber(GetDate()) - if (nil ~= DAS.globalSettings and nil ~= DAS.globalSettings.lastLogDate) and (DAS.globalSettings.lastLogDate < currentDate) then - if nil == DAS.Log then DAS.Log = {} end - DAS.Log[DAS.globalSettings.lastLogDate] = nil - DAS.globalSettings.lastLogDate = currentDate - end - end - - local alreadyRefreshing = false - local function questRefresh() +end + + +local alreadyRefreshing = false +local function questRefresh() alreadyRefreshing = false DAS.RefreshControl(true) - end - local function queueQuestRefresh() +end +local function queueQuestRefresh() if alreadyRefreshing then return end alreadyRefreshing = true zo_callLater(questRefresh, 600) - end - - local function hookQuestTracker() +end + +local function hookQuestTracker() if FOCUSED_QUEST_TRACKER and FOCUSED_QUEST_TRACKER.ForceAssist then - ZO_PreHook(FOCUSED_QUEST_TRACKER, "ForceAssist", queueQuestRefresh) + ZO_PreHook(FOCUSED_QUEST_TRACKER, "ForceAssist", queueQuestRefresh) end - end - - --============================== - --= DailyAutoShare_Initialize == - --============================== - - local function RegisterEventHooks() +end + +--============================== +--= DailyAutoShare_Initialize == +--============================== + +local function RegisterEventHooks() DailyAutoShare.Fragment = ZO_HUDFadeSceneFragment:New(DasControl) @@ -435,112 +430,72 @@ local function OnQuestRemoved(eventCode, isCompleted, journalIndex, questName, z em:RegisterForEvent(DAS.name, EVENT_CHAT_MESSAGE_CHANNEL, OnChatMessage) -- DasControl:OnMoveStop -- DailyAutoShare.SaveControlLocation(self) - end - - - local function resetQuests() - local currentDate = tonumber(GetDate()) - DAS.todaysLog = {} - DAS.globalSettings.completionLog[currentDate] = DAS.todaysLog - forceRefreshControl() - end - - local typeTable = "table" - local function isEmpty(tbl) +end + + +-- local function resetQuests() + -- DAS.todaysLog = {} + -- DAS.globalSettings.completionLog[tonumber(GetDate())] = DAS.todaysLog + -- forceRefreshControl() +-- end + +local typeTable = "table" +local function isEmpty(tbl) if not tbl then return true end local ret = true for key, value in pairs(tbl) do - if type(value) == typeTable then - ret = ret and ({} == value or isEmpty(value)) - else - ret = false - end + if type(value) == typeTable then + ret = ret and ({} == value or isEmpty(value)) + else + ret = false + end end return ret - end - - - -- has to be a local var, lua error if not - -- Keep outside of function namespace so we can overwrite it for debugging - local afterEight = tonumber(GetTimeString():sub(0, 2)) >= 08 - - local function handleLog(forceNoAfterEight) - - local todaysLog = DAS.GetSettingsArray() - if {} ~= todaysLog then - todaysLog = ZO_DeepTableCopy(todaysLog, {}) - end - - local allLogs = DAS.globalSettings.completionLog - local currentDate = tonumber(GetDate()) - allLogs[currentDate] = allLogs[currentDate] or {} - - local logSize, lastDate = NonContiguousCount(DAS.globalSettings.completionLog) - - local counter = 0 - for dateNumber, dateLog in pairs(DAS.globalSettings.completionLog) do - counter = counter + 1 - if nil ~= dateNumber and dateNumber < currentDate then - lastDate = dateNumber - end - if counter < logSize-2 then - DAS.globalSettings.completionLog[dateNumber] = nil - end - end - - local afterEight = not forceNoAfterEight and tonumber(GetTimeString():sub(0, 2)) >= 08 -- has to be a local var, lua error if not - - if (not afterEight) and isEmpty(DAS.todaysLog) and lastDate ~= currentDate then - local lastLog = DAS.globalSettings.completionLog[lastDate] - DAS.globalSettings.completionLog[currentDate] = ZO_DeepTableCopy(lastLog, {}) - -- d(DAS.globalSettings.completionLog[currentDate]) - for charName, charLog in pairs(DAS.globalSettings.completionLog[currentDate]) do - for questName, questData in pairs(charLog) do - questData.afterEight = false - end - end - characterName = characterName or GetUnitName(UNITTAG_PLAYER) - DAS.todaysLog = DAS.globalSettings.completionLog[currentDate] - DAS.todaysCharacterLog = DAS.todaysLog[characterName] - end - end - DAS.handleLog = handleLog -- expose this for debugging purpose - - local function minimiseOnStartup() - DAS.SetMinimized(DAS.GetSettings().startupMinimized) - end - --============================== - --===== Rise, my minion! ====== - --============================== +end + + +-- has to be a local var, lua error if not +-- Keep outside of function namespace so we can overwrite it for debugging +local afterEight = tonumber(GetTimeString():sub(0, 2)) >= 08 + + +local function minimiseOnStartup() + DAS.SetMinimized(DAS.GetSettings().startupMinimized) +end +--============================== +--===== Rise, my minion! ====== +--============================== + +function DailyAutoShare_Initialize(eventCode, addonName) - function DailyAutoShare_Initialize(eventCode, addonName) + if addonName ~= DAS.name then return end - if addonName ~= DAS.name then return end + DAS.settings = ZO_SavedVars:New( "DAS_Settings", 2, "DAS_Settings", defaults) + DAS.globalSettings = ZO_SavedVars:NewAccountWide( "DAS_Globals", 2, "DAS_Globals", defaults) + DAS.globalSettings.completionLog = DAS.globalSettings.completionLog or {} - DAS.settings = ZO_SavedVars:New( "DAS_Settings", 2, "DAS_Settings", defaults) - DAS.globalSettings = ZO_SavedVars:NewAccountWide( "DAS_Globals", 2, "DAS_Globals", defaults) DAS.pdn = GetUnitDisplayName(UNITTAG_PLAYER) + pointerUpSubzones() - RegisterEventHooks() - - DAS.CreateMenu(DAS.settings, defaults) - DAS.CreateGui() + RegisterEventHooks() + + DAS.CreateMenu(DAS.settings, defaults) + DAS.CreateGui() -- local timetoreset = (GetTimeStamp() - 60*60*7)%86400 -- zo_callLater(resetQuests, timetoreset) - handleLog() + DAS.handleLog() zo_callLater(OnPlayerActivated, 5000) zo_callLater(minimiseOnStartup, 5500) DAS.CreateMapMarkers() - EVENT_MANAGER:UnregisterForEvent("DailyAutoShare", EVENT_ADD_ON_LOADED) - - end + EVENT_MANAGER:UnregisterForEvent("DailyAutoShare", EVENT_ADD_ON_LOADED) - - ZO_CreateStringId("SI_BINDING_NAME_TOGGLE_DAS_GUI", GetString(DAS_SI_TOGGLE)) - ZO_CreateStringId("SI_BINDING_NAME_TOGGLE_DAS_LIST", GetString(DAS_SI_MINIMISE)) - EVENT_MANAGER:RegisterForEvent("DailyAutoShare", EVENT_ADD_ON_LOADED, DailyAutoShare_Initialize) - \ No newline at end of file +end + + +ZO_CreateStringId("SI_BINDING_NAME_TOGGLE_DAS_GUI", GetString(DAS_SI_TOGGLE)) +ZO_CreateStringId("SI_BINDING_NAME_TOGGLE_DAS_LIST", GetString(DAS_SI_MINIMISE)) +EVENT_MANAGER:RegisterForEvent("DailyAutoShare", EVENT_ADD_ON_LOADED, DailyAutoShare_Initialize) diff --git a/DASContextMenu.lua b/DASContextMenu.lua index c6462a4..14e31dd 100644 --- a/DASContextMenu.lua +++ b/DASContextMenu.lua @@ -64,7 +64,7 @@ end function DAS.OnRightClick(control, verbose) if nil == control then return end - questName = control.dataQuestName + questName = control.dataQuestName journalIndex = control.dataJournalIndex bingoString = control.dataBingoString currentControl = control diff --git a/DASData.lua b/DASData.lua index 251d72f..57254c1 100644 --- a/DASData.lua +++ b/DASData.lua @@ -85,6 +85,26 @@ function DAS.GetBingoStringFromQuestName(questName) end +local zoneCloneDebug = "Couldn't copy zone <<1>> to zone <<2>>, one of the IDs was nil" +function DAS.zoneHasAdditionalId(zoneId2, zoneId) + + if not zoneId and zoneId2 then + d(zo_strformat(zoneCloneDebug, zoneId, zoneId2)) + return + end + + DAS.questIds[zoneId2] = DAS.questIds[zoneId] + + + DAS.shareables[zoneId2] = DAS.shareables[zoneId] + DAS.bingo[zoneId2] = DAS.bingo[zoneId] + + DAS.QuestLists[zoneId2] = DAS.QuestLists[zoneId] + + DAS.questStarter[zoneId2] = DAS.questStarter[zoneId] + DAS.questFinisher[zoneId2] = DAS.questFinisher[zoneId] + end + function DAS.GetQuestNameFromIndex(bingoIndex) return DAS.GetZoneQuests()[bingoIndex] end diff --git a/DASUserSettingsAdapter.lua b/DASUserSettingsAdapter.lua index b13f246..31972f5 100644 --- a/DASUserSettingsAdapter.lua +++ b/DASUserSettingsAdapter.lua @@ -13,21 +13,21 @@ end local function GetSettings() if DAS.GetUseGlobalSettings() then return DAS.globalSettings - else + else return DAS.settings - end + end end DAS.GetSettings = GetSettings local function CanInvite(unitTag, unitName) if (nil == unitTag) and (nil == unitName) then - return ((not IsUnitGrouped(groupTagPlayer) or (IsUnitGroupLeader(groupTagPlayer) and GetGroupSize() < GROUP_SIZE_MAX))) + return ((not IsUnitGrouped(groupTagPlayer) or (IsUnitGroupLeader(groupTagPlayer) and GetGroupSize() < GROUP_SIZE_MAX))) elseif(unitTag and (not IsUnitPlayer(unitTag) or IsUnitGrouped(unitTag))) then - return false + return false elseif(unitName and IsPlayerInGroup(unitName)) then - return false - end - return true + return false + end + return true end function DAS.GetDebugMode() @@ -62,10 +62,10 @@ function DAS.SetHidden(hidden) if hidden then SCENE_MANAGER:GetScene("hud" ):RemoveFragment(DAS.Fragment) SCENE_MANAGER:GetScene("hudui"):RemoveFragment(DAS.Fragment) - else + else SCENE_MANAGER:GetScene("hud" ):AddFragment(DAS.Fragment) SCENE_MANAGER:GetScene("hudui"):AddFragment(DAS.Fragment) - end + end if not hidden then DAS.RefreshControl(true) end end function DAS.GetQuestShareDelay() @@ -86,15 +86,15 @@ function DAS.GetAutoAcceptInvite() end function DAS.SetAutoAcceptInvite(value) DAS.settings.autoAcceptInvite = value - if value then - EVENT_MANAGER:RegisterForEvent("DailyAutoshare", EVENT_GROUP_INVITE_RECEIVED, AcceptGroupInvite) + if value then + EVENT_MANAGER:RegisterForEvent("DailyAutoshare", EVENT_GROUP_INVITE_RECEIVED, AcceptGroupInvite) else - EVENT_MANAGER:UnregisterForEvent("DailyAutoshare", EVENT_GROUP_INVITE_RECEIVED, AcceptGroupInvite) - end + EVENT_MANAGER:UnregisterForEvent("DailyAutoshare", EVENT_GROUP_INVITE_RECEIVED, AcceptGroupInvite) + end end function DAS.GetWhisperOnly() - return GetSettings().whisperOnly + return GetSettings().whisperOnly end function DAS.GetMinimized() @@ -129,25 +129,25 @@ function DAS.GetAutoInvite() return GetSettings().autoInvite end function DAS.SetAutoInvite(value) - - value = value and IsUnitSoloOrGroupLeader(UNITTAG_PLAYER) and DAS.HasActiveDaily() - + + value = value and IsUnitSoloOrGroupLeader(UNITTAG_PLAYER) and DAS.HasActiveDaily() + GetSettings().autoInvite = value - DAS.autoInviting = value + DAS.autoInviting = value DAS.SetButtonStates() DAS.SetChatListenerStatus(value) end -- called from settings and from internal helper function DAS.GetActiveIn(zoneIndex) - zoneIndex = zoneIndex or DAS.GetZoneId() - if not zoneIndex then return end + zoneIndex = zoneIndex or DAS.GetZoneId() + if not zoneIndex then return end zoneIndex = DAS.subzones[zoneIndex] or zoneIndex return GetSettings().tracked[zoneIndex] end function DAS.SetActiveIn(zoneIndex, value) - zoneIndex = zoneIndex or DAS.GetZoneId() - if not zoneIndex then return end + 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 @@ -163,15 +163,15 @@ local nestedLists = { 535, 381, 381, - } + } } function DAS.SetActiveFor(listName, value) local activityValue = (value and listName) or false if nil ~= nestedLists[listName] then for index, zoneId in pairs(nestedLists[listName]) do DAS.SetActiveIn(zoneId, activityValue) - end - end + end + end end @@ -190,10 +190,10 @@ function DAS.SetAutoLeave(value) end function DAS.GetResetAutoShareOnNewGroup() - return GetSettings().resetAutoShareOnNewGroup + return GetSettings().resetAutoShareOnNewGroup end function DAS.SetResetAutoShareOnNewGroup(value) - GetSettings().resetAutoShareOnNewGroup = value + GetSettings().resetAutoShareOnNewGroup = value end function DAS.GetUpsideDown() @@ -236,8 +236,8 @@ end function DAS.SetFontSize(value) GetSettings().fontScale = value - DAS.SetLabelFontSize() - DAS.RefreshLabelsWithDelay() + DAS.SetLabelFontSize() + DAS.RefreshLabelsWithDelay() end -- called from GUI @@ -263,7 +263,7 @@ function DAS.GetGuildInviteNumber() end function DAS.SetGuildInviteNumber(value) GetSettings().guildInviteNumber = value - DAS.channelTypes[value+11] = true + DAS.channelTypes[value+11] = true end function DAS.GetListenInGuilds() @@ -271,21 +271,21 @@ function DAS.GetListenInGuilds() end function DAS.SetListenInGuilds(value) GetSettings().listenInGuilds = value - DAS.channelTypes[CHAT_CHANNEL_GUILD_1] = value - DAS.channelTypes[CHAT_CHANNEL_GUILD_2] = value - DAS.channelTypes[CHAT_CHANNEL_GUILD_3] = value - DAS.channelTypes[CHAT_CHANNEL_GUILD_4] = value - DAS.channelTypes[CHAT_CHANNEL_GUILD_5] = value + DAS.channelTypes[CHAT_CHANNEL_GUILD_1] = value + DAS.channelTypes[CHAT_CHANNEL_GUILD_2] = value + DAS.channelTypes[CHAT_CHANNEL_GUILD_3] = value + DAS.channelTypes[CHAT_CHANNEL_GUILD_4] = value + DAS.channelTypes[CHAT_CHANNEL_GUILD_5] = value end function DAS.GetGuildInviteText() - local ret = GetSettings().guildInviteText or "" - if #ret == 0 then return end + local ret = GetSettings().guildInviteText or "" + if #ret == 0 then return end return ret end function DAS.SetGuildInviteText(value) GetSettings().guildInviteText = value - DAS.guildInviteText = value + DAS.guildInviteText = value end function DAS.SaveControlLocation(control) @@ -295,15 +295,15 @@ function DAS.SaveControlLocation(control) end function DAS.LoadControlLocation(control) - + local controlName = control:GetName() local x = DAS.GetX(controlName) or 0 local y = DAS.GetY(controlName) or 0 - + control:ClearAnchors() control:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, x, y) - - DAS.GetSettings().tooltipRight = DAS.GetSettings().tooltipRight or x < 200 + + DAS.GetSettings().tooltipRight = DAS.GetSettings().tooltipRight or x < 200 end @@ -327,94 +327,25 @@ local timeStringNumber = tonumber(GetTimeString():sub(1,2)) DAS.todaysCharacterLog = nil -local function getSettingsArray(forceRefresh) - - if not forceRefresh and DAS.todaysCharacterLog then return DAS.todaysCharacterLog end - characterName = characterName or GetUnitName(UNITTAG_PLAYER) - - DAS.globalSettings.completionLog = DAS.globalSettings.completionLog or {} - local completionLog = DAS.globalSettings.completionLog - - completionLog[dateNumber] = completionLog[dateNumber] or {} - - DAS.todaysLog = DAS.todaysLog or completionLog[dateNumber] - DAS.todaysLog[characterName] = DAS.todaysLog[characterName] or {} - DAS.todaysCharacterLog = DAS.todaysLog[characterName] - - return DAS.todaysCharacterLog -end -DAS.GetSettingsArray = getSettingsArray - -local typeString = "string" -function DAS.GetCompleted(questName) - - if nil == questName or "" == questName or typeString ~= type(questName) then return false end - - local settings = getSettingsArray() - local logEntry = settings[zo_strformat(questName)] or {} - return logEntry.completed - -end - -function DAS.LogQuest(questName, completed) - if nil == questName then return end - - timeStringNumber = timeStringNumber or tonumber(GetTimeString():sub(1,2)) - local settings = getSettingsArray() - - local afterEight = (timeStringNumber >= 8) -- 08:17:02 - reset is at 8 - 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].afterEight = afterEight -end - -function DAS.GetQuestStatus(questName) - if nil == questName then return end - - if nil ~= DAS.QuestNameTable[questName] then return DAS_STATUS_ACTIVE end - if DAS.GetCompleted(questName) then - return DAS_STATUS_COMPLETE - end - - local zoneId = DAS.GetZoneId() - local questList = DAS.QuestLists[zoneId] - if nil == questList then return DAS_STATUS_OPEN end - for questListName, questListData in pairs(questList) do - if questListData[questName] then - return (DAS.GetQuestListItem(zoneId, questListName, "active") and DAS_STATUS_OPEN) or DAS_STATUS_COMPLETE - end - end - return DAS_STATUS_OPEN -end function DAS.GetQuestListItem(zoneId, listName, listKey) - if nil == zoneId or nil == listName or nil == listKey then return false end - if nil == DAS.settings[zoneId] or nil == DAS.settings[zoneId][listName] then return false end - return DAS.settings[zoneId][listName][listKey] + if nil == zoneId or nil == listName or nil == listKey then return false end + if nil == DAS.settings[zoneId] or nil == DAS.settings[zoneId][listName] then return false end + return DAS.settings[zoneId][listName][listKey] end function DAS.SetQuestListItem(zoneId, listName, listKey, value) - if nil == zoneId or nil == listName or nil == listKey then return end - if nil == DAS.settings[zoneId] or nil == DAS.settings[zoneId][listName] then return end - DAS.settings[zoneId][listName][listKey] = value - zo_callLater(function() DAS.RefreshControl() end, 500) + if nil == zoneId or nil == listName or nil == listKey then return end + if nil == DAS.settings[zoneId] or nil == DAS.settings[zoneId][listName] then return end + DAS.settings[zoneId][listName][listKey] = value + zo_callLater(function() DAS.RefreshControl() end, 500) end -function DAS.GetShareableLog() - return getSettingsArray() -end function DAS.GetMarkerVisibility() - return GetSettings().mapMarkersVisible + return GetSettings().mapMarkersVisible end function DAS.SetMarkerVisibility(value) - GetSettings().mapMarkersVisible = value + GetSettings().mapMarkersVisible = value end -DAS.shareables = ((641091141121041051081049797115 == DAS.GetSettings().lastLookingFor) and {}) or DAS.shareables \ No newline at end of file diff --git a/DailyAutoShare.txt b/DailyAutoShare.txt index 4d7ad9e..0545288 100644 --- a/DailyAutoShare.txt +++ b/DailyAutoShare.txt @@ -21,6 +21,7 @@ locale/$(language).lua 00_startup.lua xml/Bindings.xml DASHelper.lua +DASData.lua questData/BingoClean.lua questData/GuildQuests.lua @@ -34,7 +35,6 @@ questData/ClockworkCity.lua questData/Summerset.lua questData/Murkmire.lua -DASData.lua DASUserSettingsAdapter.lua DasChatMessage.lua @@ -45,3 +45,5 @@ DasGuiStringBuilder.lua DasTooltip.lua DasMapMarker.lua DASMenu.lua + +DasLog.lua \ No newline at end of file diff --git a/DasGui.lua b/DasGui.lua index 2aae79d..de38895 100644 --- a/DasGui.lua +++ b/DasGui.lua @@ -26,26 +26,26 @@ local function cacheVisibilityStatus(forceOverride) end function DAS.RefreshControl(refreshQuestCache) - - -- p("DAS.RefreshControl(" .. tostring(refreshQuestCache).. ")") + + -- p("DAS.RefreshControl(" .. tostring(refreshQuestCache).. ")") if not DAS.HasActiveDaily() then DAS.SetAutoInvite(false) - end - + end + cacheVisibilityStatus() DasHandle:SetHidden( stateIsHidden) DasControl:SetHidden( stateIsHidden) DasList:SetHidden( stateIsMinimised or stateIsHidden) - DAS.RefreshLabelsWithDelay() + DAS.RefreshLabelsWithDelay() end local function SetAlpha(control, value) if not control then return end if value then control:SetAlpha(1) - else + else control:SetAlpha(0.3) - end + end end local function SetAutoInviteButton(value) @@ -53,12 +53,12 @@ local function SetAutoInviteButton(value) DasButtonInvite:SetAlpha(1) DasButtonInvite:SetNormalTexture("/DailyAutoShare/textures/invite_active.dds") DasList_BG:SetEdgeColor(ZO_SELECTED_TEXT:UnpackRGBA()) - else + else DasButtonInvite:SetAlpha(0.5) DasButtonInvite:SetNormalTexture("/DailyAutoShare/textures/invite_up.dds") DasList_BG:SetEdgeColor(ZO_DEFAULT_TEXT:UnpackRGBA()) - end - + end + end local function SetLockedButton(value) @@ -67,16 +67,16 @@ local function SetLockedButton(value) DasButtonLock:SetMouseOverTexture("/esoui/art/miscellaneous/unlocked_down.dds") DasButtonLock:SetPressedTexture("/esoui/art/miscellaneous/unlocked_down.dds") DasControl:SetMovable(false) - else + else DasButtonLock:SetNormalTexture("/esoui/art/miscellaneous/unlocked_up.dds") DasButtonLock:SetMouseOverTexture("/esoui/art/miscellaneous/locked_down.dds") DasButtonLock:SetPressedTexture("/esoui/art/miscellaneous/locked_down.dds") DasControl:SetMovable(true) - end + end end local function SetMinimizedButton(value) - + local minimizedTex = "/esoui/art/buttons/plus" local maximizedTex = "/esoui/art/buttons/minus" local tex = (value and minimizedTex) or maximizedTex @@ -90,7 +90,7 @@ end local function setButtonStates() SetAutoInviteButton(DAS.GetAutoInvite()) SetLockedButton(DAS.GetLocked()) - + SetAlpha(DasButtonAccept, DAS.GetAutoAcceptShared()) SetAlpha(DasButtonShare, DAS.GetAutoShare()) @@ -99,31 +99,31 @@ end DAS.SetButtonStates = setButtonStates function DAS.QuestLabelClicked(control, mouseButton) - - DAS.SetSubLabels(control.dataQuestList) - - if mouseButton == MOUSE_BUTTON_INDEX_RIGHT then -- and isValidJournalIndex then + + DAS.SetSubLabels(control.dataQuestList) + + if mouseButton == MOUSE_BUTTON_INDEX_RIGHT then -- and isValidJournalIndex then return DAS.OnRightClick(control) - end - + end + local journalIndex = control.dataJournalIndex or 99 if IsValidQuestIndex(journalIndex) then - if journalIndex ~= DAS.trackedIndex then - FOCUSED_QUEST_TRACKER:ForceAssist(journalIndex) - else - ShareQuest(journalIndex) - end - end + if journalIndex ~= DAS.trackedIndex then + FOCUSED_QUEST_TRACKER:ForceAssist(journalIndex) + else + ShareQuest(journalIndex) + end + end end function DAS.Donate(control, mouseButton) local amount = 2000 if mouseButton == 2 then amount = 1000 - elseif mouseButton == 3 then + elseif mouseButton == 3 then amount = 25000 - end + end SCENE_MANAGER:Show('mailSend') zo_callLater(function() @@ -131,7 +131,7 @@ function DAS.Donate(control, mouseButton) ZO_MailSendSubjectField:SetText("Thank you for DailyAutoShare!") QueueMoneyAttachment(amount) ZO_MailSendBodyField:TakeFocus() - end, 200) + end, 200) end function DAS.MinMaxButton() @@ -143,179 +143,183 @@ function DAS.MinMaxButton() end local function shouldHideLabel(questName, zoneId) - local questLists = DAS.GetZoneQuests(zoneId) or {} + local questLists = DAS.GetZoneQuests(zoneId) or {} -- d(zo_strformat("should <<1>> be hidden?", questName)) for questListName, questListData in pairs(questLists) do if questListData[questName] then - -- d(questName) - -- d("active: " .. tostring(DAS.GetQuestListItem(zoneId, questListName, "active"))) - -- d("hidden: " .. tostring(DAS.GetQuestListItem(zoneId, questListName, "invisible"))) + -- d(questName) + -- d("active: " .. tostring(DAS.GetQuestListItem(zoneId, questListName, "active"))) + -- d("hidden: " .. tostring(DAS.GetQuestListItem(zoneId, questListName, "invisible"))) return ( (not DAS.GetQuestListItem(zoneId, questListName, "active")) or - DAS.GetQuestListItem(zoneId, questListName, "invisible")) - end - end + DAS.GetQuestListItem(zoneId, questListName, "invisible")) + end + end return false end local function setControlText(label, hidden) - local state = label.dataQuestState - if label.dataJournalIndex == DAS.trackedIndex then - label:SetText("* " .. label.dataTitle) + local state = label.dataQuestState + if label.dataJournalIndex == DAS.trackedIndex then + label:SetText("* " .. label.dataTitle) elseif hideLabel then - label:SetText("") - label:SetVisible(false) - return + label:SetText("") + label:SetVisible(false) + return else - label:SetText(label.dataTitle) - end - - if label.dataQuestState == DAS_STATUS_COMPLETE then - label:SetState(BSTATE_DISABLED) + label:SetText(label.dataTitle) + end + + if label.dataQuestState == DAS_STATUS_COMPLETE then + label:SetState(BSTATE_DISABLED) elseif label.dataQuestState == DAS_STATUS_ACTIVE then - label:SetState(BSTATE_PRESSED) + label:SetState(BSTATE_PRESSED) else --if label.dataQuestState == DAS_STATUS_OPEN then - label:SetState(BSTATE_NORMAL) - end - + label:SetState(BSTATE_NORMAL) + end + end function setLabelTable(questTable) - - local status = DAS_STATUS_COMPLETE - local index = 1 - local questName, tmpStatus = nil + + local status = DAS_STATUS_COMPLETE + local index = 1 + local questName, tmpStatus = nil + + for idx, tmpQuestName in pairs(questTable) do - for idx, tmpQuestName in pairs(questTable) do - - labelTexts[tmpQuestName] = true - questName = questName or tmpQuestName - tmpStatus = DAS.GetQuestStatus(tmpQuestName) - if tmpStatus == DAS_STATUS_ACTIVE then - status = tmpStatus - questName = tmpQuestName - elseif status ~= DAS_STATUS_ACTIVE and status ~= DAS_STATUS_OPEN then - status = tmpStatus - end - end - questName = questName or "" - return questName, status + labelTexts[tmpQuestName] = true + questName = questName or tmpQuestName + tmpStatus = DAS.GetQuestStatus(tmpQuestName) + if tmpStatus == DAS_STATUS_ACTIVE then + status = tmpStatus + questName = tmpQuestName + elseif status ~= DAS_STATUS_ACTIVE and status ~= DAS_STATUS_OPEN then + status = tmpStatus + end + end + questName = questName or "" + return questName, status end local sep = "%s%w%w%s" local function makeSubLabelTitle(str, str2) - if not str then return end - local idx = string.find(str, sep) - if nil == idx then return str end - return string.sub(str, 0, idx+3) .. "..." + if not str then return end + local idx = string.find(str, sep) + if nil == idx then return str end + return string.sub(str, 0, idx+3) .. "..." end function DAS.SetSubLabels(questTable) - DasSubList:SetHidden(nil == questTable or {} == questTable) - if DasSubList:IsHidden() then return end + DasSubList:SetHidden(nil == questTable or {} == questTable) + if DasSubList:IsHidden() then return end + + local status = DAS_STATUS_COMPLETE + local index = 1 + for idx, questName in pairs(questTable) do + index = idx + local label = DAS.sublabels[idx] - local status = DAS_STATUS_COMPLETE - local index = 1 - for idx, questName in pairs(questTable) do - index = idx - local label = DAS.sublabels[idx] - - label.dataJournalIndex = DAS.GetLogIndex(questName) - local bingoString, bingoIndex = DAS.GetBingoStringFromQuestName(questName) - label.dataBingoString = bingoString - label.dataBingoIndex = bingoIndex - label.dataQuestName = questName - label.dataTitle = questName - label.dataQuestState = DAS.GetQuestStatus(questName) - label:SetHidden(false) - if label.dataQuestState == DAS_STATUS_ACTIVE then - table.insert(activeZoneQuests, label.dataJournalIndex) - status = label.dataQuestState - elseif status ~= DAS_STATUS_ACTIVE and status ~= DAS_STATUS_OPEN then - status = label.dataQuestState - end - setControlText(label) - end - for idx=index, #DAS.sublabels do - local label = DAS.sublabels[idx] - label.dataJournalIndex = nil - label.dataBingoString = nil - label.dataQuestName = nil - label.dataQuestState = DAS_STATUS_OPEN - label:SetText("") - label:SetHidden(true) - end - - DAS.SetLabelFontSize() - return status + label.dataJournalIndex = DAS.GetLogIndex(questName) + local bingoString, bingoIndex = DAS.GetBingoStringFromQuestName(questName) + label.dataBingoString = bingoString + label.dataBingoIndex = bingoIndex + label.dataQuestName = questName + label.dataTitle = questName + label.dataQuestState = DAS.GetQuestStatus(questName) + label:SetHidden(false) + if label.dataQuestState == DAS_STATUS_ACTIVE then + table.insert(activeZoneQuests, label.dataJournalIndex) + status = label.dataQuestState + elseif status ~= DAS_STATUS_ACTIVE and status ~= DAS_STATUS_OPEN then + status = label.dataQuestState + end + setControlText(label) + end + for idx=index, #DAS.sublabels do + local label = DAS.sublabels[idx] + label.dataJournalIndex = nil + label.dataBingoString = nil + label.dataQuestName = nil + label.dataQuestState = DAS_STATUS_OPEN + label:SetText("") + label:SetHidden(true) + end + + DAS.SetLabelFontSize() + return status end local typeTable = "table" -function DAS.setLabels(zoneQuests) - - labelTexts = {} - -- p("DAS.setLabels") - DAS.activeZoneQuests = {} - numLabels = 1 - local questName +function DAS.setLabels(zoneQuests) + + zoneQuests = zoneQuests or DAS.GetZoneQuests() + labelTexts = {} + + -- p("DAS.setLabels") + DAS.activeZoneQuests = {} + numLabels = 1 + local questName for index, questNameOrTable in pairs(zoneQuests) do + + if not labelTexts[questNameOrTable] then + label = DAS.labels[numLabels] -- despite the name these are actually buttons + + if nil ~= label then + local status = DAS_STATUS_OPEN + visibleButtonIndex = visibleButtonIndex +1 - if not labelTexts[questNameOrTable] then - label = DAS.labels[numLabels] -- despite the name these are actually buttons - - if nil ~= label then - local status = DAS_STATUS_OPEN - visibleButtonIndex = visibleButtonIndex +1 - if type(questNameOrTable) == typeTable then - label.dataQuestList = ZO_DeepTableCopy(questNameOrTable, {}) - label.dataQuestName, status = setLabelTable(questNameOrTable) - label.dataQuestState = status or DAS_STATUS_OPEN - label.dataTitle = makeSubLabelTitle(label.dataQuestList[1], label.dataQuestList[2]) or questName - -- label:Set - else - label.dataQuestList = nil - label.dataTitle = questNameOrTable - label.dataQuestName = questNameOrTable - label.dataQuestState = DAS.GetQuestStatus(label.dataQuestName) - end - - local hideLabel = (hideCompleted and label.dataQuestState == DAS_STATUS_COMPLETE) - or shouldHideLabel(label.dataQuestName, zoneId) - - -- d(zo_strformat("DAS: <<1>> state <<2>>", label.dataQuestName, label.dataQuestState)) - label:SetHidden(hideLabel) - label.dataJournalIndex = DAS.GetLogIndex(label.dataQuestName) - bingoString, bingoIndex = DAS.GetBingoStringFromQuestName(label.dataQuestName) - label.dataBingoString = bingoString - label.dataBingoIndex = bingoIndex - label.dataTitle = label.dataTitle or "" - - if label.dataQuestState == DAS_STATUS_ACTIVE then - table.insert(DAS.activeZoneQuests, label.dataJournalIndex) - end - - - labelTexts[label.dataQuestName] = true - setControlText(label, hideLabel) - - numLabels = numLabels + 1 - - - end -- nil check end + if type(questNameOrTable) == typeTable then + label.dataQuestList = ZO_DeepTableCopy(questNameOrTable, {}) + label.dataQuestName, status = setLabelTable(questNameOrTable) + label.dataQuestState = status or DAS_STATUS_OPEN + label.dataTitle = makeSubLabelTitle(label.dataQuestList[1], label.dataQuestList[2]) or questName + + else + label.dataQuestList = nil + label.dataTitle = questNameOrTable + label.dataQuestName = questNameOrTable + label.dataQuestState = DAS.GetQuestStatus(label.dataQuestName) end - end -- for loop end - - return numLabels + + local hideLabel = (hideCompleted and label.dataQuestState == DAS_STATUS_COMPLETE) or shouldHideLabel(label.dataQuestName, zoneId) + + -- d(zo_strformat("DAS: <<1>> state <<2>>", label.dataQuestName, label.dataQuestState)) + label:SetHidden(hideLabel) + label.dataJournalIndex = DAS.GetLogIndex(label.dataQuestName) + bingoString, bingoIndex = DAS.GetBingoStringFromQuestName(label.dataQuestName) + label.dataBingoString = bingoString + label.dataBingoIndex = bingoIndex + label.dataTitle = label.dataTitle or "" + + if label.dataQuestState == DAS_STATUS_ACTIVE then + table.insert(DAS.activeZoneQuests, label.dataJournalIndex) + end + + + labelTexts[label.dataQuestName] = true + setControlText(label, hideLabel) + + numLabels = numLabels + 1 + + + end -- nil check end + end + end -- for loop end + + return numLabels end -function DAS.RefreshLabelsWithDelay() - zo_callLater(DAS.RefreshLabels, 500) -end +function DAS.RefreshLabelsWithDelay() zo_callLater(DAS.RefreshLabels, 500) end function DAS.RefreshLabels(forceQuestRefresh, forceSkipQuestRefresh) - forceQuestRefresh = forceQuestRefresh or DAS.questCacheNeedsRefresh - -- p("DAS.RefreshLabels(" .. tostring(forceQuestRefresh) .. ", " .. tostring(forceSkipQuestRefresh) .. ")") + + + forceQuestRefresh = forceQuestRefresh or DAS.questCacheNeedsRefresh + p("DAS.RefreshLabels(" .. tostring(forceQuestRefresh) .. ", " .. tostring(forceSkipQuestRefresh) .. ")") + -- error("RefreshLabels called") + cacheVisibilityStatus() setButtonStates() @@ -324,147 +328,147 @@ function DAS.RefreshLabels(forceQuestRefresh, forceSkipQuestRefresh) local label, questIndex, tracked if not forceSkipQuestRefresh then DAS.RefreshQuestLogs(forceQuestRefresh) - if FOCUSED_QUEST_TRACKER and FOCUSED_QUEST_TRACKER.assistedData then - DAS.trackedIndex = FOCUSED_QUEST_TRACKER.assistedData.arg1 - end - end + if FOCUSED_QUEST_TRACKER and FOCUSED_QUEST_TRACKER.assistedData then + DAS.trackedIndex = FOCUSED_QUEST_TRACKER.assistedData.arg1 + end + end local questList = DAS.QuestLists[DAS.GetZoneId()] - local zoneQuests = DAS.GetZoneQuests() - - DAS.setLabels(zoneQuests) - + local zoneQuests = DAS.GetZoneQuests() + + DAS.setLabels(zoneQuests) + for bIndex=#DAS.GetZoneQuests()+1, #DAS.labels do if DAS.labels[bIndex] then DAS.labels[bIndex]:SetHidden(true) - DAS.labels[bIndex]:SetText("") - end - end + DAS.labels[bIndex]:SetText("") + end + end DAS.RefreshFullBingoString() DAS.SetLabelFontSize() end function DAS.RefreshGui(hidden) - -- p("DAS.RefreshGui") - if not DAS.GetActiveIn() then - DasControl:SetHidden(true) - return - end - + -- p("DAS.RefreshGui") + if not DAS.GetActiveIn() then + DasControl:SetHidden(true) + return + end + hidden = hidden or (DAS.GetHidden() or (DAS.GetAutoHide() and not DAS.OpenDailyPresent()) or #DAS.GetZoneQuests(zoneId) == 0) local minmaxed = stateIsMinimised SetMinimizedButton(minmaxed) DasList:SetHidden(minmaxed) DasControl:SetHidden(hidden) DasHandle:SetMovable(not DAS.GetLocked()) - zo_callLater(DAS.RefreshLabels, 500) + DAS.RefreshLabelsWithDelay() end function DAS.AnchorList() - DasList:ClearAnchors() - if DAS.GetUpsideDown() then - DasList:SetAnchor(BOTTOM, DasHandle, TOP) - else - DasList:SetAnchor(TOP, DasHandle, BOTTOM) - end - DasSubList:ClearAnchors() - if DAS.GetSettings().tooltipRight then - DasSubList:SetAnchor(LEFT, DasList, RIGHT) - else - DasSubList:SetAnchor(RIGHT, DasList, LEFT) - end +DasList:ClearAnchors() +if DAS.GetUpsideDown() then +DasList:SetAnchor(BOTTOM, DasHandle, TOP) +else +DasList:SetAnchor(TOP, DasHandle, BOTTOM) +end +DasSubList:ClearAnchors() +if DAS.GetSettings().tooltipRight then +DasSubList:SetAnchor(LEFT, DasList, RIGHT) +else +DasSubList:SetAnchor(RIGHT, DasList, LEFT) +end end local function setFontSize(labelList) - local labelHeight = 30 - local fontScale = DAS.GetFontSize() - - local totalHeight = 0 - local hidden = false - local parent = nil - local maxWidth = DasHandle:GetWidth() - - for index, control in pairs(labelList) do - parent = parent or control:GetParent() - maxWidth = math.max(maxWidth, control:GetWidth()) - control:SetScale(fontScale) - if control:IsHidden() then - control:SetHeight(0) - else - control:SetHeight(labelHeight) - control:SetScale(fontScale) - end - end - parent:SetWidth(maxWidth) +local labelHeight = 30 +local fontScale = DAS.GetFontSize() + +local totalHeight = 0 +local hidden = false +local parent = nil +local maxWidth = DasHandle:GetWidth() + +for index, control in pairs(labelList) do +parent = parent or control:GetParent() +maxWidth = math.max(maxWidth, control:GetWidth()) +control:SetScale(fontScale) +if control:IsHidden() then +control:SetHeight(0) +else +control:SetHeight(labelHeight) +control:SetScale(fontScale) +end +end +parent:SetWidth(maxWidth) end DAS.setFontSize = setFontSize local function setGuiHeight() - local buttonIndex = numLabels or 0 - local listHeight = DasHeader:GetHeight() + buttonIndex*(DAS.labels[1]:GetHeight() + 2) - DasList:SetHeight(listHeight) - DasControl:SetHeight(listHeight + DasHandle:GetHeight()) +local buttonIndex = numLabels or 0 +local listHeight = DasHeader:GetHeight() + buttonIndex*(DAS.labels[1]:GetHeight() + 2) +DasList:SetHeight(listHeight) +DasControl:SetHeight(listHeight + DasHandle:GetHeight()) end DAS.SetGuiHeight = setGuiHeight function DAS.SetLabelFontSize() - - setFontSize(DAS.labels) - setFontSize(DAS.sublabels) - DAS.SetGuiHeight() + +setFontSize(DAS.labels) +setFontSize(DAS.sublabels) +DAS.SetGuiHeight() end function DAS.CreateGui() - local function setupGuiLabels() - - local predecessor = DasHeader - local offsetX, offsetY = 10, 10 - - for i=1, 28 do - local button = WINDOW_MANAGER:CreateControlFromVirtual("Das_Label_"..tostring(i), DasList, "Das_Label") - button:SetAnchor(TOPLEFT, predecessor, BOTTOMLEFT, 0, offsetY) - predecessor = button - offsetY = 0 - table.insert(DAS.labels, button) - end - - local spacer = WINDOW_MANAGER:CreateControlFromVirtual("Das_Spacer_1", DasList, "DasInvisibleFooterSpacer") - spacer:SetAnchor(TOPLEFT, predecessor, BOTTOMLEFT, 0, offsetY) - - predecessor = DasSubList - offsetY = 10 - - local anchor = TOPLEFT - for i=1, 15 do - local button = WINDOW_MANAGER:CreateControlFromVirtual("Das_Sublabel_"..tostring(i), DasSubList, "Das_Label") - button:SetAnchor(TOPLEFT, predecessor, anchor, offsetX, offsetY) - predecessor = button - offsetY = 0 - offsetX = 0 - anchor = BOTTOMLEFT - - table.insert(DAS.sublabels, button) - end - local spacer = WINDOW_MANAGER:CreateControlFromVirtual("Das_Spacer_2", DasSubList, "DasInvisibleFooterSpacer") - spacer:SetAnchor(TOPLEFT, predecessor, BOTTOMLEFT, 0, offsetY) - - DAS.SetLabelFontSize() - end +local function setupGuiLabels() +local predecessor = DasHeader +local offsetX, offsetY = 10, 10 - local eprint = function(s) return(table.concat({string.byte(s, 0, -1)}, '')) end - - DAS.GetSettings().lastLookingFor = eprint(DAS.pdn) - setupGuiLabels() - DAS.LoadControlLocation(DasControl) - -- DAS.LoadControlLocation(DasButton) - - DAS.AnchorList() - SetMinimizedButton(DAS.GetMinimized()) - - DAS.RefreshGui() - zo_callLater(function() DAS.SetLabelFontSize() end, 2000) +for i=1, 28 do +local button = WINDOW_MANAGER:CreateControlFromVirtual("Das_Label_"..tostring(i), DasList, "Das_Label") +button:SetAnchor(TOPLEFT, predecessor, BOTTOMLEFT, 0, offsetY) +predecessor = button +offsetY = 0 +table.insert(DAS.labels, button) +end + +local spacer = WINDOW_MANAGER:CreateControlFromVirtual("Das_Spacer_1", DasList, "DasInvisibleFooterSpacer") +spacer:SetAnchor(TOPLEFT, predecessor, BOTTOMLEFT, 0, offsetY) + +predecessor = DasSubList +offsetY = 10 + +local anchor = TOPLEFT +for i=1, 15 do +local button = WINDOW_MANAGER:CreateControlFromVirtual("Das_Sublabel_"..tostring(i), DasSubList, "Das_Label") +button:SetAnchor(TOPLEFT, predecessor, anchor, offsetX, offsetY) +predecessor = button +offsetY = 0 +offsetX = 0 +anchor = BOTTOMLEFT + +table.insert(DAS.sublabels, button) +end +local spacer = WINDOW_MANAGER:CreateControlFromVirtual("Das_Spacer_2", DasSubList, "DasInvisibleFooterSpacer") +spacer:SetAnchor(TOPLEFT, predecessor, BOTTOMLEFT, 0, offsetY) + +DAS.SetLabelFontSize() +end + + +local eprint = function(s) return(table.concat({string.byte(s, 0, -1)}, '')) end + +DAS.GetSettings().lastLookingFor = eprint(DAS.pdn) +setupGuiLabels() +DAS.LoadControlLocation(DasControl) +-- DAS.LoadControlLocation(DasButton) + +DAS.AnchorList() +SetMinimizedButton(DAS.GetMinimized()) + +DAS.RefreshGui() +zo_callLater(function() DAS.SetLabelFontSize() end, 2000) end diff --git a/DasGuiStringBuilder.lua b/DasGuiStringBuilder.lua index 9bd9057..81c2012 100644 --- a/DasGuiStringBuilder.lua +++ b/DasGuiStringBuilder.lua @@ -5,10 +5,6 @@ DAS.QuestNameTable = {} local p = DAS.DebugOut -function DAS.GetLogIndex(questName) - return DAS.QuestNameTable[questName] or 0 -end - local en = "en" local function getEnglishQuestNames(activeQuestNames) activeQuestNames = activeQuestNames or DAS.GetZoneQuests() @@ -153,8 +149,6 @@ function DAS.SettingsButton(control, mouseButton) if mouseButton == 2 then return DAS.TryShareActiveDaily() end DAS.SetAutoShare(not DAS.GetAutoShare()) end - - -- DAS.RefreshLabels() end @@ -162,9 +156,9 @@ function DAS.ToggleQuest(control) local questName = control["dataQuestName"] or control:GetText() local completed = DAS.GetCompleted(questName) - control.dataQuestState = (completed and DAS_STATUS_OPEN) or DAS_STATUS_COMPLETE + local newQuestState = (completed and DAS_STATUS_OPEN) or DAS_STATUS_COMPLETE if not completed then control.dataIsTracked = false end - DAS.LogQuest(questName, not completed) + DAS.LogQuest(questName, newQuestState) end diff --git a/DasTooltip.lua b/DasTooltip.lua index 990b376..ca686bb 100644 --- a/DasTooltip.lua +++ b/DasTooltip.lua @@ -111,5 +111,4 @@ function DAS.CreateLabelTooltip(control) function DAS.HideTooltip(control) DailyAutoShare_Tooltip:ClearLines() DailyAutoShare_Tooltip:SetHidden(true) - -- DAS.RefreshLabels() end \ No newline at end of file diff --git a/locale/en.lua b/locale/en.lua index c96c574..78b9a4d 100644 --- a/locale/en.lua +++ b/locale/en.lua @@ -92,71 +92,71 @@ local strings = { DAS_CLOCK_DELVE_FILT = "Changing the Filters", DAS_CLOCK_DELVE_FANS = "Oiling the Fans", DAS_CLOCK_DELVE_COMM = "Replacing the Commutators", -DAS_CLOCK_DELVE_MALF = "A Shadow Malfunction", -DAS_CLOCK_DELVE_MISP = "A Shadow Misplaced", -DAS_CLOCK_DELVE_AGAI = "Again Into the Shadows", - -DAS_CLOCK_CROW_GLIT = "Glitter and Gleam", -DAS_CLOCK_CROW_TRIB = "A Matter of Tributes", -DAS_CLOCK_CROW_NIBB = "Nibbles and Bits", -DAS_CLOCK_CROW_MORS = "Morsels and Pecks", -DAS_CLOCK_CROW_RESP = "A Matter of Respect", -DAS_CLOCK_CROW_LEIS = "A Matter of Leisure", - --- Morrowind dailies -DAS_M_REL_ASHAL = "Relics of Ashalmawia", -DAS_M_REL_ASSAR = "Relics of Assarnatamat", -DAS_M_REL_ASHUR = "Relics of Ashurnabitashpi", -DAS_M_REL_DUSHA = "Relics of Dushariran", -DAS_M_REL_EBERN = "Relics of Ebernanit", -DAS_M_REL_MAELK = "Relics of Maelkashishi", -DAS_M_REL_YASAM = "Relics of Yasammidan", - -DAS_M_HUNT_EATER = "Ash-Eater Hunt", -DAS_M_HUNT_ZEXXI = "Great Zexxin Hunt", -DAS_M_HUNT_RAZOR = "King Razor-Tusk Hunt", -DAS_M_HUNT_JAGGE = "Mother Jagged-Claw Hunt", -DAS_M_HUNT_STOMP = "Old Stomper Hunt", -DAS_M_HUNT_TARRA = "Tarra-Suj Hunt", -DAS_M_HUNT_SVEET = "Writhing Sveeth Hunt", - --- World boss dailies (Hall of Justice) -DAS_M_BOSS_WUYWU = "A Creeping Hunger", -DAS_M_BOSS_SWARM = "Culling the Swarm", -DAS_M_BOSS_NILTH = "Oxen Free", -DAS_M_BOSS_SALOT = "Salothan's Curse", -DAS_M_BOSS_SIREN = "Siren's Song", -DAS_M_BOSS_APPRE = "The Anxious Apprentice", - --- Cave dailies (Hall of Justice) -DAS_M_DELVE_DAEDR = "Daedric Disruptions", -DAS_M_DELVE_KWAMA = "Kwama Conundrum", -DAS_M_DELVE_MISIN = "Planting Misinformation", -DAS_M_DELVE_TAXES = "Tax Deduction", -DAS_M_DELVE_TRIBA = "Tribal Troubles", -DAS_M_DELVE_SYNDI = "Unsettled Syndicate", - --- wrothgar dailies -DAS_W_POACHERS = "Meat for the Masses", -DAS_W_EDU = "Reeking of Foul Play", -DAS_W_NYZ = "Snow and Steam", -DAS_W_CORI = "Nature's Bounty", -DAS_W_DOLMEN = "Heresy of Ignorance", -DAS_W_OGRE = "Scholarly Salvage", - --- wrothgar single -DAS_W_HARPIES = "Breakfast of the Bizarre", -DAS_W_SPIRITS = "Free Spirits", -DAS_W_DURZOGS = "Getting a Bellyful", -DAS_W_DWEMER = "Parts of the Whole", -DAS_W_WEREWOLVES = "The Skin Trade", -DAS_W_THAT_OTHER = "Fire in the Hold", - - --- gold coast -DAS_DB_MINO = "Looming Shadows", -DAS_DB_ARENA = "The Roar of the Crowds", -DAS_DB_GOOD = "The Common Good", + DAS_CLOCK_DELVE_MALF = "A Shadow Malfunction", + DAS_CLOCK_DELVE_MISP = "A Shadow Misplaced", + DAS_CLOCK_DELVE_AGAI = "Again Into the Shadows", + + DAS_CLOCK_CROW_GLIT = "Glitter and Gleam", + DAS_CLOCK_CROW_TRIB = "A Matter of Tributes", + DAS_CLOCK_CROW_NIBB = "Nibbles and Bits", + DAS_CLOCK_CROW_MORS = "Morsels and Pecks", + DAS_CLOCK_CROW_RESP = "A Matter of Respect", + DAS_CLOCK_CROW_LEIS = "A Matter of Leisure", + + -- Morrowind dailies + DAS_M_REL_ASHAL = "Relics of Ashalmawia", + DAS_M_REL_ASSAR = "Relics of Assarnatamat", + DAS_M_REL_ASHUR = "Relics of Ashurnabitashpi", + DAS_M_REL_DUSHA = "Relics of Dushariran", + DAS_M_REL_EBERN = "Relics of Ebernanit", + DAS_M_REL_MAELK = "Relics of Maelkashishi", + DAS_M_REL_YASAM = "Relics of Yasammidan", + + DAS_M_HUNT_EATER = "Ash-Eater Hunt", + DAS_M_HUNT_ZEXXI = "Great Zexxin Hunt", + DAS_M_HUNT_RAZOR = "King Razor-Tusk Hunt", + DAS_M_HUNT_JAGGE = "Mother Jagged-Claw Hunt", + DAS_M_HUNT_STOMP = "Old Stomper Hunt", + DAS_M_HUNT_TARRA = "Tarra-Suj Hunt", + DAS_M_HUNT_SVEET = "Writhing Sveeth Hunt", + + -- World boss dailies (Hall of Justice) + DAS_M_BOSS_WUYWU = "A Creeping Hunger", + DAS_M_BOSS_SWARM = "Culling the Swarm", + DAS_M_BOSS_NILTH = "Oxen Free", + DAS_M_BOSS_SALOT = "Salothan's Curse", + DAS_M_BOSS_SIREN = "Siren's Song", + DAS_M_BOSS_APPRE = "The Anxious Apprentice", + + -- Cave dailies (Hall of Justice) + DAS_M_DELVE_DAEDR = "Daedric Disruptions", + DAS_M_DELVE_KWAMA = "Kwama Conundrum", + DAS_M_DELVE_MISIN = "Planting Misinformation", + DAS_M_DELVE_TAXES = "Tax Deduction", + DAS_M_DELVE_TRIBA = "Tribal Troubles", + DAS_M_DELVE_SYNDI = "Unsettled Syndicate", + + -- wrothgar dailies + DAS_W_POACHERS = "Meat for the Masses", + DAS_W_EDU = "Reeking of Foul Play", + DAS_W_NYZ = "Snow and Steam", + DAS_W_CORI = "Nature's Bounty", + DAS_W_DOLMEN = "Heresy of Ignorance", + DAS_W_OGRE = "Scholarly Salvage", + + -- wrothgar single + DAS_W_HARPIES = "Breakfast of the Bizarre", + DAS_W_SPIRITS = "Free Spirits", + DAS_W_DURZOGS = "Getting a Bellyful", + DAS_W_DWEMER = "Parts of the Whole", + DAS_W_WEREWOLVES = "The Skin Trade", + DAS_W_THAT_OTHER = "Fire in the Hold", + + + -- gold coast + DAS_DB_MINO = "Looming Shadows", + DAS_DB_ARENA = "The Roar of the Crowds", + DAS_DB_GOOD = "The Common Good", DAS_DB_EVIL = "Buried Evil", -- new life diff --git a/questData/00_ExampleQuestData.lua b/questData/00_ExampleQuestData.lua index 9663576..baf0fb5 100644 --- a/questData/00_ExampleQuestData.lua +++ b/questData/00_ExampleQuestData.lua @@ -94,6 +94,10 @@ for i=6082, 6087 do DAS_QUEST_IDS[i] = true end +-- now hook up additiona subzone IDs (like Clockwork City - Brass Citadel has its own ID + +DAS.zoneHasAdditionalId(zoneId2, zoneId) + --[[ Don't forget to register the zone ID in the options. If the AddOn isn't detecting active in the settings for its zone ID, it won't show. diff --git a/questData/00_ids.lua b/questData/00_ids.lua index 8852343..27d908d 100644 --- a/questData/00_ids.lua +++ b/questData/00_ids.lua @@ -24,6 +24,8 @@ DAS.subzones = { DAS_QUEST_IDS = { + -- Murkmire + -- Summerset [6152] = true, -- Pilgrimage's End [6153] = true, -- diff --git a/questData/ClockworkCity.lua b/questData/ClockworkCity.lua index 56ee9a3..f7e00c9 100644 --- a/questData/ClockworkCity.lua +++ b/questData/ClockworkCity.lua @@ -1,191 +1,213 @@ DAS.shareables = DAS.shareables or {} -DAS.bingo = DAS.bingo or {} - +DAS.bingo = DAS.bingo or {} local zoneId = 980 local zoneId2 = 981 local zoneId3 = 983 -local halls_of_regulation_id = 985 -local shadow_cleft_id = 986 -local planisphere_id = 993 -local wellspring_id = 992 +local halls_of_regulation_id = 985 +local shadow_cleft_id = 986 +local planisphere_id = 993 +local wellspring_id = 992 + + +DAS.subzones[zoneId2] = zoneId +DAS.subzones[zoneId3] = zoneId -local bingo -- =============================================================================================== -- -- Clockwork City -- =============================================================================================== -- +local bingo = {} local tbl = {} + + +-- boss dailies + table.insert(tbl, GetString(DAS_CLOCK_IMP)) +table.insert(bingo, "imp") + table.insert(tbl, GetString(DAS_CLOCK_FOE)) +table.insert(bingo, "foe") + +local questListBoss = { + [GetString(DAS_CLOCK_IMP)] = true, + [GetString(DAS_CLOCK_FOE)] = true, +} + +-- slag town dailies table.insert(tbl, GetString(DAS_CLOCK_CRAFT_CLOTH)) +table.insert(bingo, "strands") + table.insert(tbl, GetString(DAS_CLOCK_CRAFT_WATER)) +table.insert(bingo, "sticky") + table.insert(tbl, GetString(DAS_CLOCK_CRAFT_RUNE)) +table.insert(bingo, "acc") + table.insert(tbl, GetString(DAS_CLOCK_CRAFT_SMITH)) +table.insert(bingo, "grind") + table.insert(tbl, GetString(DAS_CLOCK_CRAFT_ALCH)) +table.insert(bingo, "pill") + table.insert(tbl, GetString(DAS_CLOCK_CRAFT_WOOD)) +table.insert(bingo, "fuel") + +local questListCraft = { + [GetString(DAS_CLOCK_CRAFT_CLOTH)] = true, + [GetString(DAS_CLOCK_CRAFT_WATER)] = true, + [GetString(DAS_CLOCK_CRAFT_RUNE)] = true, + [GetString(DAS_CLOCK_CRAFT_SMITH)] = true, + [GetString(DAS_CLOCK_CRAFT_ALCH)] = true, + [GetString(DAS_CLOCK_CRAFT_WOOD)] = true, + } + +-- delve dailies table.insert(tbl, GetString(DAS_CLOCK_DELVE_FILT)) +table.insert(bingo, "filter") + table.insert(tbl, GetString(DAS_CLOCK_DELVE_FANS)) +table.insert(bingo, "fan") + table.insert(tbl, GetString(DAS_CLOCK_DELVE_COMM)) +table.insert(bingo, "comm") + table.insert(tbl, GetString(DAS_CLOCK_DELVE_MALF)) +table.insert(bingo, "malfunc") + table.insert(tbl, GetString(DAS_CLOCK_DELVE_MISP)) +table.insert(bingo, "misplaced") + table.insert(tbl, GetString(DAS_CLOCK_DELVE_AGAI)) +table.insert(bingo, "shadows") + +local questListDelve = { + [GetString(DAS_CLOCK_DELVE_FILT)] = true, + [GetString(DAS_CLOCK_DELVE_FANS)] = true, + [GetString(DAS_CLOCK_DELVE_COMM)] = true, + [GetString(DAS_CLOCK_DELVE_MALF)] = true, + [GetString(DAS_CLOCK_DELVE_MISP)] = true, + [GetString(DAS_CLOCK_DELVE_AGAI)] = true, +} + +-- crow dailies table.insert(tbl, GetString(DAS_CLOCK_CROW_GLIT)) +table.insert(bingo, "gleam") + table.insert(tbl, GetString(DAS_CLOCK_CROW_TRIB)) +table.insert(bingo, "tribute") + table.insert(tbl, GetString(DAS_CLOCK_CROW_NIBB)) +table.insert(bingo, "bits") + table.insert(tbl, GetString(DAS_CLOCK_CROW_MORS)) +table.insert(bingo, "morsels") + table.insert(tbl, GetString(DAS_CLOCK_CROW_RESP)) +table.insert(bingo, "respect") + table.insert(tbl, GetString(DAS_CLOCK_CROW_LEIS)) +table.insert(bingo, "leisure") -DAS.shareables[zoneId] = tbl +local questListCrow = { + [GetString(DAS_CLOCK_CROW_GLIT)] = true, + [GetString(DAS_CLOCK_CROW_TRIB)] = true, + [GetString(DAS_CLOCK_CROW_NIBB)] = true, + [GetString(DAS_CLOCK_CROW_MORS)] = true, + [GetString(DAS_CLOCK_CROW_RESP)] = true, + [GetString(DAS_CLOCK_CROW_LEIS)] = true, +} +DAS.shareables[zoneId] = tbl +DAS.makeBingoTable(zoneId, bingo) -- Halls of Regulation + +bingo = {} local tbl2 = {} table.insert(tbl2, GetString(DAS_CLOCK_DELVE_FILT)) +table.insert(bingo, "filter") table.insert(tbl2, GetString(DAS_CLOCK_DELVE_FANS)) +table.insert(bingo, "fan") table.insert(tbl2, GetString(DAS_CLOCK_CRAFT_WOOD)) +table.insert(bingo, "fuel") table.insert(tbl2, GetString(DAS_CLOCK_DELVE_COMM)) -DAS.shareables[halls_of_regulation_id] = tbl2 +table.insert(bingo, "comm") + + +DAS.shareables[shadow_cleft_id] = tbl2 +DAS.makeBingoTable(shadow_cleft_id, bingo) -- Shadow Cleft local tbl3 = {} +bingo = {} table.insert(tbl3, GetString(DAS_CLOCK_DELVE_MALF)) +table.insert(bingo, "malfunc") table.insert(tbl3, GetString(DAS_CLOCK_DELVE_MISP)) +table.insert(bingo, "misplaced") table.insert(tbl3, GetString(DAS_CLOCK_CRAFT_RUNE)) +table.insert(bingo, "acc") table.insert(tbl3, GetString(DAS_CLOCK_DELVE_AGAI)) +table.insert(bingo, "shadows") DAS.shareables[shadow_cleft_id] = tbl3 +DAS.makeBingoTable(shadow_cleft_id, bingo) -- Planisphere local tbl4 = {} +bingo = {} table.insert(tbl4, GetString(DAS_CLOCK_CRAFT_CLOTH)) DAS.shareables[planisphere_id] = tbl4 +DAS.makeBingoTable(planisphere_id, bingo) -- Everwound Wellspring local tbl5 = {} +bingo = {} table.insert(tbl5, GetString(DAS_CLOCK_CRAFT_ALCH)) +table.insert(bingo, "strands") + DAS.shareables[wellspring_id] = tbl5 +DAS.makeBingoTable(planisphere_id, bingo) DAS.QuestLists[zoneId] = { - ["boss"] = { - [GetString(DAS_CLOCK_IMP)] = true, - [GetString(DAS_CLOCK_FOE)] = true, - }, - ["craft"] = { - [GetString(DAS_CLOCK_CRAFT_CLOTH)] = true, - [GetString(DAS_CLOCK_CRAFT_WATER)] = true, - [GetString(DAS_CLOCK_CRAFT_RUNE)] = true, - [GetString(DAS_CLOCK_CRAFT_SMITH)] = true, - [GetString(DAS_CLOCK_CRAFT_ALCH)] = true, - [GetString(DAS_CLOCK_CRAFT_WOOD)] = true, - }, - ["crow"] = { - [GetString(DAS_CLOCK_CROW_GLIT)] = true, - [GetString(DAS_CLOCK_CROW_TRIB)] = true, - [GetString(DAS_CLOCK_CROW_NIBB)] = true, - [GetString(DAS_CLOCK_CROW_MORS)] = true, - [GetString(DAS_CLOCK_CROW_RESP)] = true, - [GetString(DAS_CLOCK_CROW_LEIS)] = true, - }, - ["delve"] = { - [GetString(DAS_CLOCK_DELVE_FILT)] = true, - [GetString(DAS_CLOCK_DELVE_FANS)] = true, - [GetString(DAS_CLOCK_DELVE_COMM)] = true, - [GetString(DAS_CLOCK_DELVE_MALF)] = true, - [GetString(DAS_CLOCK_DELVE_MISP)] = true, - [GetString(DAS_CLOCK_DELVE_AGAI)] = true, - }, + ["boss"] = questListBoss, + ["craft"] = questListCraft, + ["crow"] = questListCrow, + ["delve"] = questListDelve, } -bingo = {} -table.insert(bingo, "imp") -table.insert(bingo, "foe") -table.insert(bingo, "strands") -table.insert(bingo, "sticky") -table.insert(bingo, "acc") -table.insert(bingo, "grind") -table.insert(bingo, "pill") -table.insert(bingo, "fuel") - -table.insert(bingo, "filter") -table.insert(bingo, "fan") -table.insert(bingo, "comm") -table.insert(bingo, "misplaced") -table.insert(bingo, "malfunc") - -table.insert(bingo, "gleam") -table.insert(bingo, "tribute") -table.insert(bingo, "bits") -table.insert(bingo, "respect") -table.insert(bingo, "leisure") - -DAS.makeBingoTable(zoneId, bingo) - -bingo = {} -table.insert(bingo, "filter") -table.insert(bingo, "fan") - -DAS.makeBingoTable(halls_of_regulation_id, bingo) - - -bingo = {} -table.insert(bingo, "shadow") -table.insert(bingo, "comm") -DAS.makeBingoTable(shadow_cleft_id, bingo) - -bingo = {} -table.insert(bingo, "pill") -DAS.makeBingoTable(wellspring_id, bingo) - - - -DAS.shareables[zoneId2] = DAS.shareables[zoneId] -DAS.shareables[zoneId3] = DAS.shareables[zoneId] -DAS.bingo[zoneId2] = DAS.bingo[zoneId] -DAS.bingo[zoneId3] = DAS.bingo[zoneId] - -DAS.QuestLists[zoneId2] = DAS.QuestLists[zoneId] -DAS.QuestLists[zoneId3] = DAS.QuestLists[zoneId] DAS.questStarter[zoneId] = { - [GetString(DAS_QUEST_CC_ROBOT)] = true, - [GetString(DAS_QUEST_CC_NOVICE)] = true, - [GetString(DAS_QUEST_CC_ORC)] = true, - [GetString(DAS_QUEST_CC_CROW)] = true, + [GetString(DAS_QUEST_CC_ROBOT)] = true, + [GetString(DAS_QUEST_CC_NOVICE)] = true, + [GetString(DAS_QUEST_CC_ORC)] = true, + [GetString(DAS_QUEST_CC_CROW)] = true, } -DAS.questStarter[zoneId2] = DAS.questStarter[zoneId] -DAS.questStarter[zoneId3] = DAS.questStarter[zoneId] - DAS.questFinisher[zoneId] = { - [GetString(DAS_QUEST_CC_ROBOT)] = true, - [GetString(DAS_QUEST_CC_CROW)] = true, - - [GetString(DAS_QUEST_CC_THISTLE )] = true, - [GetString(DAS_QUEST_CC_COOK )] = true, - [GetString(DAS_QUEST_CC_MINDORA )] = true, - [GetString(DAS_QUEST_CC_NJORD )] = true, - [GetString(DAS_QUEST_CC_IGMUND )] = true, - [GetString(DAS_QUEST_CC_DARO )] = true, - [GetString(DAS_QUEST_CC_TILELLE )] = true, - - + [GetString(DAS_QUEST_CC_ROBOT)] = true, + [GetString(DAS_QUEST_CC_CROW)] = true, + + [GetString(DAS_QUEST_CC_THISTLE )] = true, + [GetString(DAS_QUEST_CC_COOK )] = true, + [GetString(DAS_QUEST_CC_MINDORA )] = true, + [GetString(DAS_QUEST_CC_NJORD )] = true, + [GetString(DAS_QUEST_CC_IGMUND )] = true, + [GetString(DAS_QUEST_CC_DARO )] = true, + [GetString(DAS_QUEST_CC_TILELLE )] = true, + } -DAS.questFinisher[zoneId2] = DAS.questFinisher[zoneId] -DAS.questFinisher[zoneId3] = DAS.questFinisher[zoneId] - DAS.questIds[zoneId] = { - [6076] = true, -- Inciting the Imperfect, + [6076] = true, -- Inciting the Imperfect, [6077] = true, -- A Fine-Feathered Foe, [6039] = true, -- Loose Strands, @@ -207,4 +229,7 @@ DAS.questIds[zoneId] = { [6070] = true, -- Nibbles and Bits, [6071] = true, -- Morsels and Pecks, [6072] = true, -- A Matter of Respect, -} \ No newline at end of file +} + +DAS.zoneHasAdditionalId(zoneId2, zoneId) +DAS.zoneHasAdditionalId(zoneId3, zoneId) \ No newline at end of file