glimquestion.lua
字号:
end
tltip = tltip.." <"..v.x..","..v.y..">";
poscount = poscount+1;
end
npcentry.tooltip = tltip;
npcentry.value = {t=objtext,a=z,n=nd.n,pos=nd.pos};
table.insert(areaentry.children,npcentry);
end
table.insert(eTree,areaentry);
end
return eTree;
end
return nil;
end
function gLimQuestion_QHObjectButton_OnClick(button,id)
if (gLimQuestion_QuestData and gLimQuestion_QuestData.os and gLimQuestion_QuestData.os[id] and gLimQuestion_QuestData.os[id].npc) then
local ETree = gLimQuestion_GenEarthTreeTable(id);
if (ETree) then
QuestHistoryDetailScrollFrame:Hide();
QuestHistoryDetailPreviousButton:Hide();
QuestHistoryDetailFrameNextButton:Hide();
EarthTree_LoadEnhanced(gLimQuestionQHNPCTree,ETree);
EarthTree_UpdateFrame(gLimQuestionQHNPCTree);
gLimQuestionQHNPCFrame:Show();
end
end
end
function gLimQuestion_QLObjectButton_OnClick(button,id)
if (gLimQuestion_QuestData and gLimQuestion_QuestData.os and gLimQuestion_QuestData.os[id] and gLimQuestion_QuestData.os[id].npc) then
local ETree = gLimQuestion_GenEarthTreeTable(id);
if (ETree) then
QuestLogDetailScrollFrame:Hide();
QuestLogFrameAbandonButton:Hide();
QuestFramePushQuestButton:Hide();
EarthTree_LoadEnhanced(gLimQuestionQLNPCTree,ETree);
EarthTree_UpdateFrame(gLimQuestionQLNPCTree);
gLimQuestionQLNPCFrame:Show();
end
end
end
function gLimQuestion_WorldMapDeleteButton_OnClick()
local zone = MapNotes_ZoneShift[GetCurrentMapContinent()][GetCurrentMapZone()];
local continent = GetCurrentMapContinent();
gLimQuestion_DeleteMapNotes(continent,zone);
end
function gLimQuestion_QH_SendToMapNotes(button, locationType)
if (gLimQuestion_QuestData) then
local title;
local info1,info2 = "","";
local icon;
local p;
local zone;
if ( locationType == "a" ) then
title = gLimQuestion_QuestData.t;
info1 = "接受任务";
info2 = gLimQuestion_QuestData.g;
p = gLimQuestion_QuestData.pa;
zone = gLimQuestion_QuestData.az;
icon = 2;
else
title = gLimQuestion_QuestData.t;
info1 = "完成任务";
info2 = gLimQuestion_QuestData.w;
p = gLimQuestion_QuestData.pc;
zone = gLimQuestion_QuestData.cz;
icon = 3;
end
if ( MapNotes_Data and MapNotes_ZoneNames and p and p[1] and not IsShiftKeyDown()) then
local continent, zone1 = gLimQuestion_MapNotes_GetZone(zone);
gLimQuestion_DeleteMapNotes(continent, zone1);
end
local text = "["..title.."]"..info1..": "..info2.." 位于 "..zone;
local MapNoteError = 0;
for k,v in p do
text = text.." <"..v.x..","..v.y..">";
if (not (IsShiftKeyDown() and ChatFrameEditBox:IsVisible()) and MapNoteError<2) then
MapNoteError = gLimQuestion_Make_MapNote(zone,title,0,info1,4,info2,8,icon,v.x,v.y);
if (MapNoteError==2) then
Sea.io.print("|cff00ffff区域 "..zone.." 中的地图标记过多,请删除部分。|r");
end
end
end
if ( IsShiftKeyDown() ) then
if ( ChatFrameEditBox:IsVisible() ) then
ChatFrameEditBox:Insert(text);
end
elseif ( MapNotes_Data and MapNotes_ZoneNames and p and p[1]) then
local continent, zone1 = gLimQuestion_MapNotes_GetZone(zone);
ToggleWorldMap();
SetMapZoom(continent, zone1);
end
end
end
local function gLimQuestion_QuestACTree_OnClick(value)
if (not value or not gLimQuestion_QuestData) then
return;
end
gLimQuestion_QH_SendToMapNotes("LeftButton",value.l);
end
function gLimQuestion_QLACQueryButton_OnClick()
if (gLimQuestion_QuestData and (gLimQuestion_QuestData.az or gLimQuestion_QuestData.cz)) then
local ETree = {};
if (gLimQuestion_QuestData.az) then
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
local ctitle = gLimQuestion_QuestData.az;
if (gLimQuestion_QuestData.pa and gLimQuestion_QuestData.pa[1]) then
ctitle = ctitle.." ("..gLimQuestion_QuestData.pa[1].x..", "..gLimQuestion_QuestData.pa[1].y..")";
end
local entry = {
title = "接受任务地点",
children = {
{
title = ctitle,
titleColor={r=1,g=1,b=0},
tooltip = tltip,
right = gLimQuestion_QuestData.g,
rightColor={r=0,g=1,b=0},
onClick = gLimQuestion_QuestACTree_OnClick,
value = {l="a"},
}
},
};
table.insert(ETree,entry);
end
if (gLimQuestion_QuestData.cz) then
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
local ctitle = gLimQuestion_QuestData.cz;
if (gLimQuestion_QuestData.pc and gLimQuestion_QuestData.pc[1]) then
ctitle = ctitle.." ("..gLimQuestion_QuestData.pc[1].x..", "..gLimQuestion_QuestData.pc[1].y..")";
end
local entry = {
title = "完成任务地点",
children = {
{
title = ctitle,
titleColor={r=1,g=1,b=0},
tooltip = tltip,
right = gLimQuestion_QuestData.w,
rightColor={r=0,g=1,b=0},
onClick = gLimQuestion_QuestACTree_OnClick,
value = {l="c"},
}
},
};
table.insert(ETree,entry);
end
QuestLogDetailScrollFrame:Hide();
QuestLogFrameAbandonButton:Hide();
QuestFramePushQuestButton:Hide();
EarthTree_LoadEnhanced(gLimQuestionQLNPCTree,ETree);
EarthTree_UpdateFrame(gLimQuestionQLNPCTree);
gLimQuestionQLNPCFrame:Show();
end
end
local function gLimQuestion_Quest_MatchesSearch(value,searchText)
searchText = strupper(searchText);
if (not searchText or searchText=="") then
return true;
end
local _,_,qf = string.find(value.q,"[^`]*`[^`]*`%d*`%d*`(%d*)`.*");
local playerfaction=UnitFactionGroup("player");
if (playerfaction=="Horde") then
playerfaction = "1";
else
playerfaction = "2";
end
if (qf~="3" and qf~=playerfaction) then
return false;
end
if (value.q and string.find(strupper(value.q), searchText) ) then
return true;
end
if (value.pa and string.find(strupper(value.pa), searchText) ) then
return true;
end
if (value.pc and string.find(strupper(value.pc), searchText) ) then
return true;
end
if (value.os) then
for i,o in value.os do
if (o.n) then
for npccode in string.gfind(o.n,"(%d+)") do
npccode = tonumber(npccode);
if (BaseNpcDB[npccode]) then
if (BaseNpcDB[npccode].n and string.find(strupper(BaseNpcDB[npccode].n),searchText)) then
return true;
end
if (BaseNpcDB[npccode].x) then
for k,v in BaseNpcDB[npccode].x do
if (string.find(strupper(v),searchText)) then
return true;
end
end
end
end
end
end
end
end
return false;
end
function gLimQuestion_QH_BuildSortedTable()
local searchText = QuestHistory_GetSearchText();
if ( not searchText ) then
return true;
end
-- Initialize blank table
SortedTable = { };
-- Populate table with quest IDs that match current criteria
for index, value in BaseQuestDB do
if ( gLimQuestion_Quest_MatchesSearch(value, searchText) ) then
table.insert(SortedTable,index);
end
end
local DisplayedRealmName,DisplayedPlayerCharacterName = QuestHistory_GetQuestIndexString();
for k,index in SortedTable do
BaseQuestDB[index].qh = nil;
local _,_,qt,ql,qo = string.find(BaseQuestDB[index].q,"[^`]*`([^`]*)`%d*`(%d*)`%d*`(.*)");
ql = tonumber(ql);
for i,v in QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName] do
if (qt==v.t and ql==v.l and qo==v.o) then
BaseQuestDB[index].qh = i;
break;
end
end
end
sizeSortedTable = table.getn(SortedTable);
QuestHistory_SetSortedTable(SortedTable);
return false;
end
function gLimQuestion_QH_SortComparison(index1, index2)
if ( not QuestHistory_GetSearchText() ) then
return orgQuestHistory_SortComparison(index1, index2);
-- return true;
end
local currentSortType,currentSortOrder = QuestHistory_GetCurrentSortOption();
local DisplayedRealmName,DisplayedPlayerCharacterName = QuestHistory_GetQuestIndexString();
if ( currentSortType ~= "accepted" ) then
-- Get the sort values that are to be compared
local sort1,sort2;
local _,_,qc1,qt1,ql1,qo1 = string.find(BaseQuestDB[index1].q,"([^`]*)`([^`]*)`%d*`(%d*)`%d*`(.*)");
local _,_,qc2,qt2,ql2,qo2 = string.find(BaseQuestDB[index2].q,"([^`]*)`([^`]*)`%d*`(%d*)`%d*`(.*)");
ql1,ql2 = tonumber(ql1),tonumber(ql2);
if (currentSortType=="t") then
sort1 = qt1;
sort2 = qt2;
elseif (currentSortType=="l") then
sort1 = ql1;
sort2 = ql2;
elseif (currentSortType=="c") then
sort1 = qc1;
sort2 = qc2;
elseif (currentSortType=="g") then
if (BaseQuestDB[index1].pa) then
_,_,sort1 = string.find(BaseQuestDB[index1].pa,"([^`]*)`[^`]*`.*");
end
if (BaseQuestDB[index2].pa) then
_,_,sort2 = string.find(BaseQuestDB[index2].pa,"([^`]*)`[^`]*`.*");
end
elseif (currentSortType=="w") then
if (BaseQuestDB[index1].pc) then
_,_,sort1 = string.find(BaseQuestDB[index1].pc,"([^`]*)`[^`]*`.*");
end
if (BaseQuestDB[index2].pc) then
_,_,sort2 = string.find(BaseQuestDB[index2].pc,"([^`]*)`[^`]*`.*");
end
else
if (BaseQuestDB[index1].qh) then
sort1 = QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][BaseQuestDB[index1].qh][currentSortType];
end
if (BaseQuestDB[index2].qh) then
sort2 = QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][BaseQuestDB[index2].qh][currentSortType];
end
end
if ( currentSortOrder == "dec" ) then
-- Swap sort values if sorting in decremented order
sort1, sort2 = sort2, sort1;
end
-- Make sure sort1 is not nil and is compatible with sort2
if ( sort1 == nil ) then
if ( type(sort2) == "string" ) then
sort1 = "";
else
sort1 = 0;
end
end
-- Make sure sort2 is not nil and is compatible with sort1
if ( sort2 == nil ) then
if ( type(sort1) == "string" ) then
sort2 = "";
else
sort2 = 0;
end
end
-- If sorting by completed order, make sure incomplete quests are valued more than completed quests
-- and that current quests are valued more than abandoned quests
if ( currentSortType == "co" ) then
if ( sort1 ~= sort2 ) then
if ( sort1 == 0 ) then
sort1 = sort2 + 1;
elseif ( sort2 == 0 ) then
sort2 = sort1 + 1;
end
else
if ( BaseQuestDB[index1].qh and QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][BaseQuestDB[index1].qh].a ) then
sort1 = -1;
end
if ( BaseQuestDB[index2].qh and QuestHistory_List[DisplayedRealmName][DisplayedPlayerCharacterName][BaseQuestDB[index2].qh].a ) then
sort2 = -1;
end
end
end
-- If sort1 is different from sort2, return comparison of sort values
if ( sort1 ~= sort2 ) then
-- return false,sort1 < sort2;
return sort1 < sort2;
end
else
if ( currentSortOrder == "dec" ) then
-- Swap index values if sorting in decremented order
index1, index2 = index2, index1;
end
end
-- Return comparison of index values
-- return false,index1 < index2;
return index1 < index2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -