📄 titanquests.lua
字号:
--------------------------------------------------------------------------
-- TitanQuests.lua
--------------------------------------------------------------------------
--[[
Titan Panel [Quests]
Displays number of quests in Titan Panel. When hovered over it
displays the following info:
- total number of quests
- number of Elite quests
- number of Dungeon quests
- number of Raid quests
- number of PvP quests
- number of regular quests (non elite/dungeon/raid/pvp)
- number of quests in log currently completed
Right-click to see a color coded list of current quests. When hovered
over a dropdown menu will appear with a list of quest objectives, add to
Blizzard's Quest Tracker, share quest, abandon quest, open quest details
and link quest to chat.
The Options menu allows you to sort and groupthe quests by level, zone,
or by title. You can also apply a filter to view only dungeon, elite,
complete, incomplete, or regular quests.
Can toggle MonkeyQuest, QuestHistory, PartyQuests, QuestIon and
QuestBank if these AddOns are installed.
NOTE: Requires Titan Panel version 1.22+
TODO: Minor French and German translations. Complete Korean translations.
v0.13 (June 28, 2005 9:11 PST)
- fixed bug when clicking on "Quest Details"
- minor German translation fix (thanks Scarabeus)
v0.12 (June 22, 2005 01:00 PST)
- added ability to click on a quest to add to the quest tracker directly [Ryessa]
- added option to set "Watch" or "Quest Details" as primary action when clicking a quest [Ryessa]
- added SHIFT-click to perform the secondary action ("Watch" or "Quest Details") [Ryessa]
- cleaned up info display panel a bit [Ryessa]
- set quests to store their toggle state in Titan variables (prep to persist watched quests between sessions) [Ryessa]
- added option to disable grouping of quests under Zone or Level headings [Ryessa]
- moved a lot of code into utility functions for code cleanliness at cost of a slight perf hit (not noticable) [Ryessa]
- added "Failed" quest tag [Corgi]
v0.11 (June 15, 2005 16:40 PST)
- new quest list layout [Ryessa]
- added option to show only incomplete quests (need loc guys to review) [Ryessa]
- added grouping headers when sorting by location or level [Ryessa]
- moved most options to a side menu because of the larger size from grouping [Ryessa]
- Shortened English tooltip descriptors [Ryessa]
- Changed Titan button text to be NumComplete/NumCurrent [Ryessa]
- updated for Titan Panel 1.24 [Corgi]
v0.10 (June 7, 2005 20:30 PST)
- German localization changes (thanks Kaesemuffin)
- added French localization (thanks Vorpale)
- toc updated for 1.50 patch
v0.09 (June 2, 2005 15:31 PST)
- fixed bug that was causing WoW.exe to crash when changing characters
- added German localization (thanks Scarabeus)
v0.08 (May 30, 2005 14:00 PST)
- added the ability to sort the quest list by location (default), level or title.
- added the ability to just show quests based on their type (ie, just show elite quests).
v0.07 (May 27, 2005 17:41 PST)
- added a [Quests] icon for the Titan Panel, which can be turned on/off.
- minor changes to text displayed in mouseover tooltip.
v0.06 (May 20, 2005 20:27 PST)
- added 'Quest Details' button to quest dropdown menu.
- added a 'Link Quest' button to quest dropdown menu.
- added Location to Quest Details.
- added colored quest level text to Quest Details window title.
- fixed ui scaling issue with Quest Details window.
- added 'Toggle' dropdown menu to toggle the blizzard's quest log and various 3rd party addons.
- clicking on quest now opens a movable window with complete quest info, including rewards.
- Share Quest has been added to quest dropdown menu.
- Abandon Quest has been added to quest dropdown menu (a window will open for confirmation).
- localization.lua is ready for german, french and korean translations
v0.05 (May 15, 2005 16:20 PST)
- clicking on a quest in the quest list will open a dropdown menu showing the quest objectives and a button to add/remove the quest from Blizzard's Quest Tracker.
- added quest location and complete tag to the quest list.
- added the ability to toggle PartyQuests, QuestBank, QuestIon if they are installed.
- changed 'About' button to open a dropdown menu displaying mod name, version and author name.
v0.04 (May 14, 2005 19:43 PST)
- added the ability to toggle MonkeyQuest and/or QuestHistory from the right-click menu if they are installed.
- added version info to mouseover tooltip.
- added 'About' to right-click menu, which opens a window displaying mod name, version and author name.
v0.03 (May 13, 2005 14:28 PST)
- clicking on quest will now open the quest log to that particular quest.
v0.02 (May 13, 2005 12:01 PST)
- fixed typo to allow 'Show Label Text' to work.
v0.01 (May 13, 2005 10:30 PST)
- Initial Release
]]--
--
-- Titan Panel Variables
--
TITAN_QUESTS_ID = "Quests";
TITAN_QUESTS_ARTWORK_PATH = "Interface\\AddOns\\TitanPlus\\Artwork\\";
--
-- OnFunctions
--
function TitanPanelQuestsButton_OnLoad()
this.registry = {
id = TITAN_QUESTS_ID,
builtIn_t = 1,
menuText = TITAN_QUESTS_MENU_TEXT,
buttonTextFunction = "TitanPanelQuestsButton_GetButtonText",
tooltipTitle = TITAN_QUESTS_TOOLTIP,
tooltipTextFunction = "TitanPanelQuestsButton_GetTooltipText",
icon = TITAN_QUESTS_ARTWORK_PATH.."TitanQuests",
iconWidth = 16,
savedVariables = {
ShowIcon = 1,
ShowLabelText = 1,
SortByLevel = TITAN_NIL,
SortByLocation = 1,
SortByTitle = TITAN_NIL,
ShowElite = TITAN_NIL,
ShowDungeon = TITAN_NIL,
ShowRaid = TITAN_NIL,
ShowPVP = TITAN_NIL,
ShowRegular = TITAN_NIL,
ShowCompleted = TITAN_NIL,
ShowIncomplete = TITAN_NIL,
ShowAll = 1,
GroupBehavior = 1,
ClickBehavior = TITAN_NIL,
}
};
this:RegisterEvent("QUEST_LOG_UPDATE");
end
function TitanPanelQuestsButton_OnEvent()
TitanPanelButton_UpdateButton(TITAN_QUESTS_ID);
TitanPanelButton_UpdateTooltip();
if ( event == "QUEST_LOG_UPDATE" ) then
if ( TitanQuests_Details ~= nil ) then
if ( TitanQuests_Details:IsVisible() ) then
TitanQuests_Details_Update();
end
end
end
end
--
-- create button text
--
function TitanPanelQuestsButton_GetButtonText(id)
local MaxQuests = 20;
local NumCompleteQuests = 0;
local NumEntries, NumQuests;
NumEntries, NumQuests = GetNumQuestLogEntries();
-- get quest list
local questlist = TitanPanelQuests_BuildQuestList();
local i = 0;
-- count the number of incomplete quests
for i=1, NumQuests do
if(questlist[i]) then
if ( questlist[i].questisComplete ) then
NumCompleteQuests = NumCompleteQuests + 1;
end
end
end
-- create string for Titan bar display
local buttonRichText = format(TITAN_QUESTS_BUTTON_TEXT, TitanUtils_GetGreenText(NumCompleteQuests), TitanUtils_GetHighlightText(NumQuests) );
return TITAN_QUESTS_BUTTON_LABEL, buttonRichText;
end
--
-- create tooltip text
--
function TitanPanelQuestsButton_GetTooltipText()
-- Expand everything
ExpandQuestHeader(0);
-- return string for tooltip
local tooltipRichText = "";
-- counters
local numElite = 0;
local numDungeon = 0;
local numRaid = 0;
local numPVP = 0;
local numReg = 0;
local numComplete = 0;
local numIncomplete = 0;
local i = 0;
local numQuests = 0;
-- get quest list
local questlist = TitanPanelQuests_BuildQuestList();
-- total number of quests
numQuests = table.getn(questlist);
-- count the different type of quests and count completed quests
for i=1, numQuests do
if ( questlist[i].questTag == ELITE ) then
numElite = numElite + 1;
elseif ( questlist[i].questTag == TITAN_QUESTS_DUNGEON ) then
numDungeon = numDungeon + 1;
elseif ( questlist[i].questTag == TITAN_QUESTS_RAID ) then
numRaid = numRaid + 1;
elseif ( questlist[i].questTag == TITAN_QUESTS_PVP ) then
numPVP = numPVP + 1;
else
numReg = numReg + 1;
end
if ( questlist[i].questisComplete ) then
numComplete = numComplete + 1;
else
numIncomplete = numIncomplete + 1;
end
end
tooltipRichText = tooltipRichText..TitanUtils_GetNormalText(TITAN_QUESTS_TOOLTIP_QUESTS_TEXT)..TitanUtils_GetHighlightText(numQuests.."\n");
tooltipRichText = tooltipRichText..TitanUtils_GetNormalText(TITAN_QUESTS_TOOLTIP_ELITE_TEXT)..TitanUtils_GetHighlightText(numElite.."\n");
tooltipRichText = tooltipRichText..TitanUtils_GetNormalText(TITAN_QUESTS_TOOLTIP_DUNGEON_TEXT)..TitanUtils_GetHighlightText(numDungeon.."\n");
tooltipRichText = tooltipRichText..TitanUtils_GetNormalText(TITAN_QUESTS_TOOLTIP_RAID_TEXT)..TitanUtils_GetHighlightText(numRaid.."\n");
tooltipRichText = tooltipRichText..TitanUtils_GetNormalText(TITAN_QUESTS_TOOLTIP_PVP_TEXT)..TitanUtils_GetHighlightText(numPVP.."\n");
tooltipRichText = tooltipRichText..TitanUtils_GetNormalText(TITAN_QUESTS_TOOLTIP_REGULAR_TEXT)..TitanUtils_GetHighlightText(numReg.."\n");
tooltipRichText = tooltipRichText.."\n";
tooltipRichText = tooltipRichText..TitanUtils_GetNormalText(TITAN_QUESTS_TOOLTIP_COMPLETED_TEXT)..TitanUtils_GetHighlightText(numComplete).."\n";
tooltipRichText = tooltipRichText..TitanUtils_GetNormalText(TITAN_QUESTS_TOOLTIP_INCOMPLETE_TEXT)..TitanUtils_GetHighlightText(numIncomplete).."\n";
tooltipRichText = tooltipRichText.."\n"..TitanUtils_GetGreenText(TITAN_QUESTS_TOOLTIP_HINT_TEXT);
return tooltipRichText;
end
--
-- create toplevel right-click menu
--
function TitanPanelRightClickMenu_PrepareQuestsMenu()
-- Large sections commented out, since they are replaced by various utility functions. - Ryessa
if ( UIDROPDOWNMENU_MENU_LEVEL >= 2 ) then
TitanPanelQuestsRightClickMenu_CreateMenu();
else
-- get quest list
local questlist = TitanPanelQuests_BuildQuestList();
-- total number of quests
local numQuests = table.getn(questlist);
local groupBy = "Location";
-- tracking length of list
local numButtons = 1; -- Starts at 1 because "Quests" header is added elsewhere. - Ryessa
if ( TitanGetVar(TITAN_QUESTS_ID, "SortByLevel") ) then
table.sort(questlist, function(a,b) return (a.questLevel < b.questLevel); end);
groupBy = "Level";
end
if ( TitanGetVar(TITAN_QUESTS_ID, "SortByTitle") ) then
table.sort(questlist, function(a,b) return (a.questTitle < b.questTitle); end);
groupBy = "Title";
end
local useTag;
local completeTag;
local questWatched = "";
local diff;
local groupId = "";
local lastGroupId = "";
local questDisplayCount = 0;
local i = 0;
local info = {};
TitanPanelRightClickMenu_AddTitle(TitanPlugins[TITAN_QUESTS_ID].menuText);
-- create a configuration entry
info = {};
info.text = TITAN_QUESTS_OPTIONS_TEXT;
info.value = "Options";
info.hasArrow = 1;
UIDropDownMenu_AddButton(info);
numButtons = numButtons + 1;
-- output quest list to menu
for i=1, numQuests do
local unCheckableQuest = nil; -- added
--[[
if ( questlist[i].questTag == ELITE ) then
useTag = "+"
elseif ( questlist[i].questTag == TITAN_QUESTS_DUNGEON ) then
useTag = "d";
elseif ( questlist[i].questTag == TITAN_QUESTS_RAID ) then
useTag = "r";
elseif ( questlist[i].questTag == TITAN_QUESTS_PVP ) then
useTag = "p";
else
useTag = "";
end
if ( questlist[i].questisComplete ) then
--useTag = "C";
completeTag = " ("..COMPLETE..")";
else
completeTag = "";
end
if ( IsQuestWatched(questlist[i].questID) ) then
questWatched = TitanUtils_GetGreenText(" (W)");
else
questWatched = "";
end
]]--
if ( TitanGetVar(TITAN_QUESTS_ID, "SortByLocation") and TitanGetVar(TITAN_QUESTS_ID, "GroupBehavior") ) then
groupId = questlist[i].questLocation;
elseif ( TitanGetVar(TITAN_QUESTS_ID, "SortByLevel") and TitanGetVar(TITAN_QUESTS_ID, "GroupBehavior") ) then
groupId = TITAN_QUESTS_LEVEL_TEXT..questlist[i].questLevel;
end
--[[
diff = GetDifficultyColor(questlist[i].questLevel);
]]--
-- check to see if quest is to be displayed
local checkDisplay = 0;
if ( TitanGetVar(TITAN_QUESTS_ID, "ShowElite") ) then
if ( questlist[i].questTag == ELITE ) then
checkDisplay = 1;
end
elseif ( TitanGetVar(TITAN_QUESTS_ID, "ShowDungeon") ) then
if ( questlist[i].questTag == TITAN_QUESTS_DUNGEON ) then
checkDisplay = 1;
end
elseif ( TitanGetVar(TITAN_QUESTS_ID, "ShowRaid") ) then
if ( questlist[i].questTag == TITAN_QUESTS_RAID ) then
checkDisplay = 1;
end
elseif ( TitanGetVar(TITAN_QUESTS_ID, "ShowPVP") ) then
if ( questlist[i].questTag == TITAN_QUESTS_PVP ) then
checkDisplay = 1;
end
elseif ( TitanGetVar(TITAN_QUESTS_ID, "ShowRegular") ) then
if ( questlist[i].questTag == nil ) then
checkDisplay = 1;
end
elseif ( TitanGetVar(TITAN_QUESTS_ID, "ShowCompleted") ) then
if ( questlist[i].questisComplete ) then
checkDisplay = 1;
end
elseif ( TitanGetVar(TITAN_QUESTS_ID, "ShowIncomplete") ) then
if ( not questlist[i].questisComplete ) then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -