12.07.2015 Views

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 25 ■ Taking Protected Action in Combat 473This code starts by iterating over the player frame <strong>and</strong> the frames <strong>for</strong> allparty members <strong>and</strong> making the same changes to each one:First, it sets “spelllist“ as the type <strong>for</strong> modified left-clicks. This type isnot defined by the secure action button template, so it will look <strong>for</strong> a functionin self.menu or a snippet in self:GetAttribute(“_spelllist“). You shoulduse the latter because setting a key on the frame would introduce taint. Asyou did with the ShyBars example given be<strong>for</strong>e (the one that auto-hides theextra action bars), you use SecureH<strong>and</strong>lerSetFrameRef to import references tothe actual frames into the environment <strong>for</strong> the snippet to access when it runs.Figure 25-1 shows the BlessedMenus addon.Figure 25-1: BlessedMenus in actionA couple issues still exist with BlessedMenus; if you show one menu whileanother one is open (such as by Shift+clicking, then Alt+clicking), they willoverlap, instead <strong>of</strong> closing the first one. Also, the menu does not disappearwhen you choose an option from it. You learn how to address both these issuesin the following sections.Preserving State <strong>and</strong> Controlling In<strong>for</strong>mationThe secure frame management system in versions 2.0–2.4 <strong>of</strong> <strong>WoW</strong> used asingle variable per header, called state, to summarize all the factors it used tocontrol frames. It was possible to use multiple control factors, but if you had an

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!