View Single Post
08-27-12, 01:29 PM   #1
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
How do you handle petbattle hiding?

I'm thinking of sth. like
Lua Code:
  1. local unit = CreateFrame("Frame")
  2.   unit:Hide()
  3.   unit:RegisterEvent("PET_BATTLE_OPENING_START")
  4.   unit:RegisterEvent("PET_BATTLE_CLOSE")
  5.   --event
  6.   unit:SetScript("OnEvent", function(...)
  7.     local self, event, arg1 = ...
  8.     if event == "PET_BATTLE_OPENING_START" then
  9.       for _, v in pairs(oUF_Diablo_Units) do
  10.         local f = _G[v]
  11.         if f then f:SetParent(unit) end
  12.       end
  13.     elseif event == "PET_BATTLE_CLOSE" then
  14.       for _, v in pairs(oUF_Diablo_Units) do
  15.         local f = _G[v]
  16.         if f then f:SetParent(UIParent) end
  17.       end
  18.     end
  19.   end)

Petbattle can only be enganged out of combat.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 08-27-12 at 01:42 PM.
  Reply With Quote