View Single Post
12-10-16, 01:52 PM   #4
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
You mean ctrl-clicking the mob in the world?
Anyways, just use the normal loot event LOOT_OPENED and check for IsControlKeyDown(), which when pressed/depressed triggers MODIFIER_STATE_CHANGED.
To prevent default auto-looting, use the ctrl key as the modifier to avoid autolooting.

Something like this perhaps:
Lua Code:
  1. local Frame = CreateFrame('Frame')
  2. Frame:RegisterEvent('LOOT_OPENED')
  3. Frame:SetScript('OnEvent', function(self, event, arg1, arg2)
  4.     if(event == 'MODIFIER_STATE_CHANGED') then
  5.         if((arg1 == 'LCTRL' or arg1 == 'RCTRL') and not arg2) then
  6.             -- loot everything
  7.             arg1 = true
  8.             self:UnregisterEvent(event)
  9.         else
  10.             return
  11.         end
  12.     end
  13.  
  14.     if(arg1 and not IsControlKeyDown()) then
  15.         LootFrame_InitAutoLootTable(LootFrame)
  16.         LootFrame:SetScript('OnUpdate', LootFrame_OnUpdate)
  17.         LootFrame.AutoLootDelay = LOOTFRAME_AUTOLOOT_DELAY
  18.     else
  19.         LootFrame.AutoLootDelay = 0
  20.         LootFrame.AutoLootTable = nil
  21.         self:RegisterEvent('MODIFIER_STATE_CHANGED')
  22.     end
  23.  
  24.     LootFrame.page = 1
  25.     LootFrame_Show(LootFrame)
  26.  
  27.     if(not LootFrame:IsShown()) then
  28.         CloseLoot(not arg1 or IsControlKeyDown())
  29.     end
  30. end)

Last edited by p3lim : 12-10-16 at 02:06 PM.
  Reply With Quote