Advertisement
Guest User

Archy

a guest
Jul 27th, 2016
6
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.90 KB | None | 0 0
  1.     if not SECURE_ACTION_BUTTON then
  2.         local button_name = "Archy_SurveyButton"
  3.         local button = _G.CreateFrame("Button", button_name, _G.UIParent, "SecureActionButtonTemplate")
  4.         button:SetPoint("LEFT", _G.UIParent, "RIGHT", 10000, 0)
  5.         button:Hide()
  6.         button:SetFrameStrata("LOW")
  7.         button:EnableMouse(true)
  8.         button:RegisterForClicks("RightButtonDown")
  9.         button.name = button_name
  10.         button:SetAttribute("type", "spell")
  11.         button:SetAttribute("spell", SURVEY_SPELL_ID)
  12.         button:SetAttribute("action", nil)
  13.  
  14.         button:SetScript("PostClick", function(self, mouse_button, is_down)
  15.             if private.override_binding_on and not IsTaintable() then
  16.                 _G.ClearOverrideBindings(self)
  17.                 private.override_binding_on = nil
  18.                 _G.MouselookStart()
  19.             else
  20.                 private.override_binding_on = true
  21.             end
  22.         end)
  23.  
  24.         SECURE_ACTION_BUTTON = button
  25.     end
  26.  
  27.     do
  28.         local clicked_time
  29.         local ACTION_DOUBLE_WAIT = 0.2
  30.         local MIN_ACTION_DOUBLECLICK = 0.04
  31.  
  32.         _G.WorldFrame:HookScript("OnMouseDown", function(frame, button, down)
  33.             if button == "RightButton" and profileSettings.general.easyCast and _G.ArchaeologyMapUpdateAll() > 0 and not IsTaintable() and not _G.IsEquippedItemType(FISHING_POLE_NAME) and _G.CanScanResearchSite() and GetSpellCooldown(80451) == 0 then
  34.                 local perform_survey = false
  35.                 local num_loot_items = _G.GetNumLootItems()
  36.  
  37.                 if (num_loot_items == 0 or not num_loot_items) and clicked_time then
  38.                     local pressTime = _G.GetTime()
  39.                     local doubleTime = pressTime - clicked_time
  40.  
  41.                     if doubleTime < ACTION_DOUBLE_WAIT and doubleTime > MIN_ACTION_DOUBLECLICK then
  42.                         clicked_time = nil
  43.                         perform_survey = true
  44.                     end
  45.                 end
  46.                 clicked_time = _G.GetTime()
  47.  
  48.                 if perform_survey and not IsTaintable() then
  49.                     _G.SetOverrideBindingClick(SECURE_ACTION_BUTTON, true, "BUTTON2", SECURE_ACTION_BUTTON.name)
  50.                     private.override_binding_on = true
  51.                 end
  52.             end
  53.         end)
  54.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement