diff --git a/00_startup.lua b/00_startup.lua new file mode 100644 index 0000000..b3bbd80 --- /dev/null +++ b/00_startup.lua @@ -0,0 +1,462 @@ +DailyAutoShare = DailyAutoShare or {} +DAS = DailyAutoShare +local DailyAutoShare = DailyAutoShare + +DAS.name = "DailyAutoshare" +DAS.version = "3.2.0" +DAS.author = "manavortex" +DAS.settings = {} +DAS.globalSettings = {} + +DAS.shareables = {} +DAS.bingo = {} +DAS.bingoFallback = {} +DAS.subzones = {} +DAS.activeZoneQuests = {} + +DAS.questFinisher = {} +DAS.questStarter = {} +DAS.questIds = {} +DAS.channelTypes = { + [CHAT_CHANNEL_PARTY] = true, + [CHAT_CHANNEL_SAY ] = false, + [CHAT_CHANNEL_YELL] = false, + [CHAT_CHANNEL_ZONE] = false, + [CHAT_CHANNEL_WHISPER] = false, +} + +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 + +local activeInCurrentZone = false +DAS.fullBingoString = "" +local fullBingoString = DAS.fullBingoString + +local defaults = { + + ["singleDailies"] = {}, + ["shareableDailies"] = {}, + ["speakStupid"] = false, + ["debug"] = false, + ["keepInviteUpOnDegroup"] = false, + + ["DasControl"] = { + ["x"] = 0, + ["y"] = 0, + }, + ["DasButton"] = { + ["x"] = 0, + ["y"] = 0, + }, + ["inactiveZones"] = { + ["hide"] = true, + }, + [849] = { + ["relic"] = { + ["invisible"] = false, + ["active"] = true, + }, + ["hunt"] = { + ["invisible"] = false, + ["active"] = true, + }, + ["delve"] = { + ["invisible"] = false, + ["active"] = true, + }, + ["boss"] = { + ["invisible"] = false, + ["active"] = true, + }, + }, + [980] = { + ["crow"] = { + ["invisible"] = false, + ["active"] = true, + }, + ["craft"] = { + ["invisible"] = false, + ["active"] = true, + }, + ["delve"] = { + ["invisible"] = false, + ["active"] = true, + }, + ["boss"] = { + ["invisible"] = false, + ["active"] = true, + }, + }, + questShareString = "I can give a DailyAutoShare for <<1>>, type <<2>> for an instant invite", + debugOutput = false, + currentlyWithQuest = false, + currentQuestIndex = nil, + currentQuestName = nil, + autoTrack = false, + autoAcceptInvite = false, + autoAcceptInviteInterval = 5, + autoAcceptQuest = true, + autoAcceptShared = true, + autoDeclineShared = false, + autoHide = false, + autoMinimize = false, + autoShare = true, + autoAcceptAllDailies = false, + autoInvite = false, + autoLeave = false, + useGlobalSettings = true, + minimised = false, + locked = false, + hidden = false, + fontScale = 1, + tooltipRight = false, + upsideDown = false, + hideCompleted = false, + startupMinimized = true, + resetAutoShareOnNewGroup = true, + lastLookingFor = "", + guildInviteNumber = 1, + groupInviteDelay = 500, + questShareDelay = 500, + guildInviteText, + questShareString = "I can give a DailyAutoShare for <<1>>, type <<2>> for an instant invite", + listenInGuilds, + ["tracked"] = { + [684] = true, + [823] = true, + [849] = true, -- Vvardenfell + [181] = false, + [1011] = false, -- Summerset + }, +} + +local function pointerUpSubzones() + + -- Gold Coast + defaults[825] = defaults[823] + defaults[826] = defaults[823] + defaults.tracked[825] = defaults.tracked[823] + defaults.tracked[826] = defaults.tracked[823] + + -- Capitals + defaults[19] = defaults[57] + defaults[383] = defaults[57] + defaults.tracked[19] = defaults.tracked[57] + defaults.tracked[383] = defaults.tracked[57] + + -- Clockwork City + defaults[981] = defaults[980] + defaults[981] = defaults[980] + defaults[982] = defaults[980] + defaults.tracked[982] = defaults.tracked[980] + defaults.tracked[983] = defaults.tracked[980] + defaults.tracked[983] = defaults.tracked[980] + + -- Morrowind + defaults[921] = defaults[849] + defaults[922] = defaults[849] + defaults[923] = defaults[849] + defaults[924] = defaults[849] + defaults[925] = defaults[849] + defaults[961] = defaults[849] + defaults.tracked[921] = defaults.tracked[849] + defaults.tracked[922] = defaults.tracked[849] + defaults.tracked[923] = defaults.tracked[849] + defaults.tracked[924] = defaults.tracked[849] + defaults.tracked[925] = defaults.tracked[849] + defaults.tracked[961] = defaults.tracked[849] + + -- Wrothgar + defaults[689] = defaults[684] + defaults[690] = defaults[684] + defaults[691] = defaults[684] + defaults[692] = defaults[684] + defaults[693] = defaults[684] + defaults[694] = defaults[684] + defaults.tracked[689] = defaults.tracked[684] + defaults.tracked[690] = defaults.tracked[684] + defaults.tracked[691] = defaults.tracked[684] + defaults.tracked[692] = defaults.tracked[684] + defaults.tracked[693] = defaults.tracked[684] + defaults.tracked[694] = defaults.tracked[684] +end +pointerUpSubzones() + +local characterName = zo_strformat(GetUnitName('player')) + +local allDailyQuestIds = DAS_QUEST_IDS + +local em = EVENT_MANAGER + +local function debugOut(p1, p2, p3, p4, p5, p6, p7, p8) + if (not p2) then d(p1); return; end + if p8 then + d(zo_strformat("<<1>> <<2>> <<3>> <<4>> <<5>> <<6>> <<7>> <<8>>", p1, p2, p3, p4, p5, p6, p7, p8)) + elseif p7 then + d(zo_strformat("<<1>> <<2>> <<3>> <<4>> <<5>> <<6>> <<7>>", p1, p2, p3, p4, p5, p6, p7)) + elseif p6 then + d(zo_strformat("<<1>> <<2>> <<3>> <<4>> <<5>> <<6>>", p1, p2, p3, p4, p5, p6)) + elseif p5 then + d(zo_strformat("<<1>> <<2>> <<3>> <<4>> <<5>>", p1, p2, p3, p4, p5)) + elseif p4 then + d(zo_strformat("<<1>> <<2>> <<3>> <<4>>", p1, p2, p3, p4)) + elseif p3 then + d(zo_strformat("<<1>> <<2>> <<3>>", p1, p2, p3)) + else + d(zo_strformat("<<1>> <<2>>", p1, p2)) + end +end +DAS.DebugOut = debugOut +local p = debugOut + +function DAS.Report(text) + if not DAS.GetShutUp() then d(text) end +end + +--============================== +--======= Event hooks ========= +--============================== + +local function OnGroupTypeChanged(eventCode, unitTag) + if IsUnitGrouped("player") then + if not DAS.GetAutoShare() and DAS.GetResetAutoShareOnNewGroup() then + DAS.SetAutoShare(true) + end + return + end + + if DAS.GetStopInviteOnDegroup() then + DAS.SetAutoInvite(false) + end + +end + +local function forceRefreshControl() + DAS.RefreshControl(true) +end + +local function OnQuestAdded(eventCode, journalIndex, questName, objectiveName) + + local zoneId = DAS.GetZoneId() + if not DAS.GetActiveIn(zoneId) then return end + if not GetIsQuestSharable(journalIndex) then return end + local shareables = DAS.shareables[zoneId] or {} + + if nil ~= shareables[questName] then + DAS.LogQuest(questName, false) + zo_callLater(forceRefreshControl, 700) + end +end + +local function OnQuestShared(eventCode, questId) + -- d(zo_strformat("<<1>> \t <<2>>", questId, questName)) + if not allDailyQuestIds[questId] then return end + local zoneQuests = DAS.questIds[DAS.GetZoneId()] or {} + + if zoneQuests[questId] then + if DAS.GetAutoDeclineShared() then + DAS.Report("DailyAutoShare declined a quest for you. Type /DailyAutoShare disabledecline to stop it from doing so.") + DeclineSharedQuest(questId) + else + AcceptSharedQuest(questId) + zo_callLater(forceRefreshControl, 500) + end + end +end + +local function OnChatMessage(eventCode, channelType, fromName, messageText, _, fromDisplayName) + return DAS.OnChatMessage(eventCode, channelType, fromName, messageText, _, fromDisplayName) +end + + +local function OnPlayerActivated(eventCode) + local active = DAS.GetActiveIn() + DAS.SetHidden(not active) + DAS.SetAutoInvite(DAS.GetAutoInvite()) -- disables if we aren't group lead + DAS.SetChatListenerStatus(DAS.autoInviting) + DAS.guildInviteText = DAS.GetGuildInviteText() + DAS.cacheChatterData() +end + +local function OnUnitCreated(eventCode, unitTag) + local unitZone = GetZoneId(GetUnitZoneIndex(unitTag)) + if not DAS.GetActiveIn(unitZone) then return end + if GetUnitDisplayName(unitTag) == cachedDisplayName then return end + DAS.TryShareActiveDaily(unitZone) +end + +local function OnQuestToolUpdate() + forceRefreshControl() +end + +local function OnQuestRemoved(eventCode, isCompleted, journalIndex, questName, zoneIndex, poiIndex, questId) + + local zoneId = DAS.GetZoneId() + local zoneIds = DAS.questIds[zoneId] or {} + -- is it a daily quest, and are we logging? + if not (zoneIds[questId] and DAS.GetActiveIn(zoneId)) then return end + + DAS.LogQuest(questName, isCompleted) + + -- set auto invite off until the questlog has refreshed + local autoInvite = DAS.GetAutoInvite() + DAS.SetAutoInvite(false) + + zo_callLater(function() + DAS.SetAutoInvite(autoInvite) + forceRefreshControl() + 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 QUEST_TRACKER = QUEST_TRACKER or FOCUSED_QUEST_TRACKER +local function hookQuestTracker() + -- pts fix + + local function refreshLabels() + DAS.RefreshLabels(false, true) + end + + if nil ~= QUEST_TRACKER then + ZO_PreHook(QUEST_TRACKER, "ForceAssist", refreshLabels) + end +end + +--============================== +--= DailyAutoShare_Initialize == +--============================== + +local function RegisterEventHooks() + + DailyAutoShare.Fragment = ZO_HUDFadeSceneFragment:New(DasControl) + + SCENE_MANAGER:GetScene("hud" ):AddFragment(DailyAutoShare.Fragment) + SCENE_MANAGER:GetScene("hudui"):AddFragment(DailyAutoShare.Fragment) + hookQuestTracker() + + em:RegisterForEvent(DAS.name, EVENT_PLAYER_ACTIVATED, OnPlayerActivated) + + em:RegisterForEvent(DAS.name, EVENT_QUEST_ADDED, OnQuestToolUpdate) + em:RegisterForEvent(DAS.name, EVENT_QUEST_REMOVED, OnQuestRemoved) + em:RegisterForEvent(DAS.name, EVENT_TRACKING_UPDATE, OnQuestToolUpdate) + + em:RegisterForEvent(DAS.name, EVENT_QUEST_ADDED, OnQuestAdded) + em:RegisterForEvent(DAS.name, EVENT_QUEST_REMOVED, OnQuestRemoved) + em:RegisterForEvent(DAS.name, EVENT_QUEST_SHARED, OnQuestShared) + + em:RegisterForEvent(DAS.name, EVENT_GROUP_TYPE_CHANGED, OnGroupTypeChanged) + em:RegisterForEvent(DAS.name, EVENT_UNIT_CREATED, OnUnitCreated) + em:RegisterForEvent(DAS.name, EVENT_UNIT_DESTROYED, OnGroupTypeChanged) + + 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) + local ret = true + for key, value in pairs(tbl) do + if type(value) == typeTable then + ret = ret and 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(forceReset) + local allLogs = DAS.globalSettings.completionLog + local currentDate = tonumber(GetDate()) + DAS.globalSettings.completionLog[currentDate] = DAS.globalSettings.completionLog[currentDate] or {} + + local logSize, lastDate = NonContiguousCount(DAS.globalSettings.completionLog) + + if forceReset then + return resetQuests() + end + local counter = 0 + for dateNumber, dateLog in pairs(DAS.globalSettings.completionLog) do + counter = counter + 1 + if dateNumber < currentDate then + lastDate = dateNumber + end + if counter < logSize-2 then + DAS.globalSettings.completionLog[dateNumber] = nil + end + end + + local afterEight = 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 + DAS.globalSettings.completionLog[currentDate] = ZO_DeepTableCopy(DAS.globalSettings.completionLog[lastDate], {}) + for charName, charLog in pairs(DAS.globalSettings.completionLog[currentDate]) do + for questName, questData in pairs(charLog) do + questData.afterEight = false + end + end + end + + DAS.todaysLog = DAS.globalSettings.completionLog[currentDate] +end +DAS.handleLog = handleLog + +local function minimiseOnStartup() + DAS.SetMinimized(DAS.GetSettings().startupMinimized) +end +--============================== +--===== Rise, my minion! ====== +--============================== + +function DailyAutoShare_Initialize(eventCode, addonName) + + if addonName ~="DailyAutoShare" 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') + + RegisterEventHooks() + + DailyAutoShare.CreateMenu(DailyAutoShare.settings, defaults) + DAS.CreateGui() + + -- local timetoreset = (GetTimeStamp() - 60*60*7)%86400 + -- zo_callLater(resetQuests, timetoreset) + + + handleLog() + zo_callLater(OnPlayerActivated, 5000) + zo_callLater(minimiseOnStartup, 5500) + EVENT_MANAGER:UnregisterForEvent("DailyAutoShare", EVENT_ADD_ON_LOADED) + +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 870709c..6eccba8 100644 --- a/DASContextMenu.lua +++ b/DASContextMenu.lua @@ -1,6 +1,9 @@ local guiHeight = GuiRoot:GetHeight() local guiWidth = GuiRoot:GetWidth() +local questName, journalIndex, bingoString, currentControl +local QUEST_TRACKER = QUEST_TRACKER or FOCUSED_QUEST_TRACKER + local function getAnchorPos(control) local menuWidth = ZO_Menu:GetWidth() local menuHeight = ZO_Menu:GetWidth() @@ -11,7 +14,7 @@ local function getAnchorPos(control) local isTooHigh = (controlTop + menuHeight) >= guiHeight - if DAS.GetTooltipRight() then + if DAS.GetSettings().tooltipRight then if (controlRight + menuWidth) >= guiWidth then if isTooHigh then return BOTTOMRIGHT, TOPLEFT end return TOPRIGHT, TOPLEFT @@ -36,13 +39,35 @@ local function spamChat(questName, bingoString) StartChatInput(chatInputString, CHAT_CHANNEL_ZONE) end + +local function forceAssist() + if nil ~= QUEST_TRACKER then + QUEST_TRACKER:ForceAssist(journalIndex) + end +end +local function shareQuest() + ShareQuest(journalIndex) +end +local function abandonQuest() + AbandonQuest(journalIndex) + DAS.LogQuest(questName, false) + DAS.RefreshLabels(true) +end +local function toggleQuest() + DAS.ToggleQuest(currentControl) + zo_callLater(DAS.RefreshLabels, 500) +end +local function toggleSubList() + DasSubList:SetHidden(not DasSubList:IsHidden()) +end + function DAS.OnRightClick(control, verbose) if nil == control then return end - local questName = control.dataQuestName - local journalIndex = control.dataJournalIndex - local bingoString = control.dataBingoString - + questName = control.dataQuestName + journalIndex = control.dataJournalIndex + bingoString = control.dataBingoString + currentControl = control local menuShowing = IsMenuVisisble() and GetMenuOwner() == control ClearMenu() @@ -51,44 +76,40 @@ function DAS.OnRightClick(control, verbose) SetMenuSpacing(3) SetMenuPad(10) SetMenuMinimumWidth(185) - if control.dataQuestState ~= DAS_STATUS_COMPLETE then - AddCustomMenuItem(GetString(DAS_SI_SPAM_SINGLE), - function() - spamChat(questName, bingoString) - end, + if nil ~= control.dataQuestList then + AddCustomMenuItem(GetString(DAS_TOGGLE_SUBLIST), + toggleSubList, MENU_ADD_OPTION_LABEL ) - end - if IsValidQuestIndex(control.dataJournalIndex) then - AddCustomMenuItem(GetString(DAS_SI_SHARE), - function() ShareQuest(journalIndex) end, - MENU_ADD_OPTION_LABEL - ) - AddCustomMenuItem("* Focus", - function() - QUEST_TRACKER:ForceAssist(journalIndex) - DAS.RefreshLabels(false, true) - end, - MENU_ADD_OPTION_LABEL - ) - AddCustomMenuItem(GetString(DAS_SI_ABANDON), - function() - AbandonQuest(journalIndex) - DAS.LogQuest(questName, false) - DAS.RefreshLabels(true) - end, - MENU_ADD_OPTION_LABEL - ) - else - local key = (control.dataQuestState == DAS_STATUS_OPEN and DAS_SI_SETOPEN_TRUE) or DAS_SI_SETOPEN_FALSE - AddCustomMenuItem(GetString(key), - function() - DAS.ToggleQuest(control) - zo_callLater(DAS.RefreshLabels, 500) - end, - MENU_ADD_OPTION_LABEL - ) - end + else + if control.dataQuestState ~= DAS_STATUS_COMPLETE then + AddCustomMenuItem(GetString(DAS_SI_SPAM_SINGLE), + spamChat, + MENU_ADD_OPTION_LABEL + ) + end + if IsValidQuestIndex(control.dataJournalIndex) then + AddCustomMenuItem(GetString(DAS_SI_SHARE), + shareQuest, + MENU_ADD_OPTION_LABEL + ) + AddCustomMenuItem("* Focus", + forceAssist, + MENU_ADD_OPTION_LABEL + ) + AddCustomMenuItem(GetString(DAS_SI_ABANDON), + abandonQuest, + MENU_ADD_OPTION_LABEL + ) + else + local key = (control.dataQuestState == DAS_STATUS_OPEN and DAS_SI_SETOPEN_TRUE) or DAS_SI_SETOPEN_FALSE + AddCustomMenuItem(GetString(key), + toggleQuest, + MENU_ADD_OPTION_LABEL + ) + end + + end local myAnchor, parentAnchor = getAnchorPos(control) @@ -98,9 +119,7 @@ function DAS.OnRightClick(control, verbose) end - - - + end function DAS.InitRightclickMenu() diff --git a/DASData.lua b/DASData.lua index 4998d1d..9677541 100644 --- a/DASData.lua +++ b/DASData.lua @@ -37,6 +37,7 @@ DAS.festivals = { [381] = "newLife", } + function DAS.GetZoneId() return GetZoneId(GetUnitZoneIndex('player')) or 0 end function PrintZoneId() d(GetZoneId(GetUnitZoneIndex('player'))) end diff --git a/DASHelper.lua b/DASHelper.lua index ff3408e..c6a7324 100644 --- a/DASHelper.lua +++ b/DASHelper.lua @@ -4,9 +4,43 @@ function DAS.GetArrayEntry(array, key) if nil == array or nil == key then return end if nil ~= array[key] then return array[key] end for i=1, #array do - if DAS.IsMatch(array[i], key) then return true end + if array[i] == key then return array[i] end end end +function DAS.SetChatListenerStatus(status) + + DAS.channelTypes[CHAT_CHANNEL_SAY ] = status + DAS.channelTypes[CHAT_CHANNEL_YELL] = status + DAS.channelTypes[CHAT_CHANNEL_ZONE] = status + DAS.channelTypes[CHAT_CHANNEL_WHISPER] = status + +end + +-- DAS_STATUS_COMPLETE = 0, +-- DAS_STATUS_OPEN = 1, +-- DAS_STATUS_ACTIVE = 2, +-- DAS_STATUS_TRACKED = 3 +local refreshedRecently = false +function refreshQuestLogs(forceOverride) + + forceOverride = forceOverride or DAS.QuestIndexTable == {} or DAS.QuestNameTable == {} + if forceOverride then refreshedRecently = false end + if refreshedRecently then return end + DAS.QuestIndexTable = {} + DAS.QuestNameTable = {} + for i=1, 25 do + if IsValidQuestIndex(i) then + journalQuestName, _, _, _, _, _, tracked = GetJournalQuestInfo(i) + journalQuestName = zo_strformat(journalQuestName) + DAS.QuestIndexTable[i] = journalQuestName + DAS.QuestNameTable[journalQuestName] = i + end + end + DAS.RefreshFullBingoString() + zo_callLater(function() refreshedRecently = false end, 5000) + +end +DAS.RefreshQuestLogs = refreshQuestLogs function DAS.TryDisableAutoShare(fromName, messageText) if type(messageText) ~= "string" then return false end @@ -18,10 +52,37 @@ function DAS.TryDisableAutoShare(fromName, messageText) end end +local typeTable = "table" +local function hookupKeyValuePair(zoneId, key, value, best) + if type(key) == typeTable then + for _, actualKey in ipairs(key) do + hookupKeyValuePair(zoneId, actualKey, value, best) + end + elseif type(value) == typeTable then + local best = value[1] + for _, actualValue in ipairs(value) do + hookupKeyValuePair(zoneId, key, actualValue, best) + end + else + DAS.bingo[zoneId][value] = key + if not best then return end + DAS.bingoFallback[zoneId][value] = best + end +end + + +function DAS.makeBingoTable(zoneId, tbl) + DAS.bingo[zoneId] = {} + DAS.bingoFallback[zoneId] = {} + for key, value in pairs(tbl) do + hookupKeyValuePair(zoneId, key, value) + end + return DAS.bingo[zoneId] +end + local alreadySharing = false local questQueue = {} local function shareQuestQueue() - -- d("shareQuestQueue called with " .. tostring(#questQueue) .. " entries") if #questQueue == 0 then alreadySharing = false return @@ -36,23 +97,31 @@ local allDailyQuestIds = DAS_QUEST_IDS function DAS.TryShareActiveDaily() if not DAS.GetAutoShare() then return end - local zoneQuests = DAS.GetZoneQuests(zoneId) - local activeQuestIndices = {} - local questLabel - for i=1, #DAS.labels do - questLabel = DAS.labels[i] - if (questLabel.dataQuestState == DAS_STATUS_ACTIVE) then - table.insert(activeQuestIndices, questLabel.dataJournalIndex) - end - end - for _, questIndex in ipairs(activeQuestIndices) do - if IsValidQuestIndex(questIndex) and not table.contains(questQueue, questIndex) then - table.insert(questQueue, questIndex) + for _, journalIndex in pairs(DAS.activeZoneQuests) do + if not table.contains(questQueue, journalIndex) then + table.insert(questQueue, journalIndex) end end if not alreadySharing then shareQuestQueue() end + -- local zoneQuests = DAS.GetZoneQuests(zoneId) + -- local activeQuestIndices = {} + -- local questLabel + -- for i=1, #DAS.labels do + -- questLabel = DAS.labels[i] + -- if (questLabel.dataQuestState == DAS_STATUS_ACTIVE) then + -- table.insert(activeQuestIndices, questLabel.dataJournalIndex) + -- end + -- end + -- for _, questIndex in ipairs(activeQuestIndices) do + -- if IsValidQuestIndex(questIndex) and not table.contains(questQueue, questIndex) then + -- table.insert(questQueue, questIndex) + -- end + -- end + -- if not alreadySharing then + -- shareQuestQueue() + -- end end @@ -99,35 +168,6 @@ function DAS.TryTriggerAutoAcceptInvite() end end -function DAS.HandleGroupMessage(fromDisplayName, messageText) - if DAS.IsMatch(messageText, "stop") then - DAS.TryDisableAutoShare(fromDisplayName, messageText) - end -end - -function DAS.IsListeningInGuildChannel(guildNumber) - return ((guildNumber == DAS.GetGuildInviteNumber()) or DAS.GetListenInGuilds()) -end - -function DAS.CheckIfGroupMessage(channelType) - return DAS.FindInList({2, 3}, tonumber(channelType)) -end - -function DAS.CheckIfPublicMessage(channelType) - return nil ~= channelType and DAS.FindInList({CHAT_CHANNEL_SAY, CHAT_CHANNEL_ZONE, CHAT_CHANNEL_YELL}, tonumber(channelType)) -end - -function DAS.CheckIfGuildMessage(channelType) - - if nil == channelType then return false end - local guildNumber = tonumber(channelType)- 11 - - if (guildNumber > 0 and guildNumber < 6) then - return ((guildNumber == DAS.GetGuildInviteNumber()) or DAS.GetListenInGuilds()) - end - return false -end - function DAS.OpenDailyPresent() local numCompleted = NonContiguousCount(DAS.GetShareableLog()) diff --git a/DASMenu.lua b/DASMenu.lua index 511f93d..cf346c1 100644 --- a/DASMenu.lua +++ b/DASMenu.lua @@ -8,12 +8,12 @@ function DAS.CreateMenu(savedVars, defaults) questShareDefault = defaults.questShareString local LAM = LibStub:GetLibrary("LibAddonMenu-2.0") local panelData = { - type = "panel", - name = DAS.name, - displayname = name, - author = DAS.author, - version = DAS.version, - slashCommand = "/das", + type = "panel", + name = DAS.name, + displayname = name, + author = DAS.author, + version = DAS.version, + slashCommand = "/das_menu", } LAM:RegisterAddonPanel("DailyAutoShare_OptionsPanel", panelData) @@ -34,19 +34,18 @@ function DAS.CreateMenu(savedVars, defaults) type = "checkbox", tooltip = "Use the same settings for all characters?", name = "Use global configuration?", + width = "half", getFunc = function() return DAS.GetUseGlobalSettings() end, setFunc = function(value) DAS.SetUseGlobalSettings(value) end - }, - { -- header: Show/Hide? - type = "header", - name = "Show/Hide?" - }, - { -- checkbox: Hide UI window + }, + { -- checkbox: Hide UI window type = "checkbox", name = "Hide UI window", + width = "half", getFunc = function() return DAS.GetHidden() end, setFunc = function(value) DAS.SetHidden(value) end }, + { -- header: be elaborate? type = "header", name = "Throttle" @@ -73,10 +72,15 @@ function DAS.CreateMenu(savedVars, defaults) getFunc = function() return DAS.GetQuestShareDelay() end, setFunc = function(value) DAS.SetQuestShareDelay(value) end }, + { + type = "description", + title = "Activate auto quest stuff in...", + text = GetString(DAS_MENU_ACTIV_EXPLAIN), + }, { -- header: activate add-on in... type = "submenu", - name = "Activate auto quest stuff in...", + name = "Activate", controls = { { @@ -275,13 +279,51 @@ 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 = "submenu", + name = "Guild dailies", + controls = { + { -- 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 + }, + { -- checkbox: Fighters' Guild + type = "checkbox", + tooltip = "Enable Fighters' Guild dailies", + name = "Fighters' Guild", + getFunc = function() return DAS.GetQuestListItem(57, "fg", "active") end, + setFunc = function(value) DAS.SetQuestListItem(57, "fg", "active", value) end + }, + { -- checkbox: Mages' Guild + type = "checkbox", + tooltip = "Enable Mages' Guild dailies", + name = "Mages Guild", + getFunc = function() return DAS.GetQuestListItem(57, "mg", "active") end, + setFunc = function(value) DAS.SetQuestListItem(57, "mg", "active", value) end + }, + { -- checkbox: Fighters' Guild + type = "checkbox", + tooltip = "Enable Undaunted dailies", + name = "Undaunted", + getFunc = function() return DAS.GetQuestListItem(57, "ud", "active") end, + setFunc = function(value) DAS.SetQuestListItem(57, "ud", "active", value) end + }, + }, + + + }, + { -- checkbox: Cyro 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) + tooltip = "Auto-accept and -turnin", + name = "Cyrodiil", + getFunc = function() return DAS.GetActiveIn(181) end, + setFunc = function(value) + DAS.SetActiveIn(181, value) end }, @@ -341,8 +383,8 @@ function DAS.CreateMenu(savedVars, defaults) type = "checkbox", name = "Tooltip to the right?", tooltip = "Check this box to display the tooltip on the left side of the window", - getFunc = function() return DAS.GetTooltipRight() end, - setFunc = function(value) DAS.SetTooltipRight(value) end + getFunc = function() return DAS.GetSettings().tooltipRight end, + setFunc = function(value) DAS.GetSettings().tooltipRight = value end }, { -- checkbox: Reposition DropDown type = "checkbox", diff --git a/DASUserSettingsAdapter.lua b/DASUserSettingsAdapter.lua index 20daddd..d09b64f 100644 --- a/DASUserSettingsAdapter.lua +++ b/DASUserSettingsAdapter.lua @@ -1,5 +1,5 @@ -local DAS = DailyAutoShare - +local DAS = DailyAutoShare +local groupTagPlayer = "player" -- called from settings function DAS.GetUseGlobalSettings() @@ -21,7 +21,7 @@ DAS.GetSettings = GetSettings local function CanInvite(unitTag, unitName) if (nil == unitTag) and (nil == unitName) then - return ((not IsUnitGrouped("player") or (IsUnitGroupLeader("player") 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 elseif(unitName and IsPlayerInGroup(unitName)) then @@ -69,22 +69,12 @@ function DAS.SetHidden(hidden) DasControl:SetHidden(hidden) if hidden then SCENE_MANAGER:GetScene("hud" ):RemoveFragment(DAS.Fragment) - SCENE_MANAGER:GetScene("hudui"):RemoveFragment(DAS.Fragment) - + SCENE_MANAGER:GetScene("hudui"):RemoveFragment(DAS.Fragment) else SCENE_MANAGER:GetScene("hud" ):AddFragment(DAS.Fragment) - SCENE_MANAGER:GetScene("hudui"):AddFragment(DAS.Fragment) - DAS.RefreshControl() - end - - if not hidden then DAS.RefreshControl() end -end - -function DAS.GetTooltipRight() - return GetSettings().tooltipRight -end -function DAS.SetTooltipRight(value) - GetSettings().tooltipRight = value + SCENE_MANAGER:GetScene("hudui"):AddFragment(DAS.Fragment) + end + if not hidden then DAS.RefreshControl(true) end end function DAS.GetQuestShareDelay() @@ -189,7 +179,7 @@ end function DAS.SetActiveIn(zoneIndex, value) if (nil == zoneIndex) then zoneIndex = DAS.GetZoneId() end GetSettings()["tracked"][zoneIndex] = value - zo_callLater(function() DailyAutoShare.RefreshGui() end, 500) + zo_callLater(function() DailyAutoShare.RefreshGui(not DAS.GetActiveIn()) end, 500) end local nestedLists = { @@ -341,7 +331,7 @@ function DAS.LoadControlLocation(control) control:ClearAnchors() control:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, x, y) - DAS.SetTooltipRight(DAS.GetTooltipRight() or x < 200) + DAS.GetSettings().tooltipRight = DAS.GetSettings().tooltipRight or x < 200 end @@ -425,20 +415,23 @@ function DAS.LogQuest(questName, completed) settings[questName].completed = completed settings[questName].afterEight = afterEight end -function DAS.GetQuestStatus(questName, questList, zoneId) - if nil == questName or "string" ~= type(questName) then return 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 + end + + local zoneId = DAS.GetZoneId() + local questList = DAS.QuestLists[zoneId] if nil == questList then return DAS_STATUS_OPEN end - zoneId = zoneId or DAS.GetZoneId() 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) diff --git a/DAS_xml.xml b/DAS_xml.xml new file mode 100644 index 0000000..1c9258d --- /dev/null +++ b/DAS_xml.xml @@ -0,0 +1,217 @@ +<GuiXml> + <Controls> + + <TopLevelControl name="DasControl" movable="true" mouseEnabled="true"> + <Dimensions x="330" minY="45" y="45" /> + <Anchor point="TOPLEFT" relativeTo="GuiRoot" relativePoint="TOPLEFT" /> + <OnMoveStop>DailyAutoShare.SaveControlLocation(self)</OnMoveStop> + <Controls> + + + <Control name="DasHandle" clampedToScreen="true"> + <Anchor point="TOPLEFT" relativeTo="DasControl" relativePoint="TOPLEFT"/> + <Anchor point="BOTTOMRIGHT" relativeTo="DasControl" relativePoint="TOPRIGHT" offsetY="45"/> + + + <Controls> + <Backdrop name="$(parent)_BG" edgeColor="000000" centerColor="969696" alpha="0.5" drawLayer="0"> + <Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT"/> + <Anchor point="BOTTOMRIGHT" relativeTo="$(parent)" relativePoint="BOTTOMRIGHT"/> + </Backdrop> + + <Button name="DasButtonLock" > + <Dimensions x="16" y="16" /> + <Anchor point="TOPLEFT" relativeTo="DasHandle" relativePoint="TOPLEFT" offsetX="15" offsetY="15"/> + <OnMouseUp> DailyAutoShare.SetLocked(not DailyAutoShare.GetLocked()) </OnMouseUp> + <Textures + normal ="esoui/art/miscellaneous/locked_up.dds" + pressed ="esoui/art/miscellaneous/locked_down.dds" + mouseOver ="esoui/art/miscellaneous/locked_over.dds" + /> + </Button> + <Button name="DasButtonHide" > + <Dimensions x="15" y="15" /> + <Anchor point="LEFT" relativeTo="DasButtonLock" relativePoint="RIGHT" offsetX="10" offsetY="1"/> + + <Textures + normal ="/esoui/art/buttons/decline_up.dds" + pressed ="/esoui/art/buttons/decline_down.dds" + mouseOver ="/esoui/art/buttons/decline_over.dds" + /> + <OnMouseUp> DasControl:SetHidden(true) </OnMouseUp> + </Button> + + <Button name="DasButtonMinmax" > + <Dimensions x="16" y="16" /> + <Anchor point="TOPRIGHT" relativeTo="DasHandle" relativePoint="TOPRIGHT" offsetX="-20" offsetY="15"/> + <Textures + normal ="/esoui/art/buttons/minus_up.dds" + pressed ="/esoui/art/buttons/minus_down.dds" + mouseOver ="/esoui/art/buttons/minus_over.dds" + /> + <OnMouseUp>DailyAutoShare.MinMaxButton()</OnMouseUp> + </Button> + + <Button name="DasButtonRefresh"> + <Anchor point="RIGHT" relativeTo="DasHandle" relativePoint="RIGHT" offsetX="-40" offsetY="1"/> + <Dimensions x="30" y="30" /> + <Textures + normal ="/esoui/art/help/help_tabicon_feedback_up.dds" + pressed ="/esoui/art/help/help_tabicon_feedback_down.dds " + mouseOver ="/esoui/art/help/help_tabicon_feedback_over.dds" + /> + <OnMouseEnter> DailyAutoShare.CreateControlTooltip(self) </OnMouseEnter> + <OnMouseExit> DailyAutoShare.HideTooltip(self) </OnMouseExit> + <OnMouseUp> DailyAutoShare.RefreshLabels(true, true) </OnMouseUp> + </Button> + + <Label name="$(parent)_Label" font="ZoFontWinH2" color="ffffff" text="DailyAutoShare" + verticalAlignment="CENTER" horizontalAlignment="LEFT" alpha="0.85"> + <Dimensions x="350" y="50" /> + <Anchor point="TOPLEFT" relativeTo="DasHandle" relativePoint="TOPLEFT" offsetX="80" offsetY="-2"/> + </Label> + + </Controls> + </Control> + <Tooltip name="DailyAutoShare_Tooltip" inherits="ZO_BaseTooltip" tier="1"> + <Anchor point="TOPLEFT" relativeTo="DasList" relativePoint="TOPLEFT" offsetX="0" offsetY="-50"/> + </Tooltip> + + <Control name="DasList" resizeToFitDescendents="true" > + <Dimensions x="330" /> + <Anchor point="TOPLEFT" relativeTo="DasHandle" relativePoint="BOTTOMLEFT" offsetX="0" offsetY="0" /> + <Controls> + <Backdrop name="$(parent)_BG" inherits="ZO_DefaultBackdrop"><AnchorFill/></Backdrop> + <Control name="DasHeader"> + <Anchor point="TOPLEFT" relativeTo="DasList_Backdrop" relativePoint="TOPLEFT" offsetX="20" offsetY="15"/> + <Anchor point="BOTTOMRIGHT" relativeTo="DasList_Backdrop" relativePoint="TOPLEFT" offsetX="310" offsetY="30" /> + <Controls> + <Button name="DasButtonInvite"> + <Dimensions x="20" y="20" /> + <Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" /> + <Textures + normal="/DailyAutoShare/textures/invite_up.dds" + pressed="/DailyAutoShare/textures/invite_down.dds" + mouseOver="/DailyAutoShare/textures/invite_down.dds" + /> + + <OnMouseEnter> DailyAutoShare.CreateControlTooltip(self) </OnMouseEnter> + <OnMouseExit> DailyAutoShare.HideTooltip(self) </OnMouseExit> + <OnMouseUp> DailyAutoShare.SettingsButton(self, button) </OnMouseUp> + + </Button> + + <Button name="DasButtonAccept" > + <Dimensions x="20" y="20" /> + <Anchor point="TOPLEFT" relativeTo="DasButtonInvite" relativePoint="TOPRIGHT" offsetX="10" /> + + <Textures + normal="DailyAutoShare/textures/accept_up.dds" + pressed="DailyAutoShare/textures/accept_down.dds" + mouseOver="DailyAutoShare/textures/accept_down.dds" + /> + <OnMouseEnter> DailyAutoShare.CreateControlTooltip(self) </OnMouseEnter> + <OnMouseExit> DailyAutoShare.HideTooltip(self) </OnMouseExit> + <OnMouseUp> DailyAutoShare.SettingsButton(self, button) </OnMouseUp> + </Button> + + <Button name="DasButtonShare" > + <Dimensions x="20" y="20" /> + <Anchor point="TOPLEFT" relativeTo="DasButtonAccept" relativePoint="TOPRIGHT" offsetX="10" /> + + <Textures + normal="DailyAutoShare/textures/share_up.dds" + pressed="DailyAutoShare/textures/share_down.dds" + mouseOver="DailyAutoShare/textures/share_down.dds" + /> + <OnMouseEnter> DailyAutoShare.CreateControlTooltip(self) </OnMouseEnter> + <OnMouseExit> DailyAutoShare.HideTooltip(self) </OnMouseExit> + <OnMouseUp> DailyAutoShare.SettingsButton(self, button) </OnMouseUp> + + </Button> + + <Button name="DasButtonSpam"> + <Anchor point="TOPLEFT" relativeTo="DasButtonShare" relativePoint="TOPRIGHT" offsetX="50" /> + <Dimensions x="20" y="20" /> + <Textures + normal="DailyAutoShare/textures/speaker_up.dds" + pressed="DailyAutoShare/textures/speaker_down.dds" + mouseOver="DailyAutoShare/textures/speaker_down.dds" + /> + <OnMouseEnter> DailyAutoShare.CreateControlTooltip(self) </OnMouseEnter> + <OnMouseExit> DailyAutoShare.HideTooltip(self) </OnMouseExit> + <OnMouseUp> DailyAutoShare.SettingsButton(self, button) </OnMouseUp> + </Button> + + + <Button name="DasButtonDonate" alpha="0.6"> + <Anchor point="TOPRIGHT" relativeTo="$(parent)" relativePoint="TOPRIGHT" offsetY="-4" /> + <Dimensions x="30" y="30" /> + <Textures + normal="esoui/art/chatwindow/chat_mail_up.dds" + pressed="esoui/art/chatwindow/chat_mail_down.dds" + mouseOver="esoui/art/chatwindow/chat_mail_over.dds" + /> + + <OnMouseEnter> DailyAutoShare.CreateControlTooltip(self) </OnMouseEnter> + <OnMouseExit> DailyAutoShare.HideTooltip(self) </OnMouseExit> + <OnMouseUp> DailyAutoShare.Donate(self, button) </OnMouseUp> + </Button> + + + + </Controls> + </Control> + + <Control name="DasInvisibleFooterSpacer" mouseEnabled="false" > + <Dimensions y="15" /> + </Control> + </Controls> + + </Control> + + <Control name="DasSubList" hidden="true" resizeToFitDescendents="true"> + <Dimensions x="310" /> + <Anchor point="LEFT" relativeTo="DasList" relativePoint="RIGHT" offsetX="10" offsetY="10" /> + <Controls> + <Backdrop name="$(parent)_BG" inherits="ZO_DefaultBackdrop"><AnchorFill/></Backdrop> + <Button name="DasButtonHideSublist" > + <Dimensions x="20" y="20" /> + <Anchor point="TOPRIGHT" relativeTo="DasSubList" relativePoint="TOPRIGHT" offsetX="-8" offsetY="5"/> + + <Textures + normal ="/esoui/art/buttons/decline_up.dds" + pressed ="/esoui/art/buttons/decline_down.dds" + mouseOver ="/esoui/art/buttons/decline_over.dds" + /> + <OnMouseUp> DasSubList:SetHidden(true)</OnMouseUp> + </Button> + + </Controls> + </Control> + </Controls> + </TopLevelControl> + + <Button name="Das_Label" font="ZoFontChat" text="" wrapMode="TRUNCATE" + verticalAlignment="CENTER" horizontalAlignment="LEFT" alpha="0.85" hidden="true" + disabled="true" virtual="true" + drawLayer="1"> + <Dimensions x="350" y="30" /> + <FontColors + normalColor="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_NORMAL" + pressedColor="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_SELECTED" + mouseOverColor="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_HIGHLIGHT" + disabledColor="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_DISABLED" + /> + + + <OnMouseEnter>DailyAutoShare.CreateLabelTooltip(self)</OnMouseEnter> + <OnMouseExit>DailyAutoShare.HideTooltip(self)</OnMouseExit> + <OnMouseUp>DailyAutoShare.QuestLabelClicked(self, button)</OnMouseUp> + </Button> + <Control name="DasInvisibleFooterSpacer" mouseEnabled="false" virtual="true"> + <Dimensions y="15" /> + </Control> + </Controls> + +</GuiXml> \ No newline at end of file diff --git a/DailyAutoShare.txt b/DailyAutoShare.txt index 98192e7..e2af43d 100644 --- a/DailyAutoShare.txt +++ b/DailyAutoShare.txt @@ -1,7 +1,7 @@ ## Title: DailyAutoShare ## Author: manavortex -## Version: 3.1.5 -## APIVersion: 100022 +## Version: 3.2.1 +## APIVersion: 100023 ## SavedVariables: DAS_Settings DAS_Globals ## OptionalDependsOn: LibStub LibCustomMenu LibAddonMenu-2.0 LibMediaProvider-1.0 pchat @@ -27,16 +27,15 @@ libs\LibAddonMenu-2.0\controls\divider.lua libs\LibCustomTitles\LibCustomTitles.lua xml/VirtualButtons.xml -DailyAutoShare.xml +DAS_xml.xml questData/00_ids.lua locale/en.lua locale/$(language).lua -$(APIVersion).lua - -startup.lua +00_startup.lua +DASHelper.lua questData/BingoClean.lua questData/GuildQuests.lua @@ -49,7 +48,6 @@ questData/Cyrodiil.lua questData/ClockworkCity.lua DASData.lua -DASHelper.lua DASUserSettingsAdapter.lua DasChatMessage.lua diff --git a/DailyAutoShare.xml b/DailyAutoShare.xml deleted file mode 100644 index 6aac884..0000000 --- a/DailyAutoShare.xml +++ /dev/null @@ -1,190 +0,0 @@ -<GuiXml> - <Controls> - - <TopLevelControl name="DasControl" movable="true" mouseEnabled="true"> - <Dimensions x="330" minY="45" y="45" /> - <Anchor point="TOPLEFT" relativeTo="GuiRoot" relativePoint="TOPLEFT" /> - <OnMoveStop>DailyAutoShare.SaveControlLocation(self)</OnMoveStop> - <Controls> - - - <Control name="DasHandle" clampedToScreen="true"> - <Anchor point="TOPLEFT" relativeTo="DasControl" relativePoint="TOPLEFT"/> - <Anchor point="BOTTOMRIGHT" relativeTo="DasControl" relativePoint="TOPRIGHT" offsetY="45"/> - - - <Controls> - <Backdrop name="$(parent)_BG" edgeColor="000000" centerColor="969696" alpha="0.5" drawLayer="0"> - <Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT"/> - <Anchor point="BOTTOMRIGHT" relativeTo="$(parent)" relativePoint="BOTTOMRIGHT"/> - </Backdrop> - - <Button name="DasButtonLock" > - <Dimensions x="16" y="16" /> - <Anchor point="TOPLEFT" relativeTo="DasHandle" relativePoint="TOPLEFT" offsetX="15" offsetY="15"/> - <OnMouseUp> DailyAutoShare.SetLocked(not DailyAutoShare.GetLocked()) </OnMouseUp> - <Textures - normal ="esoui/art/miscellaneous/locked_up.dds" - pressed ="esoui/art/miscellaneous/locked_down.dds" - mouseOver ="esoui/art/miscellaneous/locked_over.dds" - /> - </Button> - <Button name="DasButtonHide" > - <Dimensions x="15" y="15" /> - <Anchor point="LEFT" relativeTo="DasButtonLock" relativePoint="RIGHT" offsetX="10" offsetY="1"/> - - <Textures - normal ="/esoui/art/buttons/decline_up.dds" - pressed ="/esoui/art/buttons/decline_down.dds" - mouseOver ="/esoui/art/buttons/decline_over.dds" - /> - <OnMouseUp> DasControl:SetHidden(true) </OnMouseUp> - </Button> - - <Button name="DasButtonMinmax" > - <Dimensions x="16" y="16" /> - <Anchor point="TOPRIGHT" relativeTo="DasHandle" relativePoint="TOPRIGHT" offsetX="-20" offsetY="15"/> - <Textures - normal ="/esoui/art/buttons/minus_up.dds" - pressed ="/esoui/art/buttons/minus_down.dds" - mouseOver ="/esoui/art/buttons/minus_over.dds" - /> - <OnMouseUp>DailyAutoShare.MinMaxButton()</OnMouseUp> - </Button> - - <Button name="DasButtonRefresh"> - <Anchor point="RIGHT" relativeTo="DasHandle" relativePoint="RIGHT" offsetX="-40" offsetY="1"/> - <Dimensions x="30" y="30" /> - <Textures - normal ="/esoui/art/help/help_tabicon_feedback_up.dds" - pressed ="/esoui/art/help/help_tabicon_feedback_down.dds " - mouseOver ="/esoui/art/help/help_tabicon_feedback_over.dds" - /> - <OnMouseEnter> DailyAutoShare.CreateControlTooltip(self) </OnMouseEnter> - <OnMouseExit> DailyAutoShare.HideTooltip(self) </OnMouseExit> - <OnMouseUp> DailyAutoShare.RefreshLabels(true, true) </OnMouseUp> - </Button> - - <Label name="$(parent)_Label" font="ZoFontWinH2" color="ffffff" text="DailyAutoShare" - verticalAlignment="CENTER" horizontalAlignment="LEFT" alpha="0.85"> - <Dimensions x="350" y="50" /> - <Anchor point="TOPLEFT" relativeTo="DasHandle" relativePoint="TOPLEFT" offsetX="80" offsetY="-2"/> - </Label> - - </Controls> - </Control> - <Tooltip name="DailyAutoShare_Tooltip" inherits="ZO_BaseTooltip"> - <Anchor point="TOPLEFT" relativeTo="DasList" relativePoint="TOPLEFT" offsetX="0" offsetY="-50"/> - </Tooltip> - - <Control name="DasList" > - <Dimensions x="330" y="395" /> - <Anchor point="TOPLEFT" relativeTo="DasHandle" relativePoint="BOTTOMLEFT" offsetX="0" offsetY="0" /> - <Controls> - <Backdrop name="DasList_Backdrop" edgeColor="000000" inherits="ZO_DefaultBackdrop" alpha="1" > - <!-- Change window size here --> - <Anchor point="TOPLEFT" relativeTo="DasList" relativePoint="TOPLEFT" offsetX="0" offsetY="0" /> - <Anchor point="BOTTOMRIGHT" relativeTo="DasList" relativePoint="BOTTOMRIGHT" offsetX="0" offsetY="0" /> - </Backdrop> - <Control name="DasHeader"> - <Anchor point="TOPLEFT" relativeTo="DasList_Backdrop" relativePoint="TOPLEFT" offsetX="20" offsetY="15"/> - <Anchor point="BOTTOMRIGHT" relativeTo="DasList_Backdrop" relativePoint="TOPRIGHT" offsetX="-20" offsetY="30" /> - <Controls> - <Button name="DasButtonInvite"> - <Dimensions x="20" y="20" /> - <Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" /> - <Textures - normal="/DailyAutoShare/textures/invite_up.dds" - pressed="/DailyAutoShare/textures/invite_down.dds" - mouseOver="/DailyAutoShare/textures/invite_down.dds" - /> - - <OnMouseEnter> DailyAutoShare.CreateControlTooltip(self) </OnMouseEnter> - <OnMouseExit> DailyAutoShare.HideTooltip(self) </OnMouseExit> - <OnMouseUp> DailyAutoShare.SettingsButton(self, button) </OnMouseUp> - - </Button> - - <Button name="DasButtonAccept" > - <Dimensions x="20" y="20" /> - <Anchor point="TOPLEFT" relativeTo="DasButtonInvite" relativePoint="TOPRIGHT" offsetX="10" /> - - <Textures - normal="DailyAutoShare/textures/accept_up.dds" - pressed="DailyAutoShare/textures/accept_down.dds" - mouseOver="DailyAutoShare/textures/accept_down.dds" - /> - <OnMouseEnter> DailyAutoShare.CreateControlTooltip(self) </OnMouseEnter> - <OnMouseExit> DailyAutoShare.HideTooltip(self) </OnMouseExit> - <OnMouseUp> DailyAutoShare.SettingsButton(self, button) </OnMouseUp> - </Button> - - <Button name="DasButtonShare" > - <Dimensions x="20" y="20" /> - <Anchor point="TOPLEFT" relativeTo="DasButtonAccept" relativePoint="TOPRIGHT" offsetX="10" /> - - <Textures - normal="DailyAutoShare/textures/share_up.dds" - pressed="DailyAutoShare/textures/share_down.dds" - mouseOver="DailyAutoShare/textures/share_down.dds" - /> - <OnMouseEnter> DailyAutoShare.CreateControlTooltip(self) </OnMouseEnter> - <OnMouseExit> DailyAutoShare.HideTooltip(self) </OnMouseExit> - <OnMouseUp> DailyAutoShare.SettingsButton(self, button) </OnMouseUp> - - </Button> - - <Button name="DasButtonSpam"> - <Anchor point="TOPLEFT" relativeTo="DasButtonShare" relativePoint="TOPRIGHT" offsetX="50" /> - <Dimensions x="20" y="20" /> - <Textures - normal="DailyAutoShare/textures/speaker_up.dds" - pressed="DailyAutoShare/textures/speaker_down.dds" - mouseOver="DailyAutoShare/textures/speaker_down.dds" - /> - <OnMouseEnter> DailyAutoShare.CreateControlTooltip(self) </OnMouseEnter> - <OnMouseExit> DailyAutoShare.HideTooltip(self) </OnMouseExit> - <OnMouseUp> DailyAutoShare.SettingsButton(self, button) </OnMouseUp> - </Button> - - - <Button name="DasButtonDonate" alpha="0.6"> - <Anchor point="TOPRIGHT" relativeTo="$(parent)" relativePoint="TOPRIGHT" offsetY="-4" /> - <Dimensions x="30" y="30" /> - <Textures - normal="esoui/art/chatwindow/chat_mail_up.dds" - pressed="esoui/art/chatwindow/chat_mail_down.dds" - mouseOver="esoui/art/chatwindow/chat_mail_over.dds" - /> - - <OnMouseEnter> DailyAutoShare.CreateControlTooltip(self) </OnMouseEnter> - <OnMouseExit> DailyAutoShare.HideTooltip(self) </OnMouseExit> - <OnMouseUp> DailyAutoShare.Donate(self, button) </OnMouseUp> - </Button> - - - - </Controls> - </Control> - </Controls> - - </Control> - </Controls> - </TopLevelControl> - <Button name="Das_Label" font="ZoFontChat" color="ffffff" text="" wrapMode="TRUNCATE" - verticalAlignment="CENTER" horizontalAlignment="LEFT" alpha="0.85" hidden="true" - disabled="true" virtual="true"> - <Dimensions x="350" y="30" /> - <FontColors - normalColor="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_NORMAL" - pressedColor="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_SELECTED" - mouseOverColor="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_HIGHLIGHT" - disabledColor="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_DISABLED" - /> - <OnMouseEnter>DailyAutoShare.CreateLabelTooltip(self)</OnMouseEnter> - <OnMouseExit>DailyAutoShare.HideTooltip(self)</OnMouseExit> - <OnMouseUp>DailyAutoShare.QuestButtonClicked(self, button)</OnMouseUp> - </Button> - </Controls> - -</GuiXml> \ No newline at end of file diff --git a/DasChatMessage.lua b/DasChatMessage.lua index a6faa7a..b4f76f3 100644 --- a/DasChatMessage.lua +++ b/DasChatMessage.lua @@ -26,30 +26,19 @@ function table.contains(tbl, element) return false end -local function HandleGroupMessage(messageText, fromDisplayName) - - local _, found - _, found = pcall(string.find, messageText, share) - if found then return DAS.TryShareActiveDaily() end - _, found = pcall(string.find, messageText, stopsharing) - if found then return DAS.SetAutoShare(false) end - - zo_callLater(HandleGroupMessage, groupDelay) -end - local channelTypes = DAS.channelTypes local stringPlus = "+" local stringAny = "+any" local function HandleChatMessage(messageText, fromDisplayName, calledRecursively) if not DAS.autoInviting then return end - + local found = stringAny == messageText -- it's +any -- lower case regex local _, bingoCode = pcall(string.match, messageText, "[%+/]+%s*(%w+)%s?[%+/]?") if not found and not bingoCode then return end - local bingoIndex = DAS.getBingoTable()[bingoCode] + local bingoIndex = DAS.bingo[DAS.GetZoneId()][bingoCode] found = found or (nil ~= bingoIndex and DAS.activeZoneQuests[bingoIndex]) if not found then return HandleChatMessage(messageText:gsub(bingoCode, ""), fromDisplayName, true) end @@ -96,7 +85,6 @@ function DAS.OnChatMessage(eventCode, channelType, fromName, messageText, _, fro end return end - -- we're not auto inviting, nothing to do if not DAS.autoInviting then return end diff --git a/DasGui.lua b/DasGui.lua index addc026..7c7c005 100644 --- a/DasGui.lua +++ b/DasGui.lua @@ -3,6 +3,13 @@ local visibilityStateCached = false local stateIsHidden = false local stateIsMinimised = false local visibleButtonIndex = 0 +DAS.sublabels = {} +DAS.labels = {} + +local labelTexts = {} + +local p = DAS.DebugOut +local QUEST_TRACKER = QUEST_TRACKER or FOCUSED_QUEST_TRACKER local function isHidden() return (not DAS.GetActiveIn()) or DAS.GetHidden() or (DAS.GetAutoHide() and (not DAS.OpenDailyPresent())) @@ -13,23 +20,18 @@ local function isMinimised() end local function cacheVisibilityStatus(forceOverride) - if forceOverride then visibilityStateCached = false end - if visibilityStateCached then return end stateIsHidden = isHidden() stateIsMinimised = isMinimised() - visibilityStateCached = true end -DAS.cacheVisibilityStatus = cacheVisibilityStatus function DAS.RefreshControl(refreshQuestCache) - - + -- p("DAS.RefreshControl(" .. tostring(refreshQuestCache).. ")") if not DAS.HasActiveDaily() then DAS.SetAutoInvite(false) end - cacheVisibilityStatus(true) + cacheVisibilityStatus() DasHandle:SetHidden( stateIsHidden) DasControl:SetHidden( stateIsHidden) DasList:SetHidden( stateIsMinimised or stateIsHidden) @@ -51,11 +53,11 @@ local function SetAutoInviteButton(value) if value then DasButtonInvite:SetAlpha(1) DasButtonInvite:SetNormalTexture("/DailyAutoShare/textures/invite_active.dds") - DasList_Backdrop:SetEdgeColor(ZO_SELECTED_TEXT:UnpackRGBA()) + DasList_BG:SetEdgeColor(ZO_SELECTED_TEXT:UnpackRGBA()) else DasButtonInvite:SetAlpha(0.5) DasButtonInvite:SetNormalTexture("/DailyAutoShare/textures/invite_up.dds") - DasList_Backdrop:SetEdgeColor(ZO_DEFAULT_TEXT:UnpackRGBA()) + DasList_BG:SetEdgeColor(ZO_DEFAULT_TEXT:UnpackRGBA()) end end @@ -85,7 +87,21 @@ local function SetMinimizedButton(value) end -function DAS.QuestButtonClicked(control, mouseButton) + +local function setButtonStates() + SetAutoInviteButton(DAS.GetAutoInvite()) + SetLockedButton(DAS.GetLocked()) + + SetAlpha(DasButtonAccept, DAS.GetAutoAcceptShared()) + SetAlpha(DasButtonShare, DAS.GetAutoShare()) + + DasButtonSpam:SetAlpha(0.7) +end +DAS.SetButtonStates = setButtonStates + +function DAS.QuestLabelClicked(control, mouseButton) + + DAS.SetSubLabels(control.dataQuestList) if mouseButton == MOUSE_BUTTON_INDEX_RIGHT then -- and isValidJournalIndex then return DAS.OnRightClick(control) @@ -99,19 +115,6 @@ function DAS.QuestButtonClicked(control, mouseButton) end end -local function setButtonStates() - SetAutoInviteButton(DAS.GetAutoInvite()) - SetLockedButton(DAS.GetLocked()) - - SetAlpha(DasButtonAccept, DAS.GetAutoAcceptShared()) - SetAlpha(DasButtonShare, DAS.GetAutoShare()) - - DasButtonSpam:SetAlpha(0.7) -end -function DAS.SetButtonStates() - return setButtonStates() -end - function DAS.Donate(control, mouseButton) local amount = 2000 if mouseButton == 2 then @@ -137,15 +140,14 @@ function DAS.MinMaxButton() DAS.RefreshControl() end -local function shouldHideLabel(questName, questList, zoneId) - if (nil == questList) then return false end - zoneId = zoneId or DAS.GetZoneId() - - for questListName, questListData in pairs(questList) do +local function shouldHideLabel(questName, zoneId) + 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")) @@ -153,59 +155,162 @@ local function shouldHideLabel(questName, questList, zoneId) end return false end -local typeTable = "table" -function DAS.setLabels(zoneQuests, questList, buttonIndex) + +local function setControlText(label, hidden) + local state = label.dataQuestState + if label.dataJournalIndex == DAS.trackedIndex then + label:SetText("* " .. label.dataTitle) + elseif hideLabel then + label:SetText("") + label:SetVisible(false) + return + else + label:SetText(label.dataTitle) + end - 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 - local status = DAS.GetQuestStatus(questName, questList, zoneId) - local hideLabel = hidden or (hideCompleted and status == DAS_STATUS_COMPLETE) or shouldHideLabel(questName, questList, zoneId) - -- d(zo_strformat("DAS: <<1>> shoud be hidden <<2>>", questName, tostring(hideLabel))) - label:SetHidden(hideLabel) - visibleButtonIndex = visibleButtonIndex +1 - -- d( tostring(status) .. " - " .. tostring(questName)) - label["dataJournalIndex"] = DAS.GetLogIndex(questName) - label["dataBingoString"] = DAS.GetBingoStringFromQuestName(questName) - label["dataQuestName"] = questName - label["dataQuestState"] = status - if label.dataJournalIndex == trackedIndex then - label:SetText("* " .. questName) - elseif hideLabel then - label:SetText("") - else - label:SetText(questName) - end + if label.dataQuestState == DAS_STATUS_COMPLETE then + label:SetState(BSTATE_DISABLED) + elseif label.dataQuestState == DAS_STATUS_ACTIVE then + label:SetState(BSTATE_PRESSED) + else --if label.dataQuestState == DAS_STATUS_OPEN then + label:SetState(BSTATE_NORMAL) + end + +end + +function setLabelTable(questTable) + + local status = DAS_STATUS_COMPLETE + local index = 1 + local questName, tmpStatus = nil + + 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 +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) .. "..." +end + +function DAS.SetSubLabels(questTable) + 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] + + label.dataJournalIndex = DAS.GetLogIndex(questName) + label.dataBingoString = DAS.GetBingoStringFromQuestName(questName) + 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 = {} + local buttonIndex = 1 + local questName + for index, questNameOrTable in pairs(zoneQuests) do + + if not labelTexts[questNameOrTable] then + label = DAS.labels[buttonIndex] -- despite the name these are actually buttons - if status == DAS_STATUS_COMPLETE then - label:SetState(BSTATE_DISABLED) - elseif status == DAS_STATUS_ACTIVE then - DAS.activeZoneQuests[index] = true - label:SetState(BSTATE_PRESSED) - elseif status == DAS_STATUS_OPEN then - label:SetState(BSTATE_NORMAL) - end - - buttonIndex = buttonIndex + 1 - end -- nil check end - + 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) + label.dataBingoString = DAS.GetBingoStringFromQuestName(label.dataQuestName) + 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) + + buttonIndex = buttonIndex + 1 + + end -- nil check end + end end -- for loop end return buttonIndex end function DAS.RefreshLabels(forceQuestRefresh, forceSkipQuestRefresh) - cacheVisibilityStatus(true) + + -- p("DAS.RefreshLabels(" .. tostring(forceQuestRefresh) .. ", " .. tostring(forceSkipQuestRefresh) .. ")") + cacheVisibilityStatus() setButtonStates() - DAS.activeZoneQuests = {} - local trackedIndex = 0 + DAS.trackedIndex = 99 if QUEST_TRACKER and QUEST_TRACKER.assistedData then - trackedIndex = QUEST_TRACKER.assistedData.arg1 + DAS.trackedIndex = QUEST_TRACKER.assistedData.arg1 end local buttonIndex = 1 @@ -216,18 +321,17 @@ function DAS.RefreshLabels(forceQuestRefresh, forceSkipQuestRefresh) if not forceSkipQuestRefresh then DAS.RefreshQuestLogs(forceQuestRefresh) end - local zoneId = DAS.GetZoneId() - local questList = DAS.QuestLists[zoneId] + + local questList = DAS.QuestLists[DAS.GetZoneId()] local zoneQuests = DAS.GetZoneQuests() - buttonIndex = DAS.setLabels(zoneQuests, questList, 1) - + buttonIndex = DAS.setLabels(zoneQuests) for buttonIndex=#DAS.GetZoneQuests()+1, #DAS.labels do if DAS.labels[buttonIndex] then DAS.labels[buttonIndex]:SetHidden(true) DAS.labels[buttonIndex]:SetText("") - end + end end DAS.RefreshFullBingoString() @@ -235,11 +339,17 @@ function DAS.RefreshLabels(forceQuestRefresh, forceSkipQuestRefresh) end function DAS.RefreshGui(hidden) - hidden = hidden or (not DAS.GetActiveIn()) or DAS.GetHidden() or (DAS.GetAutoHide() and not DAS.OpenDailyPresent()) + -- 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) + DasControl:SetHidden(hidden) DasHandle:SetMovable(not DAS.GetLocked()) DAS.RefreshLabels() end @@ -251,67 +361,92 @@ function DAS.AnchorList() else DasList:SetAnchor(TOP, DasHandle, BOTTOM) end -end - -function DAS.SetupGuiLabels() - - local predecessor = DasHeader - local offsetY = 10 - - DAS.labels = {} - 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) + DasSubList:ClearAnchors() + if DAS.GetSettings().tooltipRight then + DasSubList:SetAnchor(LEFT, DasList, RIGHT) + else + DasSubList:SetAnchor(RIGHT, DasList, LEFT) end - end -function DAS.SetLabelFontSize() - local numLabels = 0 - local labelHeight = nil + +local function setFontSize(labelList) + local labelHeight = 30 local fontScale = DAS.GetFontSize() local totalHeight = 0 local hidden = false - - for index, control in pairs(DAS.labels) do + + for index, control in pairs(labelList) do control:SetScale(fontScale) if control:IsHidden() then control:SetHeight(0) else - control:SetHeight(30) - numLabels = numLabels + 1 - labelHeight = labelHeight or control:GetHeight() - totalHeight = totalHeight + labelHeight + control:SetHeight(labelHeight) + control:SetScale(fontScale) end + end +end +DAS.setFontSize = setFontSize - end - - totalHeight = totalHeight + DasHeader:GetHeight() + (labelHeight or 1)*1.5 - DasList:SetHeight(totalHeight) - +function DAS.SetLabelFontSize() + + setFontSize(DAS.labels) DasControl:SetHeight(DasList:GetHeight() + DasHandle:GetHeight()) + setFontSize(DAS.sublabels) end function DAS.CreateGui() + local function setupGuiLabels() + + local predecessor = DasHeader + local offsetY = 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 + local offsetY = 10 + local offsetX = 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) - DailyAutoShare.SetupGuiLabels() + setupGuiLabels() DAS.LoadControlLocation(DasControl) -- DAS.LoadControlLocation(DasButton) - DailyAutoShare.AnchorList() + DAS.AnchorList() SetMinimizedButton(DAS.GetMinimized()) - DailyAutoShare.RefreshGui() + DAS.RefreshGui() zo_callLater(function() DAS.SetLabelFontSize() end, 2000) end diff --git a/DasGuiStringBuilder.lua b/DasGuiStringBuilder.lua index d3772ea..b7fd756 100644 --- a/DasGuiStringBuilder.lua +++ b/DasGuiStringBuilder.lua @@ -9,32 +9,6 @@ function DAS.GetLogIndex(questName) return DAS.QuestNameTable[questName] or 0 end --- DAS_STATUS_COMPLETE = 0, --- DAS_STATUS_OPEN = 1, --- DAS_STATUS_ACTIVE = 2, --- DAS_STATUS_TRACKED = 3 -local refreshedRecently = false -function refreshQuestLogs(forceOverride) - - forceOverride = forceOverride or DAS.QuestIndexTable == {} or DAS.QuestNameTable == {} - if forceOverride then refreshedRecently = false end - if refreshedRecently then return end - DAS.QuestIndexTable = {} - DAS.QuestNameTable = {} - - for i=1, 25 do - if IsValidQuestIndex(i) then - journalQuestName, _, _, _, _, _, tracked = GetJournalQuestInfo(i) - journalQuestName = zo_strformat(journalQuestName) - DAS.QuestIndexTable[i] = journalQuestName - DAS.QuestNameTable[journalQuestName] = i - end - end - DAS.RefreshFullBingoString() - zo_callLater(function() refreshedRecently = false end, 5000) - -end -DAS.RefreshQuestLogs = refreshQuestLogs local function getEnglishQuestNames(activeQuestNames) activeQuestNames = activeQuestNames or DAS.GetZoneQuests() @@ -67,7 +41,9 @@ local function generateQuestSpam(questNames) local ret = "" for _, questName in ipairs(questNames) do bingoString = DAS.GetBingoStringFromQuestName(questName) - ret = ret .. ((("" == bingoString) and "") or bingoString .. " ") + if not ret:find(bingoString) then + ret = ret .. ((("" == bingoString) and "") or bingoString .. " ") + end end return ret end diff --git a/DasTooltip.lua b/DasTooltip.lua index 8cdb5fa..e2056d5 100644 --- a/DasTooltip.lua +++ b/DasTooltip.lua @@ -16,9 +16,9 @@ end local function SetTooltipText(control) - DailyAutoShare_Tooltip:ClearLines() - local tooltipText = GenerateTooltipText(control) + local tooltipText = GenerateTooltipText(control) + if not tooltipText then return end DailyAutoShare_Tooltip:AddLine(tooltipText) DailyAutoShare_Tooltip:SetHidden(false) @@ -30,14 +30,13 @@ end local function setTooltipOffset(control) - local offsetY = control:GetTop() - DasList:GetTop() - local isTooltipRight = DAS.GetTooltipRight() - -- d(tostring(control:GetTop()) .. " / " .. tostring(DasList:GetTop())) + local offsetY = control:GetTop() - control:GetParent():GetTop() + local isTooltipRight = DAS.GetSettings().tooltipRight local myAnchorPos = (isTooltipRight and TOPLEFT) or TOPRIGHT local parentAnchorPos = (isTooltipRight and TOPRIGHT) or TOPLEFT DailyAutoShare_Tooltip:ClearAnchors() - DailyAutoShare_Tooltip:SetAnchor(myAnchorPos, DasList, parentAnchorPos, 0, offsetY) + DailyAutoShare_Tooltip:SetAnchor(myAnchorPos, control:GetParent(), parentAnchorPos, 0, offsetY) end function DAS.CreateControlTooltip(control) @@ -47,27 +46,42 @@ function DAS.CreateControlTooltip(control) end -function DAS.CreateTooltip(control) - +function DAS.CreateTooltip(control) setTooltipOffset(control) - SetTooltipText(control, isButton) - - end - + SetTooltipText(control, isButton) +end + +local questStateColors = { + [DAS_STATUS_ACTIVE] = ZO_HIGHLIGHT_TEXT:UnpackRGBA(), + [DAS_STATUS_OPEN] = ZO_NORMAL_TEXT:UnpackRGBA(), + [DAS_STATUS_COMPLETE] = ZO_DISABLED_TEXT:UnpackRGBA(), +} + +local dotDotDot = "%.%.%." function DAS.CreateLabelTooltip(control) + setTooltipOffset(control) local tooltipText = "" - local questName = control["dataQuestName"] - local state = DAS.GetCompleted(questName) - if control["dataQuestState"] == DAS_STATUS_COMPLETE then - tooltipText = (questName .. " completed today with " .. GetUnitName('player')) - else - local bingoString = control["dataBingoString"] or "" - local bingoTooltip = (bingoString ~= "" and "\n The bingo code is " .. bingoString) or "" - local status = (( control["dataQuestState"] == DAS_STATUS_ACTIVE and " is acive") or " still open") - tooltipText = (questName .. status .. bingoTooltip) - end + + local questName = control.dataTitle or control.dataQuestName + + if nil == questName then return end + if nil ~= questName:find(dotDotDot) then + tooltipText = GetString(DAS_TOGGLE_SUBLIST) + else + local state = DAS.GetCompleted(questName) + if control.dataQuestState == DAS_STATUS_COMPLETE then + tooltipText = (questName .. " completed today with " .. GetUnitName('player')) + else + local bingoString = control["dataBingoString"] or "" + local bingoTooltip = (bingoString ~= "" and "\n The bingo code is " .. bingoString) or "" + local status = (( control.dataQuestState == DAS_STATUS_ACTIVE and " is acive") or " still open") + tooltipText = (questName .. status .. bingoTooltip) + end + end + + DailyAutoShare_Tooltip:AddLine(tooltipText) DailyAutoShare_Tooltip:SetHidden(false) diff --git a/locale/en.lua b/locale/en.lua index 2bdb013..adf4a53 100644 --- a/locale/en.lua +++ b/locale/en.lua @@ -10,7 +10,11 @@ local strings = { DAS_SI_SHARE_FALSE = "Not automatically sharing your active daily, most likely someone yelled at you (Right-click to share anyway)", DAS_SI_SPAM = "Click to spam in zone chat", DAS_SI_SPAM_VERBOSE = "Click to ask for quest shares", - + + DAS_TOGGLE_SUBLIST = "Click to open quest list", + + DAS_MENU_ACTIV_EXPLAIN = "Activate or deactivate for zones below.", + DAS_SI_HIDE = "Hide DailyAutoShare", DAS_SI_TOGGLE = "Toggle hidden", DAS_SI_MINIMISE = "Toggle minimised", @@ -118,6 +122,27 @@ local strings = { DAS_NL_AURIDON = "Mud Ball Merriment", DAS_NL_EASTMARCH = "Snow Bear Plunge", + -- guild + DAS_GUILD_ANCHORS = "Dark Anchors in ", + DAS_GUILD_MADNESS = "Madness in ", + + DAS_UD_ALIKR = "Molten Pearls of Alik'r Desert", + DAS_UD_AURID = "Veiled Darkness in Auridon", + DAS_UD_BANGK = "Ancient Armaments in Bangkorai", + DAS_UD_DESHA = "Ancestor Wards in Deshaan", + DAS_UD_EASTM = "Icy Intrigue in Eastmarch", + DAS_UD_GLENU = "Red Rook Ransack in Glenumbra", + DAS_UD_GRAHT = "Ayleid Trinkets in Grahtwood", + DAS_UD_GREEN = "Culinary Justice in Greenshade", + DAS_UD_MALAB = "The Spirit Trap in Malabal Tor", + DAS_UD_REAPE = "Mascot Theft in Reaper's March", + DAS_UD_RIFT = "Inflamed Pyres of the Rift", + DAS_UD_RIVEN = "Darkness Blooms in Rivenspire", + DAS_UD_SHADO = "Give and Take in Shadowfen", + DAS_UD_STONE = "Dwarven Relics of Stonefalls", + DAS_UD_STORM = "Cursed Baubles of Stormhaven", + + -- craglorn -- lower DAS_CRAG_SARA = "Critical Mass", @@ -164,6 +189,11 @@ local strings = { DAS_QUEST_SS_TANO = "Justiciar Tanorian", DAS_QUEST_SS_FARO = "Justiciar Farowel", + DAS_QUEST_CRY_BATTLE = "Battle Mission Board", + DAS_QUEST_CRY_BOUNTY = "Bounty Mission Board", + DAS_QUEST_CRY_SCOUT = "Scouting Mission Board", + DAS_QUEST_CRY_WARFR = "Warfront Mission Board", + -- don't need translation for anyone but the russians - I think DAS_QUEST_DB_LARONEN = "Laronen", diff --git a/questData/00_ids.lua b/questData/00_ids.lua index 9235410..1721575 100644 --- a/questData/00_ids.lua +++ b/questData/00_ids.lua @@ -116,4 +116,35 @@ DAS_QUEST_IDS = { [5765] = true, -- "Taken Alive", [5764] = true, -- "The Truer Fangs", [5772] = true, -- "Uncaged", -} \ No newline at end of file + + + -- guild + [5733] = true, -- Ancient Armaments in Bangkorai + [5734] = true, -- The Spirit Trap in Malabal Tor + [5735] = true, -- Ancestor Wards in Deshaan + [5737] = true, -- Dwarven Relics of Stonefalls + [5738] = true, -- Ayleid Trinkets in Grahtwood + [5739] = true, -- Red Rook Ransack in Glenumbra + + [5740] = true, -- Ancestor Wards in Deshaan + + [5744] = true, -- Mascot Theft in Reaper's March + [5745] = true, -- Molten Pearls of Alik'r Desert + + [5778] = true, -- Give and Take in Shadowfen + [5779] = true, -- Icy Intrigue in Eastmarch + [5798] = true, -- Veiled Darkness in Auridon + + [5800] = true, -- Cursed Baubles of Stormhaven ?? + [5802] = true, -- Inflamed Pyres of the Rift + [5808] = true, -- Darkness Blooms in Rivenspire + [5853] = true, -- Culinary Justice in Greenshade + +} + +for questId=5814, 5830 do -- Madness in... + DAS_QUEST_IDS[questId] = true +end +for questId=5780, 5796 do -- Dark Anchors in... + DAS_QUEST_IDS[questId] = true +end diff --git a/questData/Cyrodiil.lua b/questData/Cyrodiil.lua index 09db1f0..c4fe28f 100644 --- a/questData/Cyrodiil.lua +++ b/questData/Cyrodiil.lua @@ -9,4 +9,13 @@ DAS.makeBingoTable(zoneId, tbl2) DAS.questIds[zoneId] = { -} \ No newline at end of file +} + +DAS.questStarter[zoneId] = { + [GetString(DAS_QUEST_CRY_BATTLE)] = true, + [GetString(DAS_QUEST_CRY_BOUNTY)] = true, + [GetString(DAS_QUEST_CRY_SCOUT)] = true, + [GetString(DAS_QUEST_CRY_WARFR)] = true, +} + +DAS.questFinisher[zoneId] = DAS.questStarter[zoneId] diff --git a/questData/GoldCoast.lua b/questData/GoldCoast.lua index 4e8ae23..7219bff 100644 --- a/questData/GoldCoast.lua +++ b/questData/GoldCoast.lua @@ -28,7 +28,6 @@ DAS.makeBingoTable(zoneId, tbl2) DAS.bingo[zoneId2] = DAS.bingo[zoneId] DAS.bingo[zoneId3] = DAS.bingo[zoneId] - DAS.questStarter[zoneId] = { [GetString(DAS_QUEST_DB_BOUNTY)] = true, } @@ -40,8 +39,7 @@ DAS.questFinisher[zoneId] = { [GetString(DAS_QUEST_DB_CODUS)] = true, } -DAS.questIds[zoneId] = { - +DAS.questIds[zoneId] = { -- gold coast [5603] = true, -- "Buried Evil", [5604] = true, -- "The Common Good", diff --git a/questData/GuildQuests.lua b/questData/GuildQuests.lua index 21143f0..409fed4 100644 --- a/questData/GuildQuests.lua +++ b/questData/GuildQuests.lua @@ -1,24 +1,94 @@ -DAS.shareables = DAS.shareables or {} -DAS.bingo = DAS.bingo or {} -DAS.questFinisher = DAS.questFinisher or {} -DAS.questStarter = DAS.questStarter or {} +DAS.shareables = DAS.shareables or {} +DAS.bingo = DAS.bingo or {} +DAS.questFinisher = DAS.questFinisher or {} +DAS.questStarter = DAS.questStarter or {} +DAS.QuestLists = DAS.QuestLists or {} local zoneId = 57 -- Deshaan local zoneId2 = 19 -- Stormhaven local zoneId3 = 383 -- Grahtwood -DAS.shareables[zoneId] = { - +local tbl1 = {} +local tbl2 = {} + +local fgBingo = {[1] = "fg", [2] = "fighters", [3] = "cardea"} +local mgBingo = {[1] = "mg", [2] = "mages", [3] = "alvur"} +local udBingo = {[1] = "ud", [2] = "undaunted", [3] = "bolgrul"} + +DAS.QuestLists[zoneId] = { + ["fg"] = {}, + ["mg"] = {}, + ["ud"] = {}, } + +DAS.QuestLists[zoneId2] = DAS.QuestLists[zoneId] +DAS.QuestLists[zoneId3] = DAS.QuestLists[zoneId] + +local zoneIds = { + [104] = GetString(DAS_UD_ALIKR), -- Alik'r Desert + [381] = GetString(DAS_UD_AURID), -- Auridon + [92 ] = GetString(DAS_UD_BANGK), -- Bangkorai + [57 ] = GetString(DAS_UD_DESHA), -- Deshaan + [101] = GetString(DAS_UD_EASTM), -- Eastmarch + [3 ] = GetString(DAS_UD_GLENU), -- Glenumbra + [383] = GetString(DAS_UD_GRAHT), -- Grahtwood + [104] = GetString(DAS_UD_GREEN), -- Greenshade + [58 ] = GetString(DAS_UD_MALAB), -- Malabal Tor + [382] = GetString(DAS_UD_REAPE), -- Reaper's March + [103] = GetString(DAS_UD_RIFT), -- The Rift + [20 ] = GetString(DAS_UD_RIVEN), -- Rivenspire + [117] = GetString(DAS_UD_SHADO), -- Shadowfen + [41 ] = GetString(DAS_UD_STONE), -- Stonefalls + [19 ] = GetString(DAS_UD_STORM), -- Stormhaven +} + +for id, udString in pairs(zoneIds) do + local zoneName = GetZoneNameByIndex(GetZoneIndex(id)) + local fgString = GetString(DAS_GUILD_ANCHORS) .. zoneName + local mgString = GetString(DAS_GUILD_MADNESS) .. zoneName + + DAS.shareables[id] = DAS.shareables[id] or {} + DAS.QuestLists[id] = DAS.QuestLists[id] or {} + DAS.QuestLists[id].fg = DAS.QuestLists[id].fg or {} + DAS.QuestLists[id].mg = DAS.QuestLists[id].mg or {} + DAS.QuestLists[id].ud = DAS.QuestLists[id].ud or {} + local bingoTable = DAS.bingo[id] or {} + + table.insert(DAS.shareables[id], fgString) + table.insert(bingoTable, fgBingo) + table.insert(DAS.shareables[id], mgString) + table.insert(bingoTable, mgBingo) + table.insert(DAS.shareables[id], udString) + table.insert(bingoTable, udBingo) + DAS.makeBingoTable(id, bingoTable) + + table.insert(DAS.QuestLists[zoneId].fg, fgString) + table.insert(DAS.QuestLists[zoneId].mg, mgString) + table.insert(DAS.QuestLists[zoneId].ud, udString) +end + + +table.insert(tbl1, DAS.QuestLists[zoneId].fg) +table.insert(tbl2, fgBingo) + +table.insert(tbl1, DAS.QuestLists[zoneId].mg) +table.insert(tbl2, mgBingo) + +for idx, questName in pairs(DAS.QuestLists[zoneId].ud) do + table.insert(tbl1, questName) + table.insert(tbl2, udBingo) +end + +DAS.shareables[zoneId] = tbl1 DAS.shareables[zoneId2] = DAS.shareables[zoneId] DAS.shareables[zoneId3] = DAS.shareables[zoneId] -DAS.bingo[zoneId] = { - -} +DAS.bingo[zoneId] = DAS.makeBingoTable(zoneId, tbl2) DAS.bingo[zoneId2] = DAS.bingo[zoneId] DAS.bingo[zoneId3] = DAS.bingo[zoneId] +-- Alik'r Desert, Auridon, Bangkorai, Deshaan, Eastmarch, Glenumbra, Grahtwood, Greenshade, Malabal Tor, +-- Reaper's March, The Rift, Rivenspire, Shadowfen, Stonefalls, Stormhaven DAS.questStarter[zoneId] = { [GetString(DAS_QUEST_CAP_CARDEA)] = true, -- Cardea Gallus, FG @@ -34,4 +104,37 @@ DAS.questFinisher[zoneId] = { [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 +DAS.questFinisher[zoneId3] = DAS.questFinisher[zoneId] + + +DAS.questIds[zoneId] = { + -- guild + [5733] = true, -- Ancient Armaments in Bangkorai + [5734] = true, -- The Spirit Trap in Malabal Tor + [5735] = true, -- Ancestor Wards in Deshaan + [5737] = true, -- Dwarven Relics of Stonefalls + [5738] = true, -- Ayleid Trinkets in Grahtwood + [5739] = true, -- Red Rook Ransack in Glenumbra + + [5740] = true, -- Ancestor Wards in Deshaan + + [5744] = true, -- Mascot Theft in Reaper's March + [5745] = true, -- Molten Pearls of Alik'r Desert + + [5778] = true, -- Give and Take in Shadowfen + [5779] = true, -- Icy Intrigue in Eastmarch + [5798] = true, -- Veiled Darkness in Auridon + + [5800] = true, -- Cursed Baubles of Stormhaven ?? + [5802] = true, -- Inflamed Pyres of the Rift + [5808] = true, -- Darkness Blooms in Rivenspire + [5853] = true, -- Culinary Justice in Greenshade + +} + +for questId=5814, 5830 do -- Madness in... + DAS.questIds[zoneId][questId] = true +end +for questId=5780, 5796 do -- Dark Anchors in... + DAS.questIds[zoneId][questId] = true +end \ No newline at end of file diff --git a/questData/Morrowind.lua b/questData/Morrowind.lua index c6295d7..b3f88ec 100644 --- a/questData/Morrowind.lua +++ b/questData/Morrowind.lua @@ -9,20 +9,47 @@ local zoneId = 849 local tbl = {} local tbl2 = {} -table.insert(tbl, GetString(DAS_M_REL_ASHAL)) -table.insert(tbl2, "ashal") -table.insert(tbl, GetString(DAS_M_REL_ASSAR)) -table.insert(tbl2, "assar") -table.insert(tbl, GetString(DAS_M_REL_ASHUR)) -table.insert(tbl2, "ashur") -table.insert(tbl, GetString(DAS_M_REL_DUSHA)) -table.insert(tbl2, "dushar") -table.insert(tbl, GetString(DAS_M_REL_EBERN)) -table.insert(tbl2, "eber") -table.insert(tbl, GetString(DAS_M_REL_MAELK)) -table.insert(tbl2, "maelk") -table.insert(tbl, GetString(DAS_M_REL_YASAM)) -table.insert(tbl2, "yasam") +DAS.QuestLists = DAS.QuestLists or {} +DAS.QuestLists[zoneId] = { + ["relic"] = { + [1] = GetString(DAS_M_REL_ASHAL), + [2] = GetString(DAS_M_REL_ASSAR), + [3] = GetString(DAS_M_REL_ASHUR), + [4] = GetString(DAS_M_REL_DUSHA), + [5] = GetString(DAS_M_REL_EBERN), + [6] = GetString(DAS_M_REL_MAELK), + [7] = GetString(DAS_M_REL_YASAM), + }, + ["hunt"] = { + [1] = GetString(DAS_M_HUNT_EATER), + [2] = GetString(DAS_M_HUNT_ZEXXI), + [3] = GetString(DAS_M_HUNT_RAZOR), + [4] = GetString(DAS_M_HUNT_JAGGE), + [5] = GetString(DAS_M_HUNT_STOMP), + [6] = GetString(DAS_M_HUNT_TARRA), + [7] = GetString(DAS_M_HUNT_SVEET), + }, + ["delve"] = { + [1] = GetString(DAS_M_DELVE_DAEDR), + [2] = GetString(DAS_M_DELVE_KWAMA), + [3] = GetString(DAS_M_DELVE_MISIN), + [4] = GetString(DAS_M_DELVE_TAXES), + [5] = GetString(DAS_M_DELVE_TRIBA), + [6] = GetString(DAS_M_DELVE_SYNDI), + }, + ["boss"] = { + [1] = GetString(DAS_M_BOSS_WUYWU), + [2] = GetString(DAS_M_BOSS_SWARM), + [3] = GetString(DAS_M_BOSS_NILTH), + [4] = GetString(DAS_M_BOSS_SALOT), + [5] = GetString(DAS_M_BOSS_SIREN), + [6] = GetString(DAS_M_BOSS_APPRE), + }, +} + + +table.insert(tbl, DAS.QuestLists[zoneId].relic) +table.insert(tbl2, "relic") table.insert(tbl, GetString(DAS_M_HUNT_EATER)) table.insert(tbl2, "ash") @@ -39,7 +66,6 @@ table.insert(tbl2, "tarra") table.insert(tbl, GetString(DAS_M_HUNT_SVEET)) table.insert(tbl2, "sveeth") - table.insert(tbl, GetString(DAS_M_DELVE_DAEDR)) table.insert(tbl2, "daedra") table.insert(tbl, GetString(DAS_M_DELVE_KWAMA)) @@ -66,44 +92,25 @@ table.insert(tbl2, {[1] ="siren", [2] = "song", [3] = "songbird", [4] = "ss", [5 table.insert(tbl, GetString(DAS_M_BOSS_APPRE)) table.insert(tbl2, {[1] = "dub", [2] = "dubdil" }) + + +table.insert(tbl, GetString(DAS_M_REL_ASHAL)) +table.insert(tbl2, "ashal") +table.insert(tbl, GetString(DAS_M_REL_ASSAR)) +table.insert(tbl2, "assar") +table.insert(tbl, GetString(DAS_M_REL_ASHUR)) +table.insert(tbl2, "ashur") +table.insert(tbl, GetString(DAS_M_REL_DUSHA)) +table.insert(tbl2, "dushar") +table.insert(tbl, GetString(DAS_M_REL_EBERN)) +table.insert(tbl2, "eber") +table.insert(tbl, GetString(DAS_M_REL_MAELK)) +table.insert(tbl2, "maelk") +table.insert(tbl, GetString(DAS_M_REL_YASAM)) +table.insert(tbl2, "yasam") + DAS.shareables[zoneId] = tbl -DAS.QuestLists = DAS.QuestLists or {} -DAS.QuestLists[zoneId] = { - ["relic"] = { - [GetString(DAS_M_REL_ASHAL)] = true, - [GetString(DAS_M_REL_ASSAR)] = true, - [GetString(DAS_M_REL_ASHUR)] = true, - [GetString(DAS_M_REL_DUSHA)] = true, - [GetString(DAS_M_REL_EBERN)] = true, - [GetString(DAS_M_REL_MAELK)] = true, - [GetString(DAS_M_REL_YASAM)] = true, - }, - ["hunt"] = { - [GetString(DAS_M_HUNT_EATER)] = true, - [GetString(DAS_M_HUNT_ZEXXI)] = true, - [GetString(DAS_M_HUNT_RAZOR)] = true, - [GetString(DAS_M_HUNT_JAGGE)] = true, - [GetString(DAS_M_HUNT_STOMP)] = true, - [GetString(DAS_M_HUNT_TARRA)] = true, - [GetString(DAS_M_HUNT_SVEET)] = true, - }, - ["delve"] = { - [GetString(DAS_M_DELVE_DAEDR)] = true, - [GetString(DAS_M_DELVE_KWAMA)] = true, - [GetString(DAS_M_DELVE_MISIN)] = true, - [GetString(DAS_M_DELVE_TAXES)] = true, - [GetString(DAS_M_DELVE_TRIBA)] = true, - [GetString(DAS_M_DELVE_SYNDI)] = true, - }, - ["boss"] = { - [GetString(DAS_M_BOSS_WUYWU)] = true, - [GetString(DAS_M_BOSS_SWARM)] = true, - [GetString(DAS_M_BOSS_NILTH)] = true, - [GetString(DAS_M_BOSS_SALOT)] = true, - [GetString(DAS_M_BOSS_SIREN)] = true, - [GetString(DAS_M_BOSS_APPRE)] = true, - }, -} + -- Khartag point @@ -123,11 +130,11 @@ DAS.shareables[924] = { } -- Matus-Akin Egg Mine DAS.shareables[925] = { - [1] = DAS.shareables[zoneId][19], + [1] = GetString(DAS_M_DELVE_TRIBA), } -- Ashalmawia DAS.shareables[961] = { - [1] = DAS.shareables[zoneId][1], + [1] = DAS.shareables[zoneId][9], } DAS.makeBingoTable(zoneId, tbl2) diff --git a/questData/Summerset.lua b/questData/Summerset.lua new file mode 100644 index 0000000..bcc964f --- /dev/null +++ b/questData/Summerset.lua @@ -0,0 +1,37 @@ +local zoneId = 1011 +local zoneId2 = 1012 + +local tbl = {} + +table.insert(tbl, GetString(DAS_DB_MINO)) +table.insert(tbl, GetString(DAS_DB_ARENA)) +table.insert(tbl, GetString(DAS_DB_GOOD)) +table.insert(tbl, GetString(DAS_DB_EVIL)) + +DAS.shareables[zoneId] = tbl +DAS.shareables[zoneId2] = DAS.shareables[zoneId] + +local tbl2 = {} +table.insert(tbl2, {[1] = "mino", [2] = "m"}) +table.insert(tbl2, {[1] = "arena",[2] = "a"}) +table.insert(tbl2, {[1] = "good", [2] = "common", [3] = "cg"}) +table.insert(tbl2, {[1] = "evil", [2] = "buried", [3] = "be"}) + +DAS.makeBingoTable(zoneId, tbl2) +DAS.bingo[zoneId2] = DAS.bingo[zoneId] + +DAS.questStarter[zoneId] = { + [GetString(DAS_QUEST_SS_TANO)] = true, + [GetString(DAS_QUEST_SS_FARO)] = true, +} + +DAS.questFinisher[zoneId] = { + [GetString(DAS_QUEST_SS_TANO)] = true, + [GetString(DAS_QUEST_SS_FARO)] = true, + +} + + +DAS.questIds[zoneId] = { + +} \ No newline at end of file diff --git a/questData/Wrothgar.lua b/questData/Wrothgar.lua index 2a19357..31e8600 100644 --- a/questData/Wrothgar.lua +++ b/questData/Wrothgar.lua @@ -80,3 +80,22 @@ DAS.questFinisher[zoneId] = { -- [GetString(DAS_QUEST_W_RAYNOR )] = true, } + + +DAS.questIds[zoneId] = { + -- wrothgar boss + [5518] = true, -- "Meat for the Masses", + [5519] = true, -- "Scholarly Salvage", + [5520] = true, -- "Flames of Forge and Fallen", + [5521] = true, -- "Nature's Bounty", + [5522] = true, -- "Heresy of Ignorance", + [5523] = true, -- "Snow and Steam", + [5524] = true, -- "Reeking of Foul Play", + -- wrothgar delve + [5507] = true, -- "Breakfast of the Bizarre", + [5515] = true, -- "Free Spirits", + [5514] = true, -- "Getting a Bellyful", + [5509] = true, -- "Parts of the Whole", + [5504] = true, -- "The Skin Trade", + [5505] = true, -- "Fire in the Hold", +} diff --git a/startup.lua b/startup.lua deleted file mode 100644 index 5c4b814..0000000 --- a/startup.lua +++ /dev/null @@ -1,471 +0,0 @@ -DailyAutoShare = DailyAutoShare or {} -DAS = DailyAutoShare -local DailyAutoShare = DailyAutoShare - -DAS.name = "DailyAutoshare" -DAS.version = "3.1.5" -DAS.author = "manavortex" -DAS.settings = {} -DAS.globalSettings = {} - -DAS.shareables = {} -DAS.bingo = {} -DAS.subzones = {} - -DAS.questFinisher = {} -DAS.questStarter = {} -DAS.questIds = {} -DAS.channelTypes = { - [CHAT_CHANNEL_PARTY] = true, - [CHAT_CHANNEL_SAY ] = false, - [CHAT_CHANNEL_YELL] = false, - [CHAT_CHANNEL_ZONE] = false, - [CHAT_CHANNEL_WHISPER] = false, -} - -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 - -local activeInCurrentZone = false -DAS.fullBingoString = "" -local fullBingoString = DAS.fullBingoString - -local defaults = { - - ["singleDailies"] = {}, - ["shareableDailies"] = {}, - ["speakStupid"] = false, - ["debug"] = false, - ["keepInviteUpOnDegroup"] = false, - - ["DasControl"] = { - ["x"] = 0, - ["y"] = 0, - }, - ["DasButton"] = { - ["x"] = 0, - ["y"] = 0, - }, - ["inactiveZones"] = { - ["hide"] = true, - }, - [849] = { - ["relic"] = { - ["invisible"] = false, - ["active"] = true, - }, - ["hunt"] = { - ["invisible"] = false, - ["active"] = true, - }, - ["delve"] = { - ["invisible"] = false, - ["active"] = true, - }, - ["boss"] = { - ["invisible"] = false, - ["active"] = true, - }, - }, - [980] = { - ["crow"] = { - ["invisible"] = false, - ["active"] = true, - }, - ["craft"] = { - ["invisible"] = false, - ["active"] = true, - }, - ["delve"] = { - ["invisible"] = false, - ["active"] = true, - }, - ["boss"] = { - ["invisible"] = false, - ["active"] = true, - }, - }, - questShareString = "I can give a DailyAutoShare for <<1>>, type <<2>> for an instant invite", - debugOutput = false, - currentlyWithQuest = false, - currentQuestIndex = nil, - currentQuestName = nil, - autoTrack = false, - autoAcceptInvite = false, - autoAcceptInviteInterval = 5, - autoAcceptQuest = true, - autoAcceptShared = true, - autoDeclineShared = false, - autoHide = false, - autoMinimize = false, - autoShare = true, - autoAcceptAllDailies = false, - autoInvite = false, - autoLeave = false, - useGlobalSettings = true, - minimised = false, - locked = false, - hidden = false, - fontScale = 1, - tooltipRight = false, - upsideDown = false, - hideCompleted = false, - startupMinimized = true, - resetAutoShareOnNewGroup = true, - lastLookingFor = "", - guildInviteNumber = 1, - groupInviteDelay = 500, - questShareDelay = 500, - guildInviteText, - questShareString = "I can give a DailyAutoShare for <<1>>, type <<2>> for an instant invite", - listenInGuilds, - ["tracked"] = { - [684] = true, - [823] = true, - [849] = true, -- Vvardenfell - [181] = false, - [1011] = false, -- Summerset - }, -} - -local function pointerUpSubzones() - - -- Gold Coast - defaults[825] = defaults[823] - defaults[826] = defaults[823] - defaults.tracked[825] = defaults.tracked[823] - defaults.tracked[826] = defaults.tracked[823] - - -- Capitals - defaults[19] = defaults[57] - defaults[383] = defaults[57] - defaults.tracked[19] = defaults.tracked[57] - defaults.tracked[383] = defaults.tracked[57] - - -- Clockwork City - defaults[981] = defaults[980] - defaults[981] = defaults[980] - defaults[982] = defaults[980] - defaults.tracked[982] = defaults.tracked[980] - defaults.tracked[983] = defaults.tracked[980] - defaults.tracked[983] = defaults.tracked[980] - - -- Morrowind - defaults[921] = defaults[849] - defaults[922] = defaults[849] - defaults[923] = defaults[849] - defaults[924] = defaults[849] - defaults[925] = defaults[849] - defaults[961] = defaults[849] - defaults.tracked[921] = defaults.tracked[849] - defaults.tracked[922] = defaults.tracked[849] - defaults.tracked[923] = defaults.tracked[849] - defaults.tracked[924] = defaults.tracked[849] - defaults.tracked[925] = defaults.tracked[849] - defaults.tracked[961] = defaults.tracked[849] - - -- Wrothgar - defaults[689] = defaults[684] - defaults[690] = defaults[684] - defaults[691] = defaults[684] - defaults[692] = defaults[684] - defaults[693] = defaults[684] - defaults[694] = defaults[684] - defaults.tracked[689] = defaults.tracked[684] - defaults.tracked[690] = defaults.tracked[684] - defaults.tracked[691] = defaults.tracked[684] - defaults.tracked[692] = defaults.tracked[684] - defaults.tracked[693] = defaults.tracked[684] - defaults.tracked[694] = defaults.tracked[684] -end -pointerUpSubzones() - -local characterName = zo_strformat(GetUnitName('player')) - -local allDailyQuestIds = DAS_QUEST_IDS - -local em = EVENT_MANAGER - -local function debugOut(p1, p2, p3, p4, p5, p6, p7, p8) - if (not p2) then - d(p1) - return - end - if p8 then - d(zo_strformat("<<1>> <<2>> <<3>> <<4>> <<5>> <<6>> <<7>> <<8>>", p1, p2, p3, p4, p5, p6, p7, p8)) - elseif p7 then - d(zo_strformat("<<1>> <<2>> <<3>> <<4>> <<5>> <<6>> <<7>>", p1, p2, p3, p4, p5, p6, p7)) - elseif p6 then - d(zo_strformat("<<1>> <<2>> <<3>> <<4>> <<5>> <<6>>", p1, p2, p3, p4, p5, p6)) - elseif p5 then - d(zo_strformat("<<1>> <<2>> <<3>> <<4>> <<5>>", p1, p2, p3, p4, p5)) - elseif p4 then - d(zo_strformat("<<1>> <<2>> <<3>> <<4>>", p1, p2, p3, p4)) - elseif p3 then - d(zo_strformat("<<1>> <<2>> <<3>>", p1, p2, p3)) - else - d(zo_strformat("<<1>> <<2>>", p1, p2)) - end -end -DAS.DebugOut = debugOut -local p = debugOut - -function DAS.Report(text) - if not DAS.GetShutUp() then d(text) end -end - -DAS.activeZoneQuests = {} - ---============================== ---======= Event hooks ========= ---============================== - -local function OnGroupTypeChanged(eventCode, unitTag) - if IsUnitGrouped("player") then - if not DAS.GetAutoShare() and DAS.GetResetAutoShareOnNewGroup() then - DAS.SetAutoShare(true) - end - else - if DAS.GetStopInviteOnDegroup() then - DAS.SetAutoInvite(false) - end - end - -end - -local function OnQuestAdded(eventCode, journalIndex, questName, objectiveName) - - local zoneId = DAS.GetZoneId() - if not DAS.GetActiveIn(zoneId) then return end - if not GetIsQuestSharable(journalIndex) then return end - local shareables = DAS.shareables[zoneId] or {} - - if nil ~= shareables[questName] then - DAS.LogQuest(questName, false) - zo_callLater(function() DAS.RefreshControl(true) end, 700) - end -end - -local function OnQuestShared(eventCode, questId) - if not allDailyQuestIds[questId] then return end - local questName, _, _, displayName = GetOfferedQuestShareInfo(questId) - local zoneId = DAS.GetZoneId() - if nil ~= DAS.GetArrayEntry(DAS.shareables[zoneId], questName) then - if DAS.GetAutoDeclineShared() then - DAS.Report("DailyAutoShare declined a quest for you. Type /DailyAutoShare disabledecline to stop it from doing so.") - DeclineSharedQuest(questId) - else - AcceptSharedQuest(questId) - zo_callLater(function() DAS.RefreshControl(true) end, 500) - end - end -end - -local function OnChatMessage(eventCode, channelType, fromName, messageText, _, fromDisplayName) - return DAS.OnChatMessage(eventCode, channelType, fromName, messageText, _, fromDisplayName) -end - -DAS.bingoFallback = {} -function DAS.makeBingoTable(zoneId, tbl) - DAS.bingo[zoneId] = {} - DAS.bingoFallback[zoneId] = {} - for key, value in pairs(tbl) do - if type(value) == "table" then - local best = value[1] - for _, actualValue in ipairs(value) do - DAS.bingo[zoneId][actualValue] = key - DAS.bingoFallback[zoneId][actualValue] = best - end - else - DAS.bingo[zoneId][value] = key - end - end - return DAS.bingo[zoneId] -end - -function DAS.getBingoTable(zoneId) - zoneId = zoneId or DAS.GetZoneId() - return DAS.bingo[zoneId] or {} -end - -function DAS.SetChatListenerStatus(status) - - DAS.channelTypes[CHAT_CHANNEL_SAY ] = status - DAS.channelTypes[CHAT_CHANNEL_YELL] = status - DAS.channelTypes[CHAT_CHANNEL_ZONE] = status - DAS.channelTypes[CHAT_CHANNEL_WHISPER] = status - -end - - -local function OnPlayerActivated(eventCode) - local active = DAS.GetActiveIn() - DAS.SetHidden(not active) - DAS.SetAutoInvite(DAS.GetAutoInvite()) -- disables if we aren't group lead - DAS.SetChatListenerStatus(DAS.autoInviting) - DAS.RefreshControl(true) - DAS.guildInviteText = DAS.GetGuildInviteText() - DAS.cacheChatterData() -end - -local function OnUnitCreated(eventCode, unitTag) - local unitZone = GetZoneId(GetUnitZoneIndex(unitTag)) - if not DAS.GetActiveIn(unitZone) then return end - if GetUnitDisplayName(unitTag) == cachedDisplayName then return end - DAS.TryShareActiveDaily(unitZone) -end - -local function OnQuestToolUpdate() - DAS.RefreshControl(true) -end - - - -local function OnQuestRemoved(eventCode, isCompleted, journalIndex, questName, zoneIndex, poiIndex, questId) - - -- is it a daily quest, and are we logging? - if not (allDailyQuestIds[questId] and DAS.GetActiveIn()) then return end - - DAS.LogQuest(questName, isCompleted) - - -- set auto invite off until the questlog has refreshed - local autoInvite = DAS.GetAutoInvite() - DAS.SetAutoInvite(false) - - - zo_callLater(function() - DAS.SetAutoInvite(autoInvite) - DAS.RefreshControl(true) - 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 function hookQuestTracker() - -- pts fix - if nil == QUEST_TRACKER then return end - local function refreshLabels() - DAS.RefreshLabels(false, true) - end - -- SetMapToQuestZone - ZO_PreHook(QUEST_TRACKER, "ForceAssist", refreshLabels) -end - ---============================== ---= DailyAutoShare_Initialize == ---============================== - -local function RegisterEventHooks() - - DailyAutoShare.Fragment = ZO_HUDFadeSceneFragment:New(DasControl) - - SCENE_MANAGER:GetScene("hud" ):AddFragment(DailyAutoShare.Fragment) - SCENE_MANAGER:GetScene("hudui"):AddFragment(DailyAutoShare.Fragment) - hookQuestTracker() - - em:RegisterForEvent(DAS.name, EVENT_PLAYER_ACTIVATED, OnPlayerActivated) - - em:RegisterForEvent(DAS.name, EVENT_QUEST_ADDED, OnQuestToolUpdate) - em:RegisterForEvent(DAS.name, EVENT_QUEST_REMOVED, OnQuestRemoved) - em:RegisterForEvent(DAS.name, EVENT_TRACKING_UPDATE, OnQuestToolUpdate) - - em:RegisterForEvent(DAS.name, EVENT_QUEST_ADDED, OnQuestAdded) - em:RegisterForEvent(DAS.name, EVENT_QUEST_REMOVED, OnQuestRemoved) - em:RegisterForEvent(DAS.name, EVENT_QUEST_SHARED, OnQuestShared) - - em:RegisterForEvent(DAS.name, EVENT_GROUP_TYPE_CHANGED, OnGroupTypeChanged) - em:RegisterForEvent(DAS.name, EVENT_UNIT_CREATED, OnUnitCreated) - em:RegisterForEvent(DAS.name, EVENT_UNIT_DESTROYED, OnGroupTypeChanged) - - 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 - DAS.RefreshControl(true) -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(forceReset) - - local currentDate = tonumber(GetDate()) - DAS.todaysLog = DAS.globalSettings.completionLog[currentDate] or {} - local logSize, lastDate = NonContiguousCount(DAS.todaysLog) - - if forceReset then - return resetQuests() - end - local counter = 0 - for dateString, dateLog in pairs(DAS.todaysLog) do - counter = counter + 1 - if counter < logSize-2 and tonumber(currentDate) < currentDate then - DAS.globalSettings.completionLog[currentDate] = nil - else - lastDate = currentDate - end - end - - local afterEight = tonumber(GetTimeString():sub(0, 2)) >= 08 -- has to be a local var, lua error if not - if (not afterEight) and DAS.todaysLog == {} and lastDate ~= currentDate then - DAS.todaysLog = DAS.globalSettings.completionLog[lastDate] - end - DAS.globalSettings.completionLog[currentDate] = DAS.todaysLog -end -DAS.handleLog = handleLog - -local function minimiseOnStartup() - DAS.SetMinimized(DAS.GetSettings().startupMinimized) -end ---============================== ---===== Rise, my minion! ====== ---============================== - -function DailyAutoShare_Initialize(eventCode, addonName) - - if addonName ~="DailyAutoShare" 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') - - RegisterEventHooks() - - DailyAutoShare.CreateMenu(DailyAutoShare.settings, defaults) - DAS.CreateGui() - - -- local timetoreset = (GetTimeStamp() - 60*60*7)%86400 - -- zo_callLater(resetQuests, timetoreset) - - - handleLog() - zo_callLater(OnPlayerActivated, 5000) - zo_callLater(minimiseOnStartup, 5500) - EVENT_MANAGER:UnregisterForEvent("DailyAutoShare", EVENT_ADD_ON_LOADED) - -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/xml/100023.lua b/xml/100023.lua new file mode 100644 index 0000000..e69de29