Intro:
SpellDPS
uses a localization file to control how the tooltip information is
parsed and how the appended information is formatted. The templates
in this file have to match the way that the tooltips are formatted
or the spell information won't be correctly recognized.
Text
formatting:
SpellDPS_XPS
controls the format of the left side of the appended tooltip and
SpellDPS_XPM controls the right side.
The first element of each one is for damage and the second element
is for healing. More elements could be added for additional types.
Tooltip
prelude:
The second and third lines of the tooltip are
parsed by these templates. The second line always lists the Mana
used by the spell. If this fails to match, no further parsing will
be attempted.
The third line specifies the casting
time for the spell. If a number is given, it can either be an
integer or a decimal fraction. For most instant cast spells, the
casting cooldown time of 1.4 seconds is used. For channeled spells
and spells with effect over time, the time in the description is
used except in special cases (see Special Cases below).
Hunter
weapon spells and Shaman totem spells have a fourth prelude line, so
there are templates for these two cases that will use the text of
the fifth line for the spell description.
Tooltip
description:
In most cases, the fourth line of the tooltip
contains the description of the spell. In the two cases previously
mentioned it will be the fifth line. The full description is
contained internally as a single line of text even though the
tooltip will wrap the display of longer descriptions over multiple
lines.
The templates in the SpellDPS_Desc
table are applied in order against the description until a match is
found. If no match is found, processing stops. The first number in
the matching table entry is then used to index the text formatting
values for either damage or healing. In the template, each (%d+)
expression will extract one number from the description. This list
of extracted numbers is then indexed by the sub-table of numbers in
the matching entry.
XPS
calculation:
The XPS and XPM that are display are
calculated from five selected values and the Mana.
The
damage/healing per second (XPS) is calculated by: (V1+V2)/2/V3
+ V4/V5
The
damage/healing per mana (XPM) is calculated by: ( (V1+V2)/2
+ V4)/Mana
The
values V1 and V2
are usually the low and high numbers in the specified range and V3
is usually the corresponding casting time. For effects over time and
channeling, V4 is the total effect and
V5 is the time. In many cases some of
these values will be zero. The time is always forced to be non-zero
so that a divide-by-zero error won't occur. If the numerator is
zero, then the denominator doesn't matter.
The numbers
selected for these values are determined by the entry sub-table. The
first five numbers in the sub-table correspond to the five selected
values. If the number is positive, it indicates which extracted
number is to be used for that value. If the number is less than 1,
the value is the absolute value of the number, except for time
values which default to the casting time if the number is
zero.
Example: A spell heals 30 to 40 using 50 mana and takes
1.5 seconds to cast. The numbers '30' and '40' will be the extracted
from the description. The sub-table will be {1,2,0,0,0},
which indicates the V1 gets the first extracted number and V2 gets
the second extracted number. The third entry is zero so the time
defaults to the casting time. The fourth value is also zero so V4 is
zero. The calculated values are then XPS=(30+40)/2/1.5+0/1.5 and
XPM=((30+40)/2+0)/50.
Special
cases:
The sixth table number is a flag that indicates a
special case when it is non-zero. A positive value indicates the
repeat interval in seconds which requires the damage to be
multiplied by the duration and divided by the interval.
A
negative value indicates a special calculation is required, with two
cases defined:
-1: Add an additional
mana cost of (V1+V2/10)*V4.
-2: The
damage is ½ the drained mana range so divide V1 and V2 by 2.
Pattern
matching:
The pattern matching uses the Lua function
string.find as defined in the Lua:
5.0 reference manual. The following expressions are used, but
any expression from the manual is valid:
(%d):
extract a number with one digit.
(%d+):
extract a number with one or more digits.
%a+:
match one or more letters(one word).
.+:
match any number of characters.
%.:
match a period(.).
[Hh]:
match H or h.
Debugging:
The
command /sdps debug will toggle the
debug flag. When the flag is on and a template match occurs, three
lines of trace data will be displayed:
- the template that was
matched.
- the extracted values before case processing is
applied.
- after case expressions ((V1+V2)/2) / V3 and V4/V5.
Last update: 9/19/05