Advertisement
Guest User

Untitled

a guest
Jan 5th, 2017
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.39 KB | None | 0 0
  1. local function poi_OnClick(self, button)
  2.     if not enableClicks then
  3.         return
  4.     end
  5.  
  6.     if button == "LeftButton" then
  7.         for i = 1, #modifier do
  8.             local mod = modifier:sub(i, i)
  9.             local func = modTbl[mod]
  10.             if not func() then
  11.                 return
  12.             end
  13.         end
  14.     else
  15.         return
  16.     end
  17.  
  18.     local cvar = GetCVarBool("questPOI")
  19.     SetCVar("questPOI", 1)
  20.  
  21.     -- Run our logic, and set a waypoint for this button
  22.     local m = GetCurrentMapAreaID()
  23.     local f = GetCurrentMapDungeonLevel()
  24.  
  25.     QuestPOIUpdateIcons()
  26.  
  27.     local questIndex = GetQuestLogIndexByID(self.questID)
  28.     local title, completed, x, y
  29.    
  30.     if questIndex and questIndex ~= 0 then
  31.         -- questIndex = GetQuestIndexForWatch(self.index)
  32.         title = GetQuestLogTitle(questIndex)
  33.         completed, x, y = QuestPOIGetIconInfo(self.questID)
  34.     else
  35.         -- Must be a World Quest
  36.         title = C_TaskQuest.GetQuestInfoByQuestID(self.questID)
  37.         completed = false
  38.         x, y = C_TaskQuest.GetQuestLocation(self.questID)
  39.         m = select(2, C_TaskQuest.GetQuestZoneID(self.questID))
  40.         for i, q in pairs(C_TaskQuest.GetQuestsForPlayerByMapID(m)) do
  41.             -- Attemp to find the floor for the world quest
  42.             if q.questID == questID then
  43.                 f = q.floor
  44.             end
  45.         end
  46.     end
  47.  
  48.     if completed then
  49.         title = "Turn in: " .. title
  50.     end
  51.  
  52.     if not x or not y then
  53.         local header = "|cFF33FF99TomTom|r"
  54.         print(L["%s: No coordinate information found for '%s' at this map level"]:format(header, title or self.questID))
  55.         return
  56.     end
  57.  
  58.     local key = TomTom:GetKeyArgs(m, f, x, y, title)
  59.  
  60.     local alreadySet = false
  61.     if poiclickwaypoints[key] then
  62.         local uid = poiclickwaypoints[key]
  63.         -- Check to see if it has been removed by the user
  64.         if TomTom:IsValidWaypoint(uid) then
  65.             alreadySet = true
  66.         end
  67.     end
  68.  
  69.     if not alreadySet then
  70.         local uid = TomTom:AddMFWaypoint(m, f, x, y, {
  71.             title = title,
  72.             arrivaldistance = TomTom.profile.poi.arrival,
  73.         })
  74.         poiclickwaypoints[key] = uid
  75.     else
  76.         local uid = poiclickwaypoints[key]
  77.         TomTom:SetCrazyArrow(uid, TomTom.profile.poi.arrival, title)
  78.     end
  79.  
  80.     SetCVar("questPOI", cvar and 1 or 0)
  81. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement