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

📄 titanquests.lua

📁 时间太紧了
💻 LUA
📖 第 1 页 / 共 5 页
字号:

			-- abandon quest
			info = {};
			info.value = "AbandonQuest";
			info.text = ABANDON_QUEST;
			info.func = function ()	
					DropDownList1:Hide();				
					SetAbandonQuest();
                			StaticPopup_Show("ABANDON_QUEST", GetAbandonQuestName());
			end
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
			
			-- spacer				
			info = {};
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			-- quest details
			info = {};
			--info.value = questID;
			info.value = {TITAN_QUESTS_ID, questID, nil};
			info.text = TITAN_QUESTS_QUEST_DETAILS_TEXT;
			info.func = TitanPanelQuests_DisplayQuest;
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
	
			-- link quest
			info = {};
			info.value = "LinkQuest";
			info.text = TITAN_QUESTS_LINK_QUEST_TEXT;
			info.func = function ()
					ChatFrameEditBox:Insert("["..questLevel.."]"..questTitle.." ");
			end
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
			
		end
	elseif ( UIDROPDOWNMENU_MENU_LEVEL == 3 ) then

		if ( UIDROPDOWNMENU_MENU_VALUE == "DisplayAbout" ) then

			local AboutText = TITAN_QUESTS_ABOUT_POPUP_TEXT;

			info.text = AboutText;
			info.value = "AboutTextPopUP";
			info.notClickable = 1;
			info.isTitle = 0;
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

		elseif ( UIDROPDOWNMENU_MENU_VALUE == "Sort" ) then

			info = { };
			info.text = TITAN_QUESTS_SORT_TEXT;
			info.isTitle = 1;
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			-- sort by location (default)
			info = {};
			info.text = TITAN_QUESTS_SORT_LOCATION_TEXT;
			info.func = TitanPanelQuests_SortByLocation;
			info.checked = TitanGetVar(TITAN_QUESTS_ID, "SortByLocation");
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			-- sort by level
			info = {};
			info.text = TITAN_QUESTS_SORT_LEVEL_TEXT;
			info.func = TitanPanelQuests_SortByLevel;
			info.checked = TitanGetVar(TITAN_QUESTS_ID, "SortByLevel");
			--info.checked = 1;
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			-- sort by title
			info = {};
			info.text = TITAN_QUESTS_SORT_TITLE_TEXT;
			info.func = TitanPanelQuests_SortByTitle;
			info.checked = TitanGetVar(TITAN_QUESTS_ID, "SortByTitle");
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

		elseif ( UIDROPDOWNMENU_MENU_VALUE == "Show" ) then

			info = { };
			info.text = TITAN_QUESTS_SHOW_TEXT;
			info.isTitle = 1;
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			-- show just elite
			info = {};
			info.text = TITAN_QUESTS_SHOW_ELITE_TEXT;
			info.func = TitanPanelQuests_ShowElite;
			info.checked = TitanGetVar(TITAN_QUESTS_ID, "ShowElite");
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			-- show just dungeon
			info = {};
			info.text = TITAN_QUESTS_SHOW_DUNGEON_TEXT;
			info.func = TitanPanelQuests_ShowDungeon;
			info.checked = TitanGetVar(TITAN_QUESTS_ID, "ShowDungeon");
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			-- show just raid
			info = {};
			info.text = TITAN_QUESTS_SHOW_RAID_TEXT;
			info.func = TitanPanelQuests_ShowRaid;
			info.checked = TitanGetVar(TITAN_QUESTS_ID, "ShowRaid");
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
			
			-- show just pvp
			info = {};
			info.text = TITAN_QUESTS_SHOW_PVP_TEXT;
			info.func = TitanPanelQuests_ShowPVP;
			info.checked = TitanGetVar(TITAN_QUESTS_ID, "ShowPVP");
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
			
			-- show just regular
			info = {};
			info.text = TITAN_QUESTS_SHOW_REGULAR_TEXT;
			info.func = TitanPanelQuests_ShowRegular;
			info.checked = TitanGetVar(TITAN_QUESTS_ID, "ShowRegular");
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			-- show just completed
			info = {};
			info.text = TITAN_QUESTS_SHOW_COMPLETED_TEXT;
			info.func = TitanPanelQuests_ShowCompleted;
			info.checked = TitanGetVar(TITAN_QUESTS_ID, "ShowCompleted");
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			-- show only incomplete
			info = {};
			info.text = TITAN_QUESTS_SHOW_INCOMPLETE_TEXT;
			info.func = TitanPanelQuests_ShowIncomplete;
			info.checked = TitanGetVar(TITAN_QUESTS_ID, "ShowIncomplete");
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			-- show all
			info = {};
			info.text = TITAN_QUESTS_SHOW_ALL_TEXT;
			info.func = TitanPanelQuests_ShowAll;
			info.checked = TitanGetVar(TITAN_QUESTS_ID, "ShowAll");
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);


		elseif ( UIDROPDOWNMENU_MENU_VALUE == "Toggle" ) then

			info = { };
			info.text = TITAN_QUESTS_TOGGLE_TEXT;
			info.isTitle = 1;
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			-- toggle blizzard's questlog
			info = {};
			if ( QuestLogFrame:IsVisible() ) then
				info.text = TITAN_QUESTS_CLOSE_QUESTLOG_TEXT;
			else
				info.text = TITAN_QUESTS_OPEN_QUESTLOG_TEXT;
			end

			info.value = "OpenQuestLog";
			info.func = ToggleQuestLog;
			UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);

			-- toggle MonkeyQuest
			if ( MonkeyQuestFrame ~= nil ) then
				info = {};
				if ( MonkeyQuestFrame:IsVisible() ) then
					info.text = TITAN_QUESTS_CLOSE_MONKEYQUEST_TEXT;
				else
					info.text = TITAN_QUESTS_OPEN_MONKEYQUEST_TEXT;
				end
				info.value = "OpenMonkeyQuest";
				info.func = TitanPanelQuests_ToggleMonkeyQuest;
				UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
			end

			-- toggle QuestIon
			if ( QuestIon_Frame ~= nil ) then
				info = {};
				if ( QuestIon_Frame:IsVisible() ) then
					info.text = TITAN_QUESTS_CLOSE_QUESTION_TEXT;
				else
					info.text = TITAN_QUESTS_OPEN_QUESTION_TEXT;
				end
				info.value = "OpenQuestIon";
				info.func = QuestIon_ToggleVisible;
				UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
			end

			-- toggle PartyQuests
			if ( PartyQuestsFrame ~= nil ) then
				info = {};
				if ( PartyQuestsFrame:IsVisible() ) then
					info.text = TITAN_QUESTS_CLOSE_PARTYQUESTS_TEXT;
				else
					info.text = TITAN_QUESTS_OPEN_PARTYQUESTS_TEXT;
				end
				info.value = "OpenPartyQuests";
				info.func = TogglePartyQuests;
				UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
			end

			-- toggle QuestHistory
 			if ( QuestHistoryFrame ~= nil ) then
				info = {};
				if ( QuestHistoryFrame:IsVisible() ) then
					info.text = TITAN_QUESTS_CLOSE_QUESTHISTORY_TEXT;
				else
					info.text = TITAN_QUESTS_OPEN_QUESTHISTORY_TEXT;
				end
				info.value = "OpenQuestHistory";
				info.func = QuestHistory_Toggle;
				UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
			end	
	
			-- toggle QuestBank
			if (QuestBankFrame ~= nil ) then
				info = {};
				if ( QuestBankFrame:IsVisible() ) then
					info.text = TITAN_QUESTS_CLOSE_QUESTBANK_TEXT;
				else
					info.text = TITAN_QUESTS_OPEN_QUESTHISTORY_TEXT;
				end
				info.value = "OpenQuestBank";
				info.func = QuestBank_Toggle;
				UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
			end
			-- end toggles	
		end
	end
end

--
-- Click on a Quest entry
--	
function TitanPanelQuests_ClickQuest()
	if ( (TitanGetVar(TITAN_QUESTS_ID, "ClickBehavior") and not IsShiftKeyDown()) or (not TitanGetVar(TITAN_QUESTS_ID, "ClickBehavior") and IsShiftKeyDown()) ) then
		TitanPanelQuests_ToggleWatchStatus()
	else
		TitanPanelQuests_DisplayQuest();
		this:GetParent():Hide();
	end
end

--
-- Toggle Watch Status
--	
function TitanPanelQuests_ToggleWatchStatus()
	local questID;
	local button;

	-- Get current Quest selected
	questID = this.value[2];

	-- Get the quest button
	for i=1, UIDROPDOWNMENU_MAXBUTTONS, 1 do
		button = getglobal("DropDownList1Button"..i);
		if ( type(button.value) == type(this.value) ) then
			if ( button.value[2] and this.value[2] == button.value[2] ) then
				break;
			else
				button = nil;
			end
		else
			button = nil;
		end
	end

	-- Add/Remove quest from Quest Tracker
	if ( IsQuestWatched(questID) ) then
		-- Update Quest Tracker
		RemoveQuestWatch(questID);
		QuestWatch_Update();
		-- Toggle Status
		TitanPanelRightClickMenu_ToggleVar(TITAN_QUESTS_ID, questID);
		-- Update watcher tag.
		button:SetText(TitanPanelQuests_GetQuestText(questID));
		-- Update the secondary pane
		getglobal("DropDownList2"):Hide();
		if ( this:GetParent():GetName() == "DropDownList2" ) then
			button.checked = nil;
			getglobal(button:GetName().."Check"):Hide();
			UIDropDownMenu_Refresh();
		end
	else
		if (TitanPanelQuests_IsWatchAllowed(questID)) then
			-- Update Quest Tracker
			AddQuestWatch(questID);
			QuestWatch_Update();
			-- Toggle Status
			TitanPanelRightClickMenu_ToggleVar(TITAN_QUESTS_ID, questID);
			-- Update watcher tag.
			button:SetText(TitanPanelQuests_GetQuestText(questID));
			-- Update the secondary pane
			getglobal("DropDownList2"):Hide();
			if ( this:GetParent():GetName() == "DropDownList2" ) then
				button.checked = 1;
				getglobal(button:GetName().."Check"):Show();
				UIDropDownMenu_Refresh();
			end
		else
			-- Prevent checkmark from showing up... pretty counter-intuitive, we need to set this to checked
			-- so that the later code in UIDropDownMenu.lua will uncheck it again. - Ryessa
			if ( this:GetParent():GetName() == "DropDownList1" ) then
				button.checked = 1;
			else
				button.checked = nil;
				getglobal(button:GetName().."Check"):Hide();
				this:GetParent():Hide();
				UIDropDownMenu_Refresh();
			end;
		end
	end
end

--
-- IsWatchAllowed
--	
function TitanPanelQuests_IsWatchAllowed(questID)
		if ( GetNumQuestLeaderBoards(questID) == 0 ) then
			-- Set an error that there are no objectives for the quest, so it may not be watched.
			UIErrorsFrame:AddMessage(QUEST_WATCH_NO_OBJECTIVES, 1.0, 0.1, 0.1, 1.0, UIERRORS_HOLD_TIME);
			return false;
		end
		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);
			return false;
           	end

		-- Retrieve the quest info for questID.
		local Title, Level, Tag, isHeader, isCollapsed, isComplete;
		Title, Level, Tag, isHeader, isCollapsed, isComplete = GetQuestLogTitle(questID);
		if ( isComplete ) then
			-- We can't watch a complete item.
			return false;
		end
		return true;
end
--
-- SortBy toggle functions
--	
function TitanPanelQuests_SortByLevel()
	if ( TitanGetVar(TITAN_QUESTS_ID, "SortByLevel") ) then
		TitanSetVar(TITAN_QUESTS_ID, "SortByLevel", nil);
		TitanSetVar(TITAN_QUESTS_ID, "SortByLocation", 1);
		TitanSetVar(TITAN_QUESTS_ID, "SortByTitle", nil);
	else
		TitanSetVar(TITAN_QUESTS_ID, "SortByLevel", 1);
		TitanSetVar(TITAN_QUESTS_ID, "SortByLocation", nil);
		TitanSetVar(TITAN_QUESTS_ID, "SortByTitle", nil);
	end
	DropDownList1:Hide();
end

function TitanPanelQuests_SortByLocation()
	TitanSetVar(TITAN_QUESTS_ID, "SortByLevel", nil);
	TitanSetVar(TITAN_QUESTS_ID, "SortByLocation", 1);
	TitanSetVar(TITAN_QUESTS_ID, "SortByTitle", nil);
	TitanPanelButton_UpdateButton(TITAN_QUESTS_ID)
	DropDownList1:Hide();
end

function TitanPanelQuests_SortByTitle()
	if ( TitanGetVar(TITAN_QUESTS_ID, "SortByTitle") ) then
		TitanSetVar(TITAN_QUESTS_ID, "SortByLevel", nil);
		TitanSetVar(TITAN_QUESTS_ID, "SortByLocation", 1);
		TitanSetVar(TITAN_QUESTS_ID, "SortByTitle", nil);
	else
		TitanSetVar(TITAN_QUESTS_ID, "SortByLevel", nil);
		TitanSetVar(TITAN_QUESTS_ID, "SortByLocation", nil);
		TitanSetVar(TITAN_QUESTS_ID, "SortByTitle", 1);
	end
	DropDownList1:Hide();
end

--
-- Show toggle functions
--
function TitanPanelQuests_ShowElite()
	if ( TitanGetVar(TITAN_QUESTS_ID, "ShowElite") ) then
		TitanSetVar(TITAN_QUESTS_ID, "ShowElite", nil);
		TitanSetVar(TITAN_QUESTS_ID, "ShowAll", 1);
	else
		TitanSetVar(TITAN_QUESTS_ID, "ShowElite", 1);

⌨️ 快捷键说明

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