⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 titanquests.lua

📁 时间太紧了
💻 LUA
📖 第 1 页 / 共 5 页
字号:
					checkDisplay = 1;
				end
			else	
				checkDisplay = 1;
			end
	
			if ( checkDisplay == 1 ) then
	
				-- Check if this will be the last item displayed
				if ( (questDisplayCount == 29) or ((groupId ~= "" and groupId ~= lastGroupId) and (questDisplayCount==28)) ) then
	
					-- Display a truncation notice and exit for loop
					info.text = TITAN_QUESTS_QUESTLOG_TRUNCATED_TEXT;
					info.isTitle = 1;
					info.value = "QuestLogTruncated";
					info.hasArrow = nil;
					info.notCheckable = 1;
					UIDropDownMenu_AddButton(info);
					numButtons = numButtons + 1;
	
					break;
				else
					questDisplayCount = questDisplayCount + 1;
					info = {};
					if ( groupId ~= "" and groupId ~= lastGroupId ) then
						info.text = groupId;
						info.isTitle = 1;
						info.notCheckable = 1;
						UIDropDownMenu_AddButton(info);
						numButtons = numButtons + 1;
						info = {};
						lastGroupId = groupId;
						questDisplayCount = questDisplayCount + 1;
					end
		
					if ( IsQuestWatched(questlist[i].questID) ) then
						-- May want to move part of this code to OnLoad() - Ryessa
						TitanSetVar(TITAN_QUESTS_ID, questlist[i].questID, 1);
						info.checked = TitanGetVar(TITAN_QUESTS_ID, questlist[i].questID);
					end
	
--[[					if ( groupBy == "Location" and TitanGetVar(TITAN_QUESTS_ID, "GroupBehavior") ) then
						info.text = TitanUtils_GetColoredText("["..questlist[i].questLevel..useTag.."]  ",diff)..questlist[i].questTitle..TitanUtils_GetRedText(completeTag)..questWatched;
					else
						info.text = TitanUtils_GetColoredText("["..questlist[i].questLevel..useTag.."]  ",diff)..questlist[i].questTitle..TitanUtils_GetRedText(completeTag)..TitanUtils_GetNormalText("  ["..questlist[i].questLocation.."]")..questWatched;
					end
]]--
					info.text = TitanPanelQuests_GetQuestText(questlist[i].questID); -- added

					info.value = {TITAN_QUESTS_ID, questlist[i].questID, nil};
					info.hasArrow = 1;

					info.func = TitanPanelQuests_ClickQuest;
					--info.notCheckable = 1;
					info.keepShownOnClick = 1;
					UIDropDownMenu_AddButton(info);
					numButtons = numButtons + 1;
					
					-- Add a tracking variable to set the button id for this quest.
					TitanSetVar(TITAN_QUESTS_ID, questlist[i].questID.."ButtonID", numButtons);
				end
			end	
		end
	end
end

--
-- utility function to get the string tag for a quest
--
function TitanPanelQuests_GetQuestTagText(questID)
	local useTag = "";
	local Title, Level, Tag, isHeader, isCollapsed, isComplete = GetQuestLogTitle(questID);

	-- Loc Note: Need to localize these tags - Ryessa
	if ( Tag == ELITE ) then
		useTag = "+"
	elseif ( Tag == TITAN_QUESTS_DUNGEON ) then
		useTag = "d";
	elseif ( Tag == TITAN_QUESTS_RAID ) then
		useTag = "r";
	elseif ( Tag == TITAN_QUESTS_PVP ) then
		useTag = "p";
	else
		useTag = "";
	end 
	
	if ( isComplete ) then
		--useTag = "C";
	end

	return useTag;
end

--
-- utility function to get the string tag for a watched quest
--
function TitanPanelQuests_GetQuestWatchText(questID)
	local questWatched;

	if ( IsQuestWatched(questID) ) then
		-- Loc Note: Need to localize this tag - Ryessa
		questWatched = TitanPanelQuests_BlueText(" (W)");
	else
		questWatched = "";
	end
	
	return questWatched;
end

--
-- utility function to get the string tag for a completed quest
--
function TitanPanelQuests_GetQuestCompleteText(questID)
	local completeTag;
	local Title, Level, Tag, isHeader, isCollapsed, isComplete = GetQuestLogTitle(questID);

	if ( isComplete ) then
		completeTag = "  ("..COMPLETE..")";
	else
		completeTag = "";
	end
	
	SelectQuestLogEntry(questID);
	if ( IsCurrentQuestFailed() ) then
		completeTag = " ("..TEXT(FAILED)..")";
	end
			
	return completeTag;
end

--
-- utility function to get the location string for a quest
--
function TitanPanelQuests_GetQuestLocationText(questID)
	local i;
	local questLocation = "";

	local questlist = TitanPanelQuests_BuildQuestList();
	local numQuests = table.getn(questlist);

	for i=1, numQuests do
		if ( questID == questlist[i].questID ) then
			questLocation = questlist[i].questLocation;
			break;
		end
	end

	if ( TitanGetVar(TITAN_QUESTS_ID, "SortByLocation") and TitanGetVar(TITAN_QUESTS_ID, "GroupBehavior") ) then
		return "";
	else
		return TitanUtils_GetNormalText("  ["..questLocation.."]");
	end
end

--
-- utility function to get the string tag for a watched quest
--

function TitanPanelQuests_GetQuestText(questID)
	local Title, Level, Tag, isHeader, isCollapsed, isComplete = GetQuestLogTitle(questID);
	local questTag;
	local locationTag = TitanPanelQuests_GetQuestLocationText(questID);

	questTag = TitanUtils_GetColoredText("["..Level..TitanPanelQuests_GetQuestTagText(questID).."]  ",GetDifficultyColor(Level))..Title..TitanUtils_GetRedText(TitanPanelQuests_GetQuestCompleteText(questID))..locationTag..TitanPanelQuests_GetQuestWatchText(questID);

	return questTag;
end

--
-- create 2nd level right-click menu
--

