📄 monkeyquest.lua
字号:
colour.g = colourMid.g + (((iNumItems - (iNumNeeded / 2)) / (iNumNeeded / 2)) * colourDelta2.g);
colour.b = colourMid.b + (((iNumItems - (iNumNeeded / 2)) / (iNumNeeded / 2)) * colourDelta2.b);
end
else
-- it's a quest with no numerical objectives
local i, j, strItemName, strItems, strNeeded = string.find(strText, "(.*):%s*([-%a]+)%s*/%s*([-%a]+)%s*$");
-- is it a string/string type?
if (strItems ~= nil) then
if (strItems == strNeeded) then
-- strings are equal, completed objective
return MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strCompleteObjectiveColour;
else
-- strings are not equal, uncompleted objective
return MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strInitialObjectiveColour;
end
else
-- special objective
return MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strSpecialObjectiveColour;
end
end
-- just incase the numbers went slightly out of range
if (colour.r > 1.0) then
colour.r = 1.0;
end
if (colour.g > 1.0) then
colour.g = 1.0;
end
if (colour.b > 1.0) then
colour.b = 1.0;
end
if (colour.r < 0.0) then
colour.r = 0.0;
end
if (colour.g < 0.0) then
colour.g = 0.0;
end
if (colour.b < 0.0) then
colour.b = 0.0;
end
return colour.a, colour.r, colour.g, colour.b;
end
-- when the mouse goes over the main frame, this gets called
function MonkeyQuestTitle_OnEnter()
-- noob tip?
if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowNoobTips == true) then
-- put the tool tip in the specified position
if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor == "DEFAULT") then
GameTooltip_SetDefaultAnchor(GameTooltip, this);
else
GameTooltip:SetOwner(MonkeyQuestFrame, MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor);
end
-- set the tool tip text
GameTooltip:SetText(MONKEYQUEST_NOOBTIP_HEADER, TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 1);
GameTooltip:AddLine(MONKEYQUEST_NOOBTIP_TITLE, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1);
GameTooltip:Show();
return;
end
-- put the tool tip in the default position
GameTooltip_SetDefaultAnchor(GameTooltip, this);
-- set the tool tip text
GameTooltip:SetText(MONKEYQUEST_TITLE_VERSION, MONKEYLIB_TITLE_COLOUR.r, MONKEYLIB_TITLE_COLOUR.g, MONKEYLIB_TITLE_COLOUR.b, 1);
GameTooltip:AddLine(MONKEYQUEST_DESCRIPTION, GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b, 1);
GameTooltip:Show();
end
function MonkeyQuestButton_OnLoad()
this:RegisterForClicks("LeftButtonUp", "RightButtonUp");
end
function MonkeyQuestButton_OnClick(button)
local strQuestLogTitleText, strQuestLevel, strQuestTag, isHeader, isCollapsed, isComplete = GetQuestLogTitle(this.m_iQuestIndex);
if (isHeader) then
MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_aQuestList[getglobal("MonkeyQuestHideButton" .. this.id).m_strQuestLogTitleText].m_bChecked =
not MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_aQuestList[getglobal("MonkeyQuestHideButton" .. this.id).m_strQuestLogTitleText].m_bChecked;
MonkeyQuest_Refresh();
return;
end
-- print text to the chat edit frame if shift is down and the
-- chat frame edit box is open and it's not a zone header
if (IsShiftKeyDown() and ChatFrameEditBox:IsVisible()) then
-- what button was it?
if (button == "LeftButton") then
if (strQuestTag == ELITE) then
ChatFrameEditBox:Insert("[" .. strQuestLevel .. "+] " .. strQuestLogTitleText .. " ");
elseif (strQuestTag == MONKEYQUEST_DUNGEON) then
ChatFrameEditBox:Insert("[" .. strQuestLevel .. "d] " .. strQuestLogTitleText .. " ");
elseif (strQuestTag == RAID) then
ChatFrameEditBox:Insert("[" .. strQuestLevel .. "r] " .. strQuestLogTitleText .. " ");
elseif (strQuestTag == MONKEYQUEST_PVP) then
ChatFrameEditBox:Insert("[" .. strQuestLevel .. "p] " .. strQuestLogTitleText .. " ");
else
ChatFrameEditBox:Insert("[" .. strQuestLevel .. "] " .. strQuestLogTitleText .. " ");
end
else
local strChatObjectives = "";
-- Remember the currently selected quest log entry
local tmpQuestLogSelection = GetQuestLogSelection();
-- Select the quest log entry for other functions like GetNumQuestLeaderBoards()
SelectQuestLogEntry(this.m_iQuestIndex);
if (GetNumQuestLeaderBoards() > 0) then
for i=1, GetNumQuestLeaderBoards(), 1 do
--local string = getglobal("QuestLogObjective"..ii);
local strLeaderBoardText, strType, iFinished = GetQuestLogLeaderBoard(i);
if (strLeaderBoardText) then
strChatObjectives = strChatObjectives .. "{" .. strLeaderBoardText .. "} ";
end
end
elseif (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bObjectives) then
-- this quest has no leaderboard so display the objective instead if the config is set
local strQuestDescription, strQuestObjectives = GetQuestLogQuestText();
strChatObjectives = strChatObjectives .. "{" .. strQuestObjectives .. "} ";
end
ChatFrameEditBox:Insert(strChatObjectives);
-- Restore the currently selected quest log entry
SelectQuestLogEntry(tmpQuestLogSelection);
end
-- the user isn't trying to actually open the real quest log, so just exit here
return;
end
if (IsControlKeyDown()) then
-- what button was it?
if (button == "LeftButton") then
-- Select the quest log entry for other functions like GetNumQuestLeaderBoards()
SelectQuestLogEntry(this.m_iQuestIndex);
-- try and share this quest with party members
if (GetQuestLogPushable() and GetNumPartyMembers() > 0) then
QuestLogPushQuest();
end
else
-- Remember the currently selected quest log entry
--local tmpQuestLogSelection = GetQuestLogSelection();
-- Select the quest log entry for other functions like GetNumQuestLeaderBoards()
SelectQuestLogEntry(this.m_iQuestIndex);
SetAbandonQuest();
StaticPopup_Show("ABANDON_QUEST", GetAbandonQuestName());
-- Restore the currently selected quest log entry
--SelectQuestLogEntry(tmpQuestLogSelection);
end
-- the user isn't trying to actually open the real quest log, so just exit here
return;
end
-- show the real questlog
ShowUIPanel(QuestLogFrame);
-- check if there's even a need to mess with the offset
if (MonkeyQuest.m_iNumEntries > QUESTS_DISPLAYED) then
-- move the real quest log list scrollbar to the correct place
if (this.m_iQuestIndex < MonkeyQuest.m_iNumEntries - QUESTS_DISPLAYED) then
FauxScrollFrame_SetOffset(QuestLogListScrollFrame, this.m_iQuestIndex - 1);
QuestLogListScrollFrameScrollBar:SetValue((this.m_iQuestIndex - 1) * QUESTLOG_QUEST_HEIGHT);
else
FauxScrollFrame_SetOffset(QuestLogListScrollFrame, MonkeyQuest.m_iNumEntries - QUESTS_DISPLAYED);
QuestLogListScrollFrameScrollBar:SetValue((MonkeyQuest.m_iNumEntries - QUESTS_DISPLAYED) * QUESTLOG_QUEST_HEIGHT);
end
end
-- actually select the quest entry
SelectQuestLogEntry(this.m_iQuestIndex);
QuestLog_SetSelection(this.m_iQuestIndex);
-- update the real quest log
QuestLog_Update();
end
function MonkeyQuestButton_OnEnter()
if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor == "NONE") then
return;
end
local strQuestLogTitleText, strQuestLevel, strQuestTag, isHeader, isCollapsed, isComplete = GetQuestLogTitle(this.m_iQuestIndex);
if (isHeader) then
-- no noob tip?
if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowNoobTips == false) then
return;
end
-- put the tool tip in the specified position
if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor == "DEFAULT") then
GameTooltip_SetDefaultAnchor(GameTooltip, this);
else
GameTooltip:SetOwner(MonkeyQuestFrame, MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor);
end
-- set the tool tip text
GameTooltip:SetText(MONKEYQUEST_NOOBTIP_HEADER, TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 1);
GameTooltip:AddLine(MONKEYQUEST_NOOBTIP_QUESTHEADER, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1);
GameTooltip:Show();
return;
end
-- put the tool tip in the specified position
if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor == "DEFAULT") then
GameTooltip_SetDefaultAnchor(GameTooltip, this);
else
GameTooltip:SetOwner(MonkeyQuestFrame, MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor);
end
-- set the tool tip text
GameTooltip:SetText(strQuestLogTitleText, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1);
GameTooltip:AddLine(this.m_strQuestObjectives, GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b, 1);
GameTooltip:AddLine(strQuestTag, TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 1);
-- see if any nearby group mates are on this quest
local iNumPartyMembers = GetNumPartyMembers();
local isOnQuest, i;
for i = 1, iNumPartyMembers do
isOnQuest = IsUnitOnQuest(this.m_iQuestIndex, "party" .. i);
if (isOnQuest and isOnQuest == 1) then
-- this member is on the quest
GameTooltip:AddLine(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strCompleteObjectiveColour .. UnitName("party" .. i));
else
-- this member isn't on the quest
GameTooltip:AddLine(MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strInitialObjectiveColour .. UnitName("party" .. i));
end
end
GameTooltip:Show();
end
function MonkeyQuestHideButton_OnLoad()
end
function MonkeyQuestHideButton_OnEnter()
-- no noob tip?
if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_bShowNoobTips == false) then
return;
end
-- put the tool tip in the specified position
if (MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor == "DEFAULT") then
GameTooltip_SetDefaultAnchor(GameTooltip, this);
else
GameTooltip:SetOwner(MonkeyQuestFrame, MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_strAnchor);
end
-- set the tool tip text
GameTooltip:SetText(MONKEYQUEST_NOOBTIP_HEADER, TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 1);
GameTooltip:AddLine(MONKEYQUEST_NOOBTIP_HIDEBUTTON, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1);
GameTooltip:Show();
end
function MonkeyQuestHideButton_OnClick()
-- if not loaded yet then get out
if (MonkeyQuest.m_bLoaded == false) then
return;
end
if (this:GetChecked()) then
PlaySound("igMainMenuOptionCheckBoxOff");
MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_aQuestList[this.m_strQuestLogTitleText].m_bChecked = true;
else
PlaySound("igMainMenuOptionCheckBoxOn");
MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_aQuestList[this.m_strQuestLogTitleText].m_bChecked = false;
end
MonkeyQuest_Refresh();
end
function MonkeyQuest_PrintPoints()
if (DEFAULT_CHAT_FRAME) then
DEFAULT_CHAT_FRAME:AddMessage("Left: "..MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameLeft);
DEFAULT_CHAT_FRAME:AddMessage("Top: "..MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameTop);
DEFAULT_CHAT_FRAME:AddMessage("Bottom: "..MonkeyQuestConfig[MonkeyQuest.m_strPlayer].m_iFrameBottom);
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -