Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
4.3 kB
8
Indexable
Never
-- Tooltip when mouse over quest name
function qcUpdateTooltip(index)
	local stringFormat = string.format
	local questId = _G["qcMenuButton" .. index].QuestID

if not (questId == nil) then
    qcQuestInformationTooltip:SetOwner(qcQuestCompletistUI, "ANCHOR_BOTTOMRIGHT", -30, 500)
    qcQuestInformationTooltip:ClearLines()
    qcQuestInformationTooltip:SetHyperlink(string.format("quest:%d", questId))
    qcQuestInformationTooltip:AddLine(" ")
    qcQuestInformationTooltip:AddLine(" ")
    --qcQuestInformationTooltip:AddDoubleLine("Quest ID:", string.format("|cFF69CCF0%d|r", questId))
    qcQuestInformationTooltip:AddLine(" ")
    local prereqQuestName = qcQuestDatabase[questId][13] or "No known prequest"
    qcQuestInformationTooltip:AddDoubleLine("Prerequired Completed Quest/Quests:", string.format("%s [%d]", prereqQuestName, questRequired))
    qcQuestInformationTooltip:AddLine(" ")

    if not (qcQuestDatabase[questId][14] == nil) then
        for qcInitiatorIndex, qcInitiatorEntry in pairs { qcQuestDatabase[questId][14] } do
            -- local qcInitiatorID = qcInitiatorEntry[1]
            -- local qcInitiatorName = qcInitiatorEntry[2]
            -- local qcInitiatorUiMapID = qcInitiatorEntry[3]
            -- local qcInitiatorMapLevel = qcInitiatorEntry[4]
            -- local qcInitiatorX = qcInitiatorEntry[5]
            -- local qcInitiatorY = qcInitiatorEntry[6]
            if not (qcInitiatorID == 0) then
                if not (qcInitiatorName == nil) then
                    qcQuestInformationTooltip:AddDoubleLine("Quest Giver:", string.format("%s%s [%d]", COLOUR_HUNTER, qcInitiatorName, qcInitiatorID))
                else
                    qcQuestInformationTooltip:AddDoubleLine("Quest Giver:", string.format("%s%s [%d]", COLOUR_HUNTER, "Self-provided Quest", qcInitiatorID))
                end
            else
                if not (qcInitiatorName == nil) then
                    qcQuestInformationTooltip:AddDoubleLine("Quest Giver:", string.format("%s%s", COLOUR_HUNTER, qcInitiatorName))
                else
                    qcQuestInformationTooltip:AddDoubleLine("Quest Giver:", string.format("%s%s", COLOUR_HUNTER, "Self-provided Quest"))
                end
            end
            if not (qcInitiatorMapLevel == 0) then
                -- qcQuestInformationTooltip:AddDoubleLine("  - Location:", string.format("%s%s, Floor %d @ %.1f,%.1f",COLOUR_HUNTER,tostring(GetMapNameByID(qcInitiatorUiMapID) or nil),qcInitiatorMapLevel,qcInitiatorX,qcInitiatorY),nil,nil,nil,true)
            else
                qcQuestInformationTooltip:AddDoubleLine("  - Location:", string.format("%s%s @ %.1f,%.1f", COLOUR_HUNTER, tostring(GetMapNameByID(qcInitiatorUiMapID) or nil), qcInitiatorX, qcInitiatorY), nil, nil, nil, true)
            end
        end
    end

    -- Modification to include faction information from qcFactions table based on value in [15]
    local factionValue = qcQuestDatabase[questId][15]

    if not (factionValue == nil) then
        local factionName = qcFactions[factionValue]
        if not (factionName == nil) then
            qcQuestInformationTooltip:AddDoubleLine("Faction:", string.format("%s%s", COLOUR_DRUID, factionName))
        end
    end

    qcQuestInformationTooltip:Show()
    qcQuestReputationTooltip:SetOwner(qcQuestInformationTooltip, "ANCHOR_BOTTOMRIGHT", -qcQuestInformationTooltip:GetWidth())
    qcQuestReputationTooltip:ClearLines()

    if not (qcQuestDatabase[questId][12] == nil) then
        qcReputationCount = 0
        qcQuestReputationTooltip:AddLine(GetText("COMBAT_TEXT_SHOW_REPUTATION_TEXT"))
        qcQuestReputationTooltip:AddLine(" ")

        for qcReputationIndex, qcReputationEntry in pairs { qcQuestDatabase[questId][12] } do
            qcReputationCount = (qcReputationCount + 1)
            qcQuestReputationTooltip:AddDoubleLine(tostring(qcFactions[qcReputationIndex] or qcReputationIndex), stringFormat("%s%d rep", COLOUR_DRUID, qcReputationEntry))
        end

        if (qcReputationCount > 0) then
            qcQuestReputationTooltip:Show()
        else
            qcQuestReputationTooltip:Hide()
        end
    end

else
    qcQuestReputationTooltip:Hide()
end

end
Leave a Comment