Skip to content

Commit

Permalink
8.3.03.1.1
Browse files Browse the repository at this point in the history
Dump functionality
  • Loading branch information
LanceDH committed Feb 10, 2020
1 parent 40a4fe1 commit 089c6e2
Show file tree
Hide file tree
Showing 10 changed files with 487 additions and 64 deletions.
36 changes: 32 additions & 4 deletions Data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,14 @@ _V["WQT_BOUNDYBOARD_OVERLAYID"] = 3;
_V["WQT_TYPE_BONUSOBJECTIVE"] = 99;
_V["WQT_LISTITTEM_HEIGHT"] = 32;

_V["DEBUG_OUTPUT_TYPE"] = {
["invalid"] = 0
,["setting"] = 1
,["quest"] = 2
,["worldQuest"] = 3
,["addon"] = 4
}

_V["FILTER_TYPES"] = {
["faction"] = 1
,["type"] = 2
Expand Down Expand Up @@ -506,6 +514,17 @@ _V["SETTING_LIST"] = {
end
,["getValueFunc"] = function() return WQT.settings.general.bountyCounter end
}
,{["type"] = _V["SETTING_TYPES"].checkBox, ["categoryID"] = "GENERAL", ["label"] = _L["INCLUDE_DAILIES"], ["tooltip"] = _L["INCLUDE_DAILIES_TT"], ["isNew"] = true
, ["valueChangedFunc"] = function(value)
WQT.settings.list.includeDaily = value;
local mapAreaID = WorldMapFrame.mapID;
WQT_WorldQuestFrame.dataProvider:LoadQuestsInZone(mapAreaID);
if (not value) then
WQT_Utils:RefreshOfficialDataProviders();
end
end
,["getValueFunc"] = function() return WQT.settings.list.includeDaily end
}

-- Quest List
,{["type"] = _V["SETTING_TYPES"].checkBox, ["categoryID"] = "QUESTLIST", ["label"] = _L["SHOW_TYPE"], ["tooltip"] = _L["SHOW_TYPE_TT"]
Expand Down Expand Up @@ -553,7 +572,6 @@ _V["SETTING_LIST"] = {
,["getValueFunc"] = function() return WQT.settings.list.alwaysAllQuests end
}


-- Map Pin
,{["type"] = _V["SETTING_TYPES"].checkBox, ["categoryID"] = "MAPPINS", ["label"] = _L["PIN_DISABLE"], ["tooltip"] = _L["PIN_DISABLE_TT"]
, ["valueChangedFunc"] = function(value)
Expand Down Expand Up @@ -659,15 +677,16 @@ _V["SETTING_LIST"] = {
}

_V["SETTING_UTILITIES_LIST"] = {
{["type"] = _V["SETTING_TYPES"].checkBox, ["categoryID"] = "WQTU", ["label"] = _L["LOAD_UTILITIES"], ["tooltip"] = _L["LOAD_UTILITIES_TT"]
{["type"] = _V["SETTING_TYPES"].checkBox, ["categoryID"] = "WQTU", ["label"] = _L["LOAD_UTILITIES"], ["tooltip"] = _L["LOAD_UTILITIES_TT"], ["disabledTooltip"] = _L["LOAD_UTILITIES_TT_DISABLED"]
, ["valueChangedFunc"] = function(value)
WQT.settings.general.loadUtilities = value;
if (value and not IsAddOnLoaded("WorldQuestTabUtilities")) then
LoadAddOn("WorldQuestTabUtilities");
WQT_QuestScrollFrame:UpdateQuestList();
end
end
,["getValueFunc"] = function() return WQT.settings.general.loadUtilities end;
,["getValueFunc"] = function() return WQT.settings.general.loadUtilities end
,["isDisabled"] = function() return GetAddOnEnableState(nil, "WorldQuestTabUtilities") == 0 end
}
}

Expand Down Expand Up @@ -1010,7 +1029,16 @@ end

-- This is just easier to maintain than changing the entire string every time
local _patchNotes = {
{["version"] = "8.3.02"
{["version"] = "8.3.03"
,["intro"] = {"This update is mainly to introduce an output dump to help report and debug problems."}
,["new"] = {
"New Setting: Include dailies (default on). Found under General settings. Treat certain dailies as world quests. Only affects dailies which Blizzard themselves treats as world quests."
}
,["fixes"] = {
"Fixed WQTU 'load' setting not disabling when it is not enabled in the add-on list."
}
}
,{["version"] = "8.3.02"
,["intro"] = {"Rejoice again, for Blizzard fixed the new Threat Emissary issue right after 8.3 launch. Right now there are no known hidden quests preventing you from using all 25 quest slots!"}
,["new"] = {
"Returning setting: Precise Filters (default off). Found under General settings. Enabling this will cause filters to only pass quests that match ALL filters. E.g.: If you have both the 'Gold' and 'Artifact' filters enabled, you will only see quests that give BOTH rewards."
Expand Down
75 changes: 61 additions & 14 deletions Dataprovider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,48 @@ function WQT_Utils:RemoveTomTomArrowbyQuestId(questId)
end
end

function WQT_Utils:QuestCountsToCap(questLogIndex)
local title, _, _, isHeader, _, _, frequency, questID, _, _, _, _, isTask, isBounty, _, isHidden, _ = GetQuestLogTitle(questLogIndex);

if (isHeader or isTask or isBounty) then
return false, isHidden;
end

local tagID, tagName = GetQuestTagInfo(questID)
local counts = true;

if (tagID and _V["QUESTS_NOT_COUNTING"][tagID]) then
counts = false;
end

return counts, isHidden;
end

-- Count quests counting to the quest log cap and collect hidden ones that can't be abandoned
function WQT_Utils:GetQuestLogInfo(hiddenList)
local numEntries = GetNumQuestLogEntries();
local maxQuests = C_QuestLog.GetMaxNumQuestsCanAccept();
local questCount = 0;
if (hiddenList) then
wipe(hiddenList);
end
for questLogIndex = 1, numEntries do
local counts, isHidden = WQT_Utils:QuestCountsToCap(questLogIndex);
if (counts) then
questCount = questCount + 1;

-- hidden quest counting to the cap
if (isHidden and hiddenList) then
tinsert(hiddenList, questLogIndex);
end
end
end

local color = questCount >= maxQuests and RED_FONT_COLOR or (questCount >= maxQuests-2 and _V["WQT_ORANGE_FONT_COLOR"] or _V["WQT_WHITE_FONT_COLOR"]);

return questCount, maxQuests, color;
end

----------------------------
-- MIXIN
----------------------------
Expand Down Expand Up @@ -778,24 +820,29 @@ function WQT_DataProvider:LoadQuestsInZone(zoneId)
end

function WQT_DataProvider:AddQuestsInZone(zoneID, continentId)
local questsById = C_TaskQuest.GetQuestsForPlayerByMapID(zoneID, continentId);
if not questsById then return false; end
local missingData = false;
local quest;

for k, info in ipairs(questsById) do
if (info.mapID == zoneID) then
quest = self:AddQuest(info, info.mapID);
if (not quest) then
missingData = true;
end;

local questsById = C_TaskQuest.GetQuestsForPlayerByMapID(zoneID, continentId);
if (questsById) then
for k, info in ipairs(questsById) do
if (info.mapID == zoneID) then
local hasData = self:AddQuest(info);
if (not hasData) then
missingData = true;
end;
end
end
end

return missingData;
end

function WQT_DataProvider:AddQuest(qInfo, zoneId)
function WQT_DataProvider:AddQuest(qInfo)
-- Setting to filter daily world quests
if (not WQT.settings.list.includeDaily and qInfo.isDaily) then
return true;
end

local duplicate = self:FindDuplicate(qInfo.questId);
-- If there is a duplicate, we don't want to go through all the info again
if (duplicate) then
Expand Down Expand Up @@ -824,10 +871,10 @@ function WQT_DataProvider:AddQuest(qInfo, zoneId)
if (not haveRewardData) then
C_TaskQuest.RequestPreloadRewardData(qInfo.questId);
tinsert(self.waitingRoomRewards, questInfo);
return nil;
return false;
end;

return questInfo;
return true;
end

function WQT_DataProvider:FindDuplicate(questId)
Expand Down
159 changes: 159 additions & 0 deletions Debug.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
local addonName, addon = ...
local WQT = addon.WQT;
local _L = addon.L
local _V = addon.variables;
local ADD = LibStub("AddonDropDown-1.0");
local WQT_Utils = addon.WQT_Utils;


local URL_CURSEFORGE = "https://www.curseforge.com/wow/addons/worldquesttab/issues"
local URL_WOWI = "https://www.wowinterface.com/downloads/info25042-WorldQuestTab.html"

-- regionID, locale, textLocale, playerFaction, map, coords, addonVersion
local FORMAT_PLAYER = "%d;%s;%s;%s;%d;%s;%s\n";
local FORMAT_QUEST_HEADER = "Quests;%d;%d\nQuestId;Counted;Frequency;IsTask;IsBounty;IsHidden\n"
local FORMAT_QUEST = "%s%d;%s;%d;%s;%s;%s\n"
local FORMAT_WORLDQUEST_HEADER = "World Quests;%d\nQuestId;MapId;PassedFilter;IsValid;AlwaysHide;IsDaily;IsAllyQuest;Seconds;RewardBits\n";
local FORMAT_WORLDQUEST = "%s%d;%d;%s;%s;%s;%s;%s;%d;%d\n"
-- output, name
local FORMAT_ADDON = "%s%s\n"
-- ouput, indentation, key, value
local FORMAT_TABLE_VALUE = "%s%s%s = %s\n";

local function bts(bool)
return bool and "Y" or "N";
end

local function GetQuestDump()
local counted, limit = WQT_Utils:GetQuestLogInfo(hiddenList)
local output = FORMAT_QUEST_HEADER:format(counted, limit);

local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isBounty, isStory, isHidden, isScaling;
local numEntries = GetNumQuestLogEntries();
for index = 1, numEntries do
title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isBounty, isStory, isHidden, isScaling = GetQuestLogTitle(index);
local counted = WQT_Utils:QuestCountsToCap(index);
if (not isHeader) then
output = FORMAT_QUEST:format(output, questID, bts(counted), frequency, bts(isTask), bts(isBounty), bts(isHidden));
end
end

return output;
end

local function GetWorldQuestDump()
local mapID = WorldMapFrame:GetMapID() or 0;
local output = FORMAT_WORLDQUEST_HEADER:format(mapID);

local list = WQT_WorldQuestFrame.dataProvider:GetIterativeList();
for k, questInfo in ipairs(list) do
local title = C_TaskQuest.GetQuestInfoByQuestID(questInfo.questId);
local mapInfo = WQT_Utils:GetMapInfoForQuest(questInfo.questId)
output = FORMAT_WORLDQUEST:format(output, questInfo.questId, mapInfo.mapID, bts(questInfo.passedFilter), bts(questInfo.isValid), bts(questInfo.alwaysHide), bts(questInfo.isDaily), bts(questInfo.isAllyQuest), questInfo.time.seconds, questInfo.reward.typeBits);
end

return output;
end

local function GetPlayerDump()
local version = GetAddOnMetadata(addonName, "version");
local map = C_Map.GetBestMapForUnit("player");
local coords = nil;
if (map) then
local pos = C_Map.GetPlayerMapPosition(map, "player");
coords = string.format("%.2f,%.2f", pos.x, pos.y);
end
local output = FORMAT_PLAYER:format(GetCurrentRegion(), GetLocale(), C_CVar.GetCVar("textLocale"), UnitFactionGroup("player"), map, coords, version);
return output;
end

local function LoopTableValues(output, t, level)
local indented = string.rep(" ", level);
for k, v in pairs(t) do
if (type(v) ~= "table") then
output = FORMAT_TABLE_VALUE:format(output, indented, k, tostring(v));
end
end
for k, v in pairs(t) do
if (type(v) == "table") then
output = output .. indented .. k .."\n"
output = LoopTableValues(output, v, level+1);
end
end
return output;
end

local function GetSettingsDump()
local output = "Settings\n";

output = LoopTableValues(output, WQT.settings, 0);

return output;
end

local function GetAddonDump()
local output = "Addons\n";

for i = 1, GetNumAddOns() do
if (IsAddOnLoaded(i)) then
output = FORMAT_ADDON:format(output, GetAddOnInfo(i));
end
end

return output;
end

local function GetOutputTypeFromString(s)
if (s == "s") then
return _V["DEBUG_OUTPUT_TYPE"].setting;
elseif (s == "q") then
return _V["DEBUG_OUTPUT_TYPE"].quest;
elseif (s == "wq") then
return _V["DEBUG_OUTPUT_TYPE"].worldQuest;
elseif (s == "a") then
return _V["DEBUG_OUTPUT_TYPE"].addon;
end
return _V["DEBUG_OUTPUT_TYPE"].invalid;
end


WQT_DebugFrameMixin = {};

function WQT_DebugFrameMixin:OnLoad()
self.CurseURL:SetText(URL_CURSEFORGE);
self.WoWIURL:SetText(URL_WOWI);
end

function WQT_DebugFrameMixin:DumpDebug(input)

local outputType = input;
if (type(outputType) == "string") then
outputType = GetOutputTypeFromString(input);
end

if (outputType == _V["DEBUG_OUTPUT_TYPE"].invalid) then
print("Usage: /wqt dump <type> where <type> is:");
print("s: Settings");
print("q: Normal quests");
print("wq: World Quests (current map)");
print("a: Enabled Add-ons");
return;
end

local text = GetPlayerDump();

if (outputType == _V["DEBUG_OUTPUT_TYPE"].quest) then
text = text .. GetQuestDump();
elseif (outputType == _V["DEBUG_OUTPUT_TYPE"].worldQuest) then
text = text .. GetWorldQuestDump();
elseif (outputType == _V["DEBUG_OUTPUT_TYPE"].setting) then
text = text .. GetSettingsDump();
elseif (outputType == _V["DEBUG_OUTPUT_TYPE"].addon) then
text = text .. GetAddonDump();
end

self.DumpFrame.EditBox:SetText(text);
OpenWorldMap();
WQT_WorldQuestFrame:SelectTab(WQT_TabWorld);
WQT_WorldQuestFrame:ShowOverlayFrame(self);
end
Loading

0 comments on commit 089c6e2

Please sign in to comment.