Guest User

TomTom World Quest POI hack

a guest
Jan 1st, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.97 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, f = GetCurrentMapAreaID()
  23.  
  24.     QuestPOIUpdateIcons()
  25.  
  26.     local questIndex = GetQuestLogIndexByID(self.questID)
  27.     local title, completed, x, y
  28.    
  29.     if questIndex and questIndex ~= 0 then
  30.         title = GetQuestLogTitle(questIndex)
  31.         completed, x, y = QuestPOIGetIconInfo(self.questID)
  32.     else
  33.         title = C_TaskQuest.GetQuestInfoByQuestID(self.questID)
  34.         completed = false
  35.         x, y = C_TaskQuest.GetQuestLocation(self.questID)
  36.     end
  37.  
  38.     if completed then
  39.         title = "Turn in: " .. title
  40.     end
  41.  
  42.     if not x or not y then
  43.         local header = "|cFF33FF99TomTom|r"
  44.         print(L["%s: No coordinate information found for '%s' at this map level"]:format(header, title or self.questID))
  45.         return
  46.     end
  47.  
  48.     local key = TomTom:GetKeyArgs(m, f, x, y, title)
  49.  
  50.     local alreadySet = false
  51.     if poiclickwaypoints[key] then
  52.         local uid = poiclickwaypoints[key]
  53.         -- Check to see if it has been removed by the user
  54.         if TomTom:IsValidWaypoint(uid) then
  55.             alreadySet = true
  56.         end
  57.     end
  58.  
  59.     if not alreadySet then
  60.         local uid = TomTom:AddMFWaypoint(m, f, x, y, {
  61.             title = title,
  62.             arrivaldistance = TomTom.profile.poi.arrival,
  63.         })
  64.         poiclickwaypoints[key] = uid
  65.     else
  66.         local uid = poiclickwaypoints[key]
  67.         TomTom:SetCrazyArrow(uid, TomTom.profile.poi.arrival, title)
  68.     end
  69.  
  70.     SetCVar("questPOI", cvar and 1 or 0)
  71. end
Add Comment
Please, Sign In to add comment