EventHorizon Course 4: Mucking With the Class Config

While adjusting EventHorizon’s look and feel is pretty straightforward, many users have been completely stumped when trying to add or remove spells from the addon. This is, in part, because the spell bar coding hasn’t been documented in quite a while.

At one point each class config file (more on those in a moment) had instructions within. However, as EventHorizon’s API grew, so did the instructions – If I were to include them within the files now, the instructions would be longer than the configs!

In today’s article we’ll be going over each available setting. A certain level of Lua knowledge will be needed for this, which we covered for the most part in the previous post. Assuming you’ve read and understand it, all that’s needed is a quick interlude to explain how the spell config works.

Lua Recap: The Spell Config

EventHorizon’s class config files are located in WoW/Interface/AddOns/EventHorizon_ClassName, where ClassName is, of course, the class you intend to change. These files are only loaded if you are playing that class, and are loaded after the general config. This can be useful later on, which I’ll cover in the next section.

The class config creates a function which is called but left undefined within EventHorizon’s core. This function, EventHorizon:InitializeClass(), is a method which assigns the spells to a given class when played.

EventHorizon:InitializeClass() calls multiple instances of another function, self:NewSpell(). NewSpell takes the table that it is given as a parameter (more on that in a moment) and uses that information to create the spell within EH.

The basics:

self is a shortcut for the table that we’re working with. In the case of the class config, self can be replaced with EventHorizon freely. There’s no real reason to use self within the class config aside from being shorter to type, but I feel that it makes it a tiny bit easier to see what’s going on from a novice perspective.

A function is, briefly, a list of instructions to perform with optional returns and parameters. Since this article’s scope is limited to the essentials for the spell config, we won’t delve into it much. It’s enough to know how a function works.

local Foobar – If a value is not specified when declaring a local, the local defaults to “nil”.

local function DoThis() – First declare the function.

local Rawr = “lol” – A local declared within a function cannot be accessed outside the current execution of the function. In other words, this line does absolutely nothing since we’re not doing anything with Rawr. If we tried to use Rawr later, Lua would spew an error.
Foobar = Rawr

end – Ending the function.

Functions can also be used as if they are variables through the use of returns. Again, not delving into the topic too much since there’s a good bit to cover here, but be aware that anything below the return line in a class config file will not be executed.

A function aspect to be aware of in this case: parameters. Those parenthesis following a function may be used to provide a function with essential data. With the spell config, we’re giving NewSpell a table which is translated into usable information for EventHorizon’s core.

To recap it all…

IntializeClass() is a function defined within the class config that, when executed, gives EH the spell information for the currently played class.

NewSpell( {table} ) is executed multiple times within InitializeClass, providing usable information to EH for each spell in order. This function uses a table as a parameter to do so.

Due to InitializeClass and NewSpell both existing within the EventHorizon global table, we can use self as a shortcut within InitializeClass for readability’s sake.

Applying Knowledge: A Few Things To Do

Knowledge is half the battle, or so they say. Now that we’ve got an understanding of how the class config works, we’ll take a deep look into what can be done with it.

Myconfig: Since we’re making changes to essential aspects of EventHorizon here, we want to make sure that we’ve got a backup and that we don’t lose those changes in an update. Myconfig is an excellent way of doing that – Just like EH’s general config, make a copy of config.lua and rename that copy to myconfig.lua. You can’t just delete the contents like last time though, since we’re not just changing fields in a table.

Using the class config as another general config: The class config files are loaded after EventHorizon’s core and config files. This lets you change things around in the class config without mucking with conditionals and all that. If you want to change settings or colors, just write in the appropriate code before the function call at the top of the file. You’ll notice that EH’s config is declared for your convenience.

Deleting or moving spells: Easily done. If you want a bar to appear higher or lower in the frame, just move its NewSpell function accordingly. The spells are defined in the order which they appear in EH. To remove a spell from the frame completely, delete its NewSpell entry and you’re all set. Efforts have been made to label each spell with a preceding comment so that they can be found easily. (Little note here, I’ve also tried to be as complete as possible when describing a bar. If you’re not sure why a bar is included in the first place, take a look at the config. Secondary effects have been applied to many, many otherwise pointless bars)

That’s all well and good. Let’s dig deeper and start changing things up.

Finding a Spell ID

You’ll need to know how to look up a Spell ID before adding or removing much from a bar. They can be found easily enough via WowHead. To look one up you usually only need the spell’s name.

  • Know what you’re looking for. EventHorizon has the ability to look for any buff or debuff visible to you, including the effects of your equipped trinkets. The type of spell you’re looking up does matter when searching for it.
  • Know that EventHorizon looks up spells by name for the most part, but does require that the Spell ID is usable by EH. Certain IDs aren’t, which will be covered here.
  • If you’re looking for a usable ability or common buff/debuff, here’s how. We’ll use Rupture for this example:
  1. Type rupture into the search box. You’ll be greeted with a list of search results.
  2. Since we’re looking for a usable ability, head to the Abilities tab and click one of the ranks.
  3. Take a look at the URL bar of your browser. If we picked Rank 1, this would be “http://www.wowhead.com/?spell=1943″.
  4. The Spell ID is the number at the end.
  • If you’re looking for the effect of a trinket, the process is a little more complicated. Let’s use a Fetish of Volatile Power for this, and assume we have no idea what the buff’s name is. The same can be done for talents.
  1. Search for fetish of volatile power. It should bring you straight to the trinket’s page.
  2. Click on the tooltip line saying “Use: …”. This should bring you to another page.
  3. We’re now looking at the trigger of the effect. This isn’t quite usable – EH will show a tiny marker when you use the trinket, but because the name of the trigger isn’t the same as its effect, we still need to dig deeper. Scroll down a little and look at the Spell Details section.
  4. You should see a spell name and icon somewhere in there. Click on it and we’ll have the actual buff that’s applied when the trinket is used. For reference, you should be at “http://www.wowhead.com/?spell=67743″, looking at a spell named Volatility.
  5. This is the one we want. The Spell ID is the set of numbers at the end. While this didn’t take long to look up, you’ll note that the information we needed was buried fairly deep. To make this a little easier in the future, you’ll want to know the name of the buff or debuff beforehand and search for it directly.
  • If you’re looking for a glyph, the process is again a little different, but also shorter as long as you know what to look for. EH looks up glyphs directly by ID instead of by name, so we need exact information here. We’ll use Glyph of Life Tap in this case.
  1. Search for glyph of life tap. You should see three tabs: Items, Professions, and Uncategorized spells.
  2. Head to the Uncategorized tab.
  3. You should see two results there, both with the same name but different icons. One is the glyph application, one is the glyph when equipped. We want the equipped version. One way to tell is by looking at the tooltip – The glyph application has a cast time, while the equipped glyph does not. Another way is via the icon itself – Application has a unique icon, while the equipped glyph generally has a golden gear for its icon.
  4. Once you’ve figured out which one the equipped glyph is, click it and find the Spell ID as normal. Again, it’s at the end of the URL.

Working With The Config: Applied Knowledge

Alright, so it’s been over 1500 words and I haven’t even started on the easy stuff. No more examples, on to the variables! Remember, these are case sensitive.

Note that if a variable is boolean, it may still act as if it were true due to how EH checks these settings, even if set to nil. This may change, but in the end it’s best to remove or comment out a line if it’s not required instead of setting its opposite.

  • spellID = number - The only required line for NewSpell. This sets the spell’s icon, internal name, and Combat Log spellID to keep track of. Any time you’re adding a new spell, you’ll need to use the steps above to find its ID, which usually goes here.
  • cast = boolean – If this is present, EH displays a cast bar as appropriate for the primary spellID. Spells contained within debuff and playerbuff aren’t tracked with this. If a spell is channeled, use channeled instead.
  • channeled = boolean - Cannot be used with cast. Tells EH that this spell is channeled and adjusts its logic accordingly.
    • numhits = number - Optional variable for channeled, specifies the number of hits in a channeled ability. No effect if present and a spell is not tagged as channeled. If you’re trying to find the number of hits in the channeled ability, duration/interval of hits is the math to use.
  • cooldown = boolean - If present, tracks the cooldown of a spell. Same deal as cast, doesn’t track anything but the defined spell.
  • requiredTalent = table = {tab, index, requiredPoints} – Tells EH to track talents for this bar. Talents may be found by your talent window or any of the talent calculators available online. The tab is a number from 1 to 3, found by counting left to right along the available talent pages for a class (For warriors, Arms = 1, Fury = 2, Protection = 3). The index can be found by counting the talents within a tab from left to right, top to bottom. Position within the tree doesn’t matter, you just need to count the icons. requiredPoints is optional, can be any number from zero to 5, and means “Only show this talent when it has this many points”. Setting the field to zero tells EH to only show a bar if the talent has no points applied to it.
  • requiredGlyph = number - Can be used in combination with requiredTalent. Adds a glyph requirement to the bar using the equipped GlyphID (method to find is located above). Especially useful for Glyph of Life Tap.
  • stance = number – Tells EH to only show a bar when in a specific stance or form. A Priest in Shadowform has a stance of 1. A Druid in Cat Form has a stance of 3. A Warrior in Defensive Stance has a stance of 2, so on, and so forth. At present there is no way to tell EH to not show a bar when in a specific stance, though there are plans to change that.
  • auraunit = string – This field is present in every spell that EH tracks, and may be manually set. Buffs default to ‘player’, while debuffs default to ‘target’. This can be any unit able to be tracked via macros (pet, partyX, targettarget, focus, etc).
  • playerbuff = boolean or number or table - Cannot be used with debuff for various reasons. Tells EH that this bar tracks buffs using the UnitBuff(auraunit) API and sets the auraunit to ‘player’ unless otherwise specified. Shares optional variables with debuff. If set to true, tracks buffs of the same name as the primary spellID. If set to a number, tracks a single buff using that spellID. See instructions in the next entry for multiple tracked buffs.
  • debuff = boolean or number or table - Cannot be used with playerbuff for the same various reasons. Tells EH that this bar tracks debuffs using the UnitDebuff(auraunit) API and sets the auraunit to ‘target’ unless otherwise specified. Shares optional variables with playerbuff. If set to true, tracks debuffs of the same name as the primary spellID. If set to a number, tracks a single debuff using that spellID.
    • To track multiple buffs or debuffs on a bar, use an iterated table containing {spellID1, spellID2, etc}. Each entry in the table marks another spellID to track. Note that if multiple buffs or debuffs are tracked, only the primary spellID is capable of tracking periodic ticks (other spells listed in the debuff/playerbuff field will be ignored as far as periodic effects are concerned). You cannot combine buffs and debuffs like this, sadly.
    • dot = number – Seconds between periodic tick effects. Tells EH to watch for periodic tick events and display tick markers accordingly.
      • cleu or event = string or table – Can be used with channeled+numhits as well, or really any spell that otherwise refuses to show up. Adds (does not override) a combat log event to track for ticks on this bar. This is useful for spells no handled in a standard fashion. Penance, for example, uses SPELL_HEAL as its tick event even though it is a channeled spell and should use SPELL_PERIODIC_HEAL. Only use this if you’ve exhausted all other options for getting periodic events working on a spell – It won’t break anything, but it does have an impact on performance. Multiple events may be added via an iterated table if needed.
      • hasted = number or table = glyphID or {talentTab,talentIndex} – Added in EH v1.3, for Patch 3.3 support. Can be set to either a Glyph (using just the glyphID, no table) or a talent (using a table with the standard tab,index format). This setting adds in a little extra handling for the bar, allowing ticks to be quite a lot more accurate when they’re affected by haste.
      • refreshable = boolean – Changes the logic used for spell refreshes and stores extra information between target swaps. If this value is present, periodic tick intervals will not be reset when a spell is refreshed and no gap will be drawn in the bar showing that it was. This is mainly used when a spell can have its duration extended or refreshed by another spell (Shadow Priests with Mind Flay and SWP, Affliction Warlocks with Haunt and Corruption, Rogues with Rupture and Glyph of Backstab, Deadly Poison, etc). Note that this does not affect re-casts, so manually refreshing a spell instead of using another will reset ticks and such accordingly.
    • unique = boolean – Tells EH to track auras from other players in addition to your own. Especially useful for things like Mortal Strike/Wound Poison, Trauma/Mangle, etc. Can be used to great effect with multiple specified auras, or alone for truly unique effects such as Weakened Soul.
    • minstacks = number – Used currently in the Mage config for Arcane Blast if you’d like an example. Sets a minimum number of stacks before the aura’s bar is shown.
    • internalcooldown = number – Not all spells have cooldowns that are visible to EH. For example, if tracking a trinket or Cheat Death, there is no way to see the cooldowns involved. internalcooldown solves this by placing a cooldown line as soon as the aura is detected. While not entirely accurate, especially for multiple tracked spells, it works pretty well. Most trinkets with proc effects have an internalcooldown of 45, most usable trinkets are 120, etc. Setting this to true won’t do you any good. Requires an aura to track, and is thus unavailable for bars tracking only cooldown.
    • glyphrefresh = table = {numRefreshes, GlyphID, TriggerName} A complex var that adds glyph-based spell refresh tracking (Glyph of Backstab extends Rupture up to 3 times per usage). numRefreshes is the maximum number of refreshes per primary spell cast. GlyphID can be obtained using the instructions above (this will not track extensions without a glyph). TriggerName is the exact name of the spell that triggers the extension.
    • textureID = number – Displays the buff/debuff bar only if the aura’s icon matches this. When a spell has multiple effects of the same name but differing icons, this gives you the ability to choose which is shown on the bar. See the Druid config for examples (Eclipse).

Hopefully I’ve covered everything here. Happy modding, and we’ll see you next time!

Previous – EventHorizon Course 3: Pimping EH

You can download EventHorizon here.
If you enjoy the addon, remember that donations are what keeps it alive and evolving. I no longer play the game any more than necessary for testing purposes, and cannot spare the money to keep my WoW account running for that purpose alone.

Posted by Taroven   @   15 November 2009

Like this post? Share it!

RSS Digg Twitter StumbleUpon Delicious Technorati Facebook

0 Comments

No comments yet. Be the first to leave a comment !
Leave a Comment

You must be logged in to post a comment.

Previous Post
«
Next Post
»
Powered by Wordpress   |   Lunated designed by ZenVerse