function TitanPanelQuestsRightClickMenu_CreateMenu()
    
    local info = {};

	if ( UIDROPDOWNMENU_MENU_LEVEL == 2 ) then
		if ( UIDROPDOWNMENU_MENU_VALUE == "Options" ) then
			-- sort selection
			info = {};
			info.text = TITAN_QUESTS_SORT_TEXT;
			info.value = "Sort";
			info.hasArrow = 1;
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			-- show selection
			info = {};
			info.text = TITAN_QUESTS_SHOW_TEXT;
			info.value = "Show";
			info.hasArrow = 1;
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			-- toggle dropdown menu
			info = {};
			info.text = TITAN_QUESTS_TOGGLE_TEXT;
			info.value = "Toggle";
			info.hasArrow = 1;
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			TitanPanelRightClickMenu_AddSpacer(UIDROPDOWNMENU_MENU_LEVEL);

			-- toggle click behavior
			info = {};
			info.text = TITAN_QUESTS_CLICK_BEHAVIOR_TEXT;
			info.value = "ClickBehavior";
			info.hasArrow = nil;
			info.keepShownOnClick = 1;	
			info.func = TitanPanelQuests_ToggleClickBehavior;
			info.checked = TitanGetVar(TITAN_QUESTS_ID, "ClickBehavior");
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
					
			-- toggle grouping
			info = {};
			info.text = TITAN_QUESTS_GROUP_BEHAVIOR_TEXT;
			info.value = "GroupBehavior";
			info.hasArrow = nil;
			info.keepShownOnClick = nil;	
			info.func = TitanPanelQuests_ToggleGroupBehavior;
			info.checked = TitanGetVar(TITAN_QUESTS_ID, "GroupBehavior");
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			TitanPanelRightClickMenu_AddSpacer(UIDROPDOWNMENU_MENU_LEVEL);

			-- Toggle icon
			info = {};
			info.text = TITAN_PANEL_MENU_SHOW_ICON;
			info.value = {TITAN_QUESTS_ID, "ShowIcon", nil};
			info.func = TitanPanelRightClickMenu_ToggleVar;
			info.checked = TitanGetVar(TITAN_QUESTS_ID, "ShowIcon");
			info.keepShownOnClick = 1;
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			-- Toggle Label Text
			info = {};
			info.text = TITAN_PANEL_MENU_SHOW_LABEL_TEXT;
			info.value = {TITAN_QUESTS_ID, "ShowLabelText", nil};
			info.func = TitanPanelRightClickMenu_ToggleVar;
			info.checked = TitanGetVar(TITAN_QUESTS_ID, "ShowLabelText");
			info.keepShownOnClick = 1;
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			TitanPanelRightClickMenu_AddCommand(TITAN_PANEL_MENU_HIDE,TITAN_QUESTS_ID,TITAN_PANEL_MENU_FUNC_HIDE, UIDROPDOWNMENU_MENU_LEVEL);
			TitanPanelRightClickMenu_AddSpacer(UIDROPDOWNMENU_MENU_LEVEL);

			-- info about plugin
			info = {};
			info.text = TITAN_QUESTS_ABOUT_TEXT;
			info.value = "DisplayAbout";
			info.hasArrow = 1;
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

		else
			--
			-- build quest objectives list
			--
			local questID = UIDROPDOWNMENU_MENU_VALUE[2];
			--TitanPanelQuests_ChatPrint("QuestID: "..questID);

			--local questTitle, questLevel, questTag, questisHeader, questisCollapsed, questisComplete;
			--local diff, useTag, completeTag;
			--questTitle, questLevel, questTag, questisHeader, questisCollapsed, questisComplete = GetQuestLogTitle(questID);

			local questTitle, questLevel = GetQuestLogTitle(questID);

			local questDescription = "";
			local questObjectives = "";

			local numObjectives = 0;
	
			local ObjectivesText = "";

		        -- select the quest entry
 		        SelectQuestLogEntry(questID);
	                QuestLog_SetSelection(questID);
	
			questDescription, questObjectives = GetQuestLogQuestText();

			numObjectives = GetNumQuestLeaderBoards();

			info = {};
			info.value = questTitle;
			info.text = questTitle;
			info.isTitle = 1;
			info.notClickable = 1;
			info.notCheckable = 1;
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			if ( numObjectives > 0 ) then
				for j = 1, numObjectives, 1 do
					local text;
                			local type;
                			local finished;

					info = {};
			
					text, type, finished = GetQuestLogLeaderBoard(j);

					if ( finished ) then
						info.text = TitanUtils_GetRedText(text);
					else
						info.text = text;
					end
					info.value = text;
					info.notClickable = 1;
					--info.isTitle = 0;
					UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
				end
			else
					info = {};
					if ( strlen(questObjectives) < 65 ) then
						info.text = TitanUtils_GetHighlightText(questObjectives);
					else
						info.text = TitanUtils_GetHighlightText(TITAN_QUESTS_OBJECTIVESTXT_LONG_TEXT);
					end
					info.value = "noobjective";
					info.notClickable = 1;
					info.func = TitanPanelQuests_DisplayQuest;
					UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
			end
			
			-- spacer				
			info = {};
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			-- Header for options stuff
			info = {};
			info.value = "Quest Options";
			info.text = TITAN_QUESTS_QUEST_DETAILS_OPTIONS_TEXT;
			info.isTitle = 1;
			info.notClickable = 1;
			info.notCheckable = 1;
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			-- Add/Remove quest from Quest Tracker
			if ( IsQuestWatched(questID) ) then
				info = {};
				info.text = TITAN_QUESTS_REMOVE_FROM_WATCHER_TEXT;
				info.value = {TITAN_QUESTS_ID, questID, nil};
				info.isTitle = nil;
				info.notClickable = nil;
				info.notCheckable = nil;
				info.func = TitanPanelQuests_ToggleWatchStatus;
				--function ()
				--		RemoveQuestWatch(questID);
				--		QuestWatch_Update();
				--end
				UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
			else
				if ( GetNumQuestLeaderBoards(questID) > 0 ) then
					info.text = TITAN_QUESTS_ADD_TO_WATCHER_TEXT;
					info.value = {TITAN_QUESTS_ID, questID, nil};
					info.isTitle = nil;
					info.notClickable = nil;
					info.notCheckable = nil;
					info.disabled = nil;
					info.func = TitanPanelQuests_ToggleWatchStatus;
					--function ()
					--	if ( GetNumQuestWatches() >= MAX_WATCHABLE_QUESTS ) then
               				--		-- Set an error message if trying to show too many quests
                        		--		UIErrorsFrame:AddMessage(format(QUEST_WATCH_TOO_MANY, MAX_WATCHABLE_QUESTS), 1.0, 0.1, 0.1, 1.0, UIERRORS_HOLD_TIME);
                			--	else
					--		AddQuestWatch(questID);
					--		QuestWatch_Update();
					--	end
					--end
					
					UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
				end
			end
			
			-- share quest
			if ( GetQuestLogPushable() ) then
				info = {};
				info.value = "ShareQuest";
				info.text = SHARE_QUEST;
				info.func = function ()
					QuestLogPushQuest();
				end
				UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
			end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -