Questie

Questie

116M Downloads

Would like to have the ability to link quests from map into chat via Shift+Lclick.

Cabro opened this issue ยท 9 comments

commented

Currently you can hide available quests from Map with Shift+Lclick and Shift+Rclick.

I would like to have the functionality to just link into chat (when editbox is active) a quest from map by using Shift+Lclick.

Thank you!

commented

Shift + Left Click is already assigned to the function of hiding that map icon via a yes/no popup. I'm sure you could add the functionality yourself and then make a PR. :)

if (not ChatFrame1EditBox:IsVisible()) then
        %hide map icon%
else
        if Questie.db.global.trackerShowQuestLevel then
                ChatEdit_InsertLink(QuestieLink:GetQuestLinkString(quest.level, quest.name, quest.Id))
        else
                ChatEdit_InsertLink("[" .. quest.name .. " (" .. quest.Id .. ")]")
        end
end
commented

I'm afraid this is beyond my ability, i need a way to extract quest info from Questie map icons, but i got this going for me, which is nice:

        if (not ChatEdit_GetActiveWindow()) then
            if self.data.Type == "available" and IsShiftKeyDown() then
                StaticPopupDialogs["QUESTIE_CONFIRMHIDE"]:SetQuest(self.data.QuestData.Id)
                StaticPopup_Show ("QUESTIE_CONFIRMHIDE")
            elseif self.data.Type == "manual" and IsShiftKeyDown() and not self.data.ManualTooltipData.disableShiftToRemove then
                QuestieMap:UnloadManualFrames(self.data.id)
            end
        else
            if IsShiftKeyDown() and button == "LeftButton" then
                if Questie.db.global.trackerShowQuestLevel then
                    ChatEdit_InsertLink(QuestieLink:GetQuestLinkString(quest.level, quest.name, quest.Id))
                else
                    ChatEdit_InsertLink("[" .. quest.name .. " (" .. quest.Id .. ")]")
                end
            end
        end

LE: nvm i figured it out

        if (not ChatEdit_GetActiveWindow()) then
            if self.data.Type == "available" and IsShiftKeyDown() then
                StaticPopupDialogs["QUESTIE_CONFIRMHIDE"]:SetQuest(self.data.QuestData.Id)
                StaticPopup_Show ("QUESTIE_CONFIRMHIDE")
            elseif self.data.Type == "manual" and IsShiftKeyDown() and not self.data.ManualTooltipData.disableShiftToRemove then
                QuestieMap:UnloadManualFrames(self.data.id)
            end
        else
            if IsShiftKeyDown() and button == "LeftButton" then
                if Questie.db.global.trackerShowQuestLevel then
                    ChatEdit_InsertLink(QuestieLink:GetQuestLinkString(self.data.QuestData.level, self.data.QuestData.name, self.data.QuestData.Id))
                else
                    ChatEdit_InsertLink("[" .. self.data.QuestData.name .. " (" .. self.data.QuestData.Id .. ")]")
                end
            end
        end
commented

This assumes that self.data.Type is always "available"... it might nil out on you if self.data.Type is "manual" ;)

Check the code before if (not ChatEdit_GetActiveWindow()) then and see how self.data.Type is being set or used.

commented

Can you manually make quests show on map?

commented

You'll have to be a bit more specific... can you give me a test/use case summary?

commented

OK, I see... yeah... sooo... it doesn't really matter which data.Type is being passed because the entire quest table is being passed and stored in the QuestData key. Everything you need is in there to shift click ANY icon type into chat that has a valid QuestId.

I found a bug in this function and fixed it. I also updated the comments and added some additional logic. You can just copy paste and replace it in QuestFrame.lua. Don't forget to add the import module for "QuestieLink" at the top of QuestFrame.lua. :D

---@type QuestieLink
local QuestieLink = QuestieLoader:ImportModule("QuestieLink")
function _Qframe:OnClick(button)
    if self and self.UiMapID and WorldMapFrame and WorldMapFrame:IsShown() then
        -- We don't want to zoom out if we're not over the WorldMap Frame
        if button == "RightButton" and GetMouseFocus():GetParent() == WorldMapFrame then
            local currentMapParent = WorldMapFrame:GetMapID()
            if currentMapParent then
                local mapInfo = C_Map.GetMapInfo(currentMapParent)
                currentMapParent = mapInfo.parentMapID

                if currentMapParent and currentMapParent > 0 then
                    WorldMapFrame:SetMapID(currentMapParent)
                end
            end
        else
            if self.UiMapID ~= WorldMapFrame:GetMapID() then
                WorldMapFrame:SetMapID(self.UiMapID);
            end
        end
    end

    -- This will work in either the WorldMapFrame or the MiniMapFrame as long as there is an icon
    if self and self.UiMapID and button == "LeftButton" then
        if (not ChatEdit_GetActiveWindow()) then
            if self.data.Type == "available" and IsShiftKeyDown() then
                StaticPopupDialogs["QUESTIE_CONFIRMHIDE"]:SetQuest(self.data.QuestData.Id)
                StaticPopup_Show("QUESTIE_CONFIRMHIDE")
            elseif self.data.Type == "manual" and IsShiftKeyDown() and not self.data.ManualTooltipData.disableShiftToRemove then
                QuestieMap:UnloadManualFrames(self.data.id)
            end
        else
            if Questie.db.global.trackerShowQuestLevel then
                ChatEdit_InsertLink(QuestieLink:GetQuestLinkString(self.data.QuestData.level, self.data.QuestData.name, self.data.QuestData.Id))
            else
                ChatEdit_InsertLink("[" .. self.data.QuestData.name .. " (" .. self.data.QuestData.Id .. ")]")
            end
        end
    end

    -- TomTom integration
    if self and self.UiMapID and IsControlKeyDown() and TomTom and TomTom.AddWaypoint then
        local m = self.UiMapID
        local x = self.x / 100
        local y = self.y / 100
        local title = self.data.Name
        local add = true

        -- Remove old waypoint if set
        if Questie.db.char._tom_waypoint and TomTom.RemoveWaypoint then
            local waypoint = Questie.db.char._tom_waypoint
            TomTom:RemoveWaypoint(waypoint)
            add = (waypoint[1] ~= m or waypoint[2] ~= x or waypoint[3] ~= y or waypoint.title ~= title or waypoint.from ~= "Questie")
        end

        -- Add waypoint
        Questie.db.char._tom_waypoint = add and TomTom:AddWaypoint(m, x, y, { title = title, crazy = true, from = "Questie" })
    end

    -- Make sure we don't break the map ping feature - this allows us to ping our own icons.
    if self.miniMapIcon and button == "RightButton" and not IsModifierKeyDown() then
        local _, _, _, x, y = self:GetPoint()
        Minimap:PingLocation(x, y)
    end
end
commented

I'm assuming the "available" and "manual" cases are for whether the quests are available or manually added? I don't know exactly what those conditions are for

commented

I don't know how to add a single commit to a PR, but here's nothing: d5c05b8
All the hard work of Dyaxler!

commented

It was your idea bro... :) Besides I hope you learned something new...