Quantcast

Add a fix for poi_OnClick

Jim Whitehead [08-11-16 - 17:24]
Add a fix for poi_OnClick

Thanks to Jackalo for providing the fix!
Filename
TomTom_POIIntegration.lua
diff --git a/TomTom_POIIntegration.lua b/TomTom_POIIntegration.lua
index 5221079..1f6d0a5 100755
--- a/TomTom_POIIntegration.lua
+++ b/TomTom_POIIntegration.lua
@@ -148,7 +148,7 @@ local function poi_OnClick(self, button)
         return
     end

-    if button == "RightButton" then
+    if button == "LeftButton" then
         for i = 1, #modifier do
             local mod = modifier:sub(i, i)
             local func = modTbl[mod]
@@ -160,6 +160,9 @@ local function poi_OnClick(self, button)
         return
     end

+    local cvar = GetCVarBool("questPOI")
+    SetCVar("questPOI", 1)
+
     -- Run our logic, and set a waypoint for this button
     local m, f = GetCurrentMapAreaID()

@@ -178,6 +181,8 @@ local function poi_OnClick(self, button)
         questIndex = GetQuestIndexForWatch(self.index)
     end

+    QuestPOIUpdateIcons()
+
     local title = GetQuestLogTitle(questIndex)
     local qid = getQIDFromIndex(questIndex)
     local completed, x, y, objective = QuestPOIGetIconInfo(qid)
@@ -209,9 +214,22 @@ local function poi_OnClick(self, button)
             arrivaldistance = TomTom.profile.poi.arrival,
         })
         poiclickwaypoints[key] = uid
+    else
+        local uid = poiclickwaypoints[key]
+        TomTom:SetCrazyArrow(uid, TomTom.profile.poi.arrival, title)
     end
+
+    SetCVar("questPOI", cvar and 1 or 0)
 end

+hooksecurefunc("TaskPOI_OnClick", function(self, button)
+    poi_OnClick(self, button)
+end)
+
+hooksecurefunc("QuestPOIButton_OnClick", function(self, button)
+    poi_OnClick(self, button)
+end)
+
 function TomTom:EnableDisablePOIIntegration()
     enableClicks= TomTom.profile.poi.enable
     modifier = TomTom.profile.poi.modifier