glimquestion.lua
字号:
end
function gLimQuestion_QH_Update()
if ( not QuestHistory_GetSearchText() ) then
return true;
end
-- Build sorted table if it hasn't been created yet
if ( not SortedTable ) then
QuestHistory_BuildSortedTable();
end
-- Highlight currently selected quest if it is visible in the scrollframe
local currentTitleListID = QuestHistory_GetCurrentSortedID() - FauxScrollFrame_GetOffset(QuestHistoryListScrollFrame);
if ( currentTitleListID >= 1 and currentTitleListID <= 31 ) then
QuestHistoryListHighlightFrame:SetPoint("LEFT", "QuestHistoryListFrame"..currentTitleListID, "LEFT", 0, -2);
QuestHistoryListHighlightFrame:Show();
else
-- Hide the highlight frame since selected quest is not visible in the scrollframe
QuestHistoryListHighlightFrame:Hide();
end
-- Format QuestHistory title appropriately depending on how many quests are logged
QuestHistoryTitleText:SetText("查询结果:"..sizeSortedTable.."个任务");
-- Update the scroll frame and add the quest data
local DisplayedRealmName,DisplayedPlayerCharacterName = QuestHistory_GetQuestIndexString();
FauxScrollFrame_Update(QuestHistoryListScrollFrame, sizeSortedTable, QUESTHISTORY_ITEMS_SHOWN, QUESTHISTORY_ITEM_HEIGHT);
for iQuest = 1, QUESTHISTORY_ITEMS_SHOWN, 1 do
local questIndex = iQuest + FauxScrollFrame_GetOffset(QuestHistoryListScrollFrame);
local listFrame = "QuestHistoryListFrame"..iQuest;
if ( questIndex <= sizeSortedTable ) then
local color;
-- Get quest information
local index = SortedTable[questIndex];
local title;
local level;
local category;
local tag;
local completed;
if (BaseQuestDB[index].qh and QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][BaseQuestDB[index].qh]) then
title = QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][BaseQuestDB[index].qh].t;
level = QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][BaseQuestDB[index].qh].l;
category = QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][BaseQuestDB[index].qh].c;
tag = QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][BaseQuestDB[index].qh].y;
completed = QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][BaseQuestDB[index].qh].co;
else
_,_,category,title,level = string.find(BaseQuestDB[index].q,"([^`]*)`([^`]*)`%d*`(%d*)`%d*`.*");
end
-- Check to make sure none of the data is nil
if ( not title ) then
title = "";
end
if ( not level ) then
level = "";
end
if ( not category ) then
category = "";
end
if ( not tag ) then
tag = "";
end
-- Add quest data to frame
getglobal(listFrame.."AcceptedText"):SetText(index);
getglobal(listFrame.."TitleText"):SetText(title);
getglobal(listFrame.."LevelText"):SetText(level);
getglobal(listFrame.."CategoryText"):SetText(category);
getglobal(listFrame.."TagText"):SetText(tag);
if ( completed ) then
-- If quest has been completed, show checkmark and completed number in brackets
getglobal(listFrame.."CompletedText"):SetText("["..completed.."]");
getglobal(listFrame.."CheckMark"):Show();
else
-- Otherwise, hide checkmark and display nothing for completed
getglobal(listFrame.."CompletedText"):SetText("");
getglobal(listFrame.."CheckMark"):Hide();
end
-- Set color depending on quest status
if (completed) then
color = QuestHistoryStatusColor["completed"];
elseif (BaseQuestDB[index].qh and
QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][BaseQuestDB[index].qh] and
QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][BaseQuestDB[index].qh].a )
then
color = QuestHistoryStatusColor["abandoned"];
elseif (BaseQuestDB[index].qh and
QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][BaseQuestDB[index].qh] and
QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][BaseQuestDB[index].qh].f )
then
color = QuestHistoryStatusColor["failed"];
else
if ( level == "" ) then
level = 0;
end
color = GetDifficultyColor(level);
end
-- Apply color to text
getglobal(listFrame.."AcceptedText"):SetTextColor(color.r, color.g, color.b);
getglobal(listFrame.."TitleText"):SetTextColor(color.r, color.g, color.b);
getglobal(listFrame.."LevelText"):SetTextColor(color.r, color.g, color.b);
getglobal(listFrame.."CategoryText"):SetTextColor(color.r, color.g, color.b);
getglobal(listFrame.."TagText"):SetTextColor(color.r, color.g, color.b);
getglobal(listFrame.."CompletedText"):SetTextColor(color.r, color.g, color.b);
getglobal(listFrame):Show();
else
-- Hide the list frame if there is no data for it
getglobal(listFrame):Hide();
end
end
return false;
end
function gLimQuestion_QH_ListFrame_OnClick(button)
if ( not QuestHistory_GetSearchText() or button == "LeftButton" ) then
return true;
end
return false;
end
function gLimQuestion_QH_ListFrame_OnEnter()
if ( not QuestHistory_GetSearchText() ) then
return true;
end
local index = SortedTable[this:GetID() + FauxScrollFrame_GetOffset(QuestHistoryListScrollFrame)];
index = BaseQuestDB[index].qh;
local note;
local DisplayedRealmName,DisplayedPlayerCharacterName = QuestHistory_GetQuestIndexString();
if (QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][index]) then
note = QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][index].n;
end
if ( note ~= nil and note ~= "" ) then
QuestHistoryTooltip:SetPoint("TOPLEFT", "QuestHistoryListFrame"..this:GetID().."CompletedText", "TOPRIGHT", 15, 0);
QuestHistoryTooltipText:SetText(note);
QuestHistoryTooltip:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b);
QuestHistoryTooltip:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b);
QuestHistoryTooltip:Show();
end
return false;
end
function gLimQuestion_QH_Detail_Update(questIndex)
gLimQuestionQHNPCFrame:Hide();
QuestHistoryDetailScrollFrame:Show();
QuestHistoryDetailPreviousButton:Show();
QuestHistoryDetailFrameNextButton:Show();
local spacerFrame = QuestHistoryDetailSpacerFrame;
local qhIndex;
if ( not QuestHistory_GetSearchText() ) then
qhIndex = questIndex;
local DisplayedRealmName,DisplayedPlayerCharacterName = QuestHistory_GetQuestIndexString();
local questTitle = QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][questIndex].t;
local level = QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][questIndex].l;
local questObjectives = QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][questIndex].o;
gLimQuestion_QuestData = gLimQuestion_GetQuest(questTitle,level,questObjectives);
else
qhIndex = BaseQuestDB[questIndex].qh;
gLimQuestion_QuestData = gLimQuestion_GetQuestByIndex(questIndex);
end
if (qhIndex) then
QuestHistoryDetailEditButton:Show();
orgQuestHistory_Detail_Update(qhIndex);
else
QuestHistoryDetailNotesScrollFrame:Hide();
QuestHistoryDetailSaveButton:Hide();
QuestHistoryDetailListScrollFrame:Show();
QuestHistoryDetailEditButton:Show();
-- Get information for frame title
local questTitle = gLimQuestion_QuestData.t;
local level = gLimQuestion_QuestData.l;
-- Set variables to default values if the corresponding data is not in log
if ( not questTitle ) then
questTitle = "";
end
if ( not level ) then
level = "";
end
-- Set the title of the frame to show quest title, level and tag
QuestHistoryDetailTitle:SetText(format(TEXT(QUESTHISTORY_DETAIL_TITLE_FORMAT), questTitle, level, ""));
QuestHistoryDetailTitle:Show();
-- Display the level of player when quest was accepted/logged
local levelAccepted = gLimQuestion_QuestData.la;
QuestHistoryDetailLevelAcceptedTitle:SetText(QUESTHISTORY_LEVEL_ACCEPTED_TITLE);
if ( levelAccepted ) then
QuestHistoryDetailLevelAcceptedText:SetText(levelAccepted);
QuestHistoryDetailLevelAcceptedText:Show();
else
QuestHistoryDetailLevelAcceptedText:Hide();
end
QuestHistoryDetailLevelCompletedText:Hide();
QuestHistoryDetailMoneyRewardedText:Hide();
QuestHistoryDetailXPRewardedText:Hide();
QuestHistoryDetailQuestGiverText:Hide();
QuestHistoryDetailQuestCompleterText:Hide();
QuestHistoryDetailAcceptedLocationButton:Hide();
QuestHistoryDetailCompletedLocationButton:Hide();
QuestHistoryDetailTimeAcceptedTitle:SetText(QUESTHISTORY_TIME_ACCEPTED_TITLE);
QuestHistoryDetailTimeAcceptedText:Hide();
QuestHistoryDetailTimeCompletedText:Hide();
QuestHistoryDetailTimesAbandonedText:Hide();
QuestHistoryDetailTimesFailedText:Hide();
QuestHistoryDetailListNotes:Hide();
QuestHistoryDetailEditButton:Hide();
QuestHistoryDetailQuestTitle:SetText(questTitle);
-- Display the quest objective
local questObjectives = gLimQuestion_QuestData.o;
if ( not questObjectives ) then
questObjectives = "";
end
QuestHistoryDetailObjectivesText:SetText(questObjectives);
for i = 1, MAX_OBJECTIVES, 1 do
getglobal("QuestHistoryDetailObjective"..i):Hide();
end
QuestHistoryDetailRequiredMoneyText:Hide();
QuestHistoryDetailRequiredMoneyFrame:Hide();
QuestHistoryDetailDescriptionTitle:SetPoint("TOPLEFT", "QuestHistoryDetailObjectivesText", "BOTTOMLEFT", 0, -10);
QuestHistoryDetailQuestDescription:SetText("");
QuestFrame_SetAsLastShown(QuestHistoryDetailQuestDescription, spacerFrame);
QuestHistoryDetailRewardTitleText:Hide();
QuestHistoryDetailMoneyFrame:Hide();
for i = 1, MAX_NUM_ITEMS, 1 do
getglobal("QuestHistoryDetailItem"..i):Hide();
end
QuestHistoryDetailItemReceiveText:Hide();
QuestHistoryDetailItemChooseText:Hide();
end
-- Display the name of the quest giver
if (gLimQuestion_QuestData and gLimQuestion_QuestData.g) then
QuestHistoryDetailQuestGiverText:SetText(gLimQuestion_QuestData.g);
QuestHistoryDetailQuestGiverText:Show();
end
-- Display the name of the quest completer
if (gLimQuestion_QuestData and gLimQuestion_QuestData.w) then
QuestHistoryDetailQuestCompleterText:SetText(gLimQuestion_QuestData.w);
QuestHistoryDetailQuestCompleterText:Show();
end
-- Display the location where quest was accepted
if (gLimQuestion_QuestData and gLimQuestion_QuestData.az) then
QuestHistoryDetailAcceptedLocationButton:Hide();
local text = gLimQuestion_QuestData.az;
if (gLimQuestion_QuestData.pa and gLimQuestion_QuestData.pa[1]) then
text = text.." ("..gLimQuestion_QuestData.pa[1].x..", "..gLimQuestion_QuestData.pa[1].y..")";
end
gLimQuestionQHDetailAcceptedLocationText:SetText(text);
local tltip="|cFFFFFF00月光任务查询(接受任务地点)|r\n";
if (gLimQuestion_QuestData.g) then
tltip=tltip.."|cFF00FF00"..gLimQuestion_QuestData.g.."|r\n";
end
tltip=tltip..gLimQuestion_QuestData.az.."\n";
local poscount = 0;
for k,v in gLimQuestion_QuestData.pa do
if (poscount==5) then
poscount = 0;
tltip = tltip.."\n";
end
tltip = tltip.."<"..v.x..","..v.y..">";
poscount = poscount+1;
end
gLimQuestionQHDetailAcceptedLocationButton.tooltip = tltip;
gLimQuestionQHDetailAcceptedLocationButton:Show();
else
gLimQuestionQHDetailAcceptedLocationButton.tooltip = nil;
gLimQuestionQHDetailAcceptedLocationButton:Hide();
end
-- Display the location where quest was completed
if (gLimQuestion_QuestData and gLimQuestion_QuestData.cz) then
QuestHistoryDetailCompletedLocationButton:Hide();
local text = gLimQuestion_QuestData.cz;
if (gLimQuestion_QuestData.pc and gLimQuestion_QuestData.pc[1]) then
text = text.." ("..gLimQuestion_QuestData.pc[1].x..", "..gLimQuestion_QuestData.pc[1].y..")";
end
gLimQuestionQHDetailCompletedLocationText:SetText(text);
local tltip="|cFFFFFF00月光任务查询(完成任务地点)|r\n";
if (gLimQuestion_QuestData.w) then
tltip=tltip.."|cFF00FF00"..gLimQuestion_QuestData.w.."|r\n";
end
tltip=tltip..gLimQuestion_QuestData.cz.."\n";
local poscount = 0;
for k,v in gLimQuestion_QuestData.pc do
if (poscount==5) then
poscount = 0;
tltip = tltip.."\n";
end
tltip = tltip.."<"..v.x..","..v.y..">";
poscount = poscount+1;
end
gLimQuestionQHDetailCompletedLocationButton.tooltip = tltip;
gLimQuestionQHDetailCompletedLocationButton:Show();
else
gLimQuestionQHDetailCompletedLocationButton.tooltip = nil;
gLimQuestionQHDetailCompletedLocationButton:Hide();
end
local i;
for i = 1, 10 do
local button = getglobal("gLimQuestionQHObjectButton"..i);
local qhstring = getglobal("QuestHistoryDetailObjective"..i);
if (not qhstring:IsVisible() and gLimQuestion_QuestData and gLimQuestion_QuestData.os and gLimQuestion_QuestData.os[i] and gLimQuestion_QuestData.os[i].t) then
qhstring:SetTextColor(0, 0, 0);
qhstring:SetText(gLimQuestion_QuestData.os[i].t);
qhstring:Show();
QuestHistoryDetailDescriptionTitle:SetPoint("TOPLEFT", "QuestHistoryDetailObjective"..i, "BOTTOMLEFT", 0, -10);
end
button:Hide();
if (qhstring:IsVisible() and gLimQuestion_QuestData and gLimQuestion_QuestData.os) then
local text = qhstring:GetText();
text = string.gsub(text,"已杀死","");
text = string.gsub(text,":.*","");
for k,v in gLimQuestion_QuestData.os do
local objtext = v.t;
objtext = string.gsub(objtext,"已杀死","");
objtext = string.gsub(objtext,":.*","");
if (objtext==text and v.npc) then
button:ClearAllPoints();
button:SetPoint("TOPLEFT","QuestHistoryDetailObjective"..i,"TOPLEFT", 0, 0);
button:SetPoint("BOTTOMRIGHT","QuestHistoryDetailObjective"..i,"BOTTOMRIGHT", 0, 0);
button:SetID(k);
button:Show();
break;
end
end
end
end
QuestHistoryDetailListScrollFrameScrollBar:SetValue(0);
QuestHistoryDetailListScrollFrame:UpdateScrollChildRect();
QuestHistoryDetailScrollFrameScrollBar:SetValue(0);
QuestHistoryDetailScrollFrame:UpdateScrollChildRect();
return false;
end
function gLimQuestionDelete_OnUpdate()
if(UnitLevel("player") == 0) then
return;
else
local pf=1,qf,qmin,qmax,pl,minadd;
pl=UnitLevel("player");
if(pl<10) then
minadd = 10;
elseif(pl<40) then
minadd = 5;
else
minadd = 3;
end
if (UnitFactionGroup("player")=="Horde") then
pf=2;
end
local index=1;
while BaseQuestDB[index] do
_,_,qmin,qmax,qf = string.find(BaseQuestDB[index].q,"[^`]*`[^`]*`(%d*)`(%d*)`(%d*)`.*");
qmin = tonumber(qmin);
qmax = tonumber(qmax);
qf = tonumber(qf);
--if (qf==pf) then
if (qf==pf or qmin-minadd>pl) then
table.remove(BaseQuestDB,index);
else
index = index + 1;
end
end
gLimQuestionDelete:Hide();
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -