# StatusBars 1.6.6

Daniel Wesslén

## About

StatusBars adds bars to monitor health, mana, rage, energy, combo points, debuffs and target/pet stats during combat (and whenever they are not fully charged / depleted).

## Features

- Health, mana, combo points, debuffs, etc visible at a glance.
- Bars fade in and out when needed, as defined by the user.
- Customizable bar and text colors, dependant on the current value.
- Customizable text - or none, whichever you prefer.
- Bars are draggable, but not by accident.
- Bars flash to draw attention to low stats.
- Can display mana in shifted form if DruidBar is also installed.
- Can display enemy health if MobHealth is also installed.

If you want to replace the default player and target frames with StatusBars, I suggest you get the HideFrames addon.

## Customization

Keep the shift key pressed and drag a bar to move the group it belongs to. If the bars are locked you will have to type `/statusbars unlock` first.

The behaviour can be controlled via the `/statusbars` slash command.

      Syntax: /statusbars (lock|unlock)
      Syntax: /statusbars (load|save) (<name>|defaults)
      Syntax: /statusbars <target> <option> (<value>|print|reset)
      Targets:
        all, player, target, pet, power, tpower, ppower,
        health, mana, rage, energy, focus, combo, druid, buff, debuff,
        thealth, tmana, trage, tenergy, tfocus, tdebuff, tbuff
        phealth, pmana, prage, penergy, pfocus, phappy, pbuff, pdebuff
      Options:
        alpha (decimal, default=1)
        enable (always/never/combat/combatonly/auto)
        color, tcolor, pcolor (string, see Readme.html)
        flash (on/off)
        group (player/target/pet/group1/group2/...)
        percentage (none/left/right)
        ptext (string, default = &frac%, see Readme.html)
        scale (decimal, default=1)
        text (string, see Readme.html or print the current value)
        warn (decimal, default=0.6)

Friendly buffs are hidden for the player and pet by default. To enable them, type

      /statusbars buff enable combatonly
      /statusbars pbuff enable combatonly

To remove all buffs and debuffs, type

      /statusbars buff enable never
      /statusbars debuff enable never
      /statusbars tbuff enable never
      /statusbars tdebuff enable never
      /statusbars pbuff enable never
      /statusbars pdebuff enable never

#### Target

The target determines in which bars the option is to be set. Using `all` will set the value in all applicable bars, using `power` or `tpower` will set the value in the mana, rage, energy and focus bars. `player` and `target` will set set value for all bars in the group.

#### Options

`alpha` | Opacity of the bar. Decimal value between 0.0 and 1.0. Default = 1.0.
`enable` | When the bar should be visible. `always`, `never`: As expected `auto`: When the current value differs from the default i.e. when damaged, when mana is not full, etc. `combat`: As `auto`, but also displays when in combat. `combatonly`: Only displays in combat, no matter what the value is.
`color`, `tcolor`, `pcolor` | The color of the bar, text and percentage text. Can either be a simple named color (`red`, `yellow`, etc), a hexadecimal color in `rgb` or `rrggbb` format, or a color expression.
`flash` | If the bar should flash when high/low.
`group` | Which group the bar should belong to. `player`, `target`, `pet` or one of the generic `group1`, `group2`...
`percentage` | Placement of the percentage display. `none`, `left` or `right`.
`ptext` | Text to be displayed in the percentage field, subject to variable substitution.
`scale` | Scale the bar. Will only work well if all the bars in a group are set to the same scale.
`text` | The text to be displayed in the bar, subject to variable substitution.
`warn` | Distance from the default value where the bar will start flashing if enabled. Default = 0.6, which represents 60%.

#### Option Management

Options can be loaded, saved and reset using the commands `/statusbars load <name>`, `/statusbars save <name>` and `/statusbars load defaults`.

You can use the name of another character to load or save the settings of that character, or use an arbitrary name to save settings for later reference.

#### Text Variable Substitution

The text to be displayed in the bar is subject to variable substitution; any occurences of `&cur`, `&max`, `&frac`, `&-cur`, `&name`, `&rank`, `&class`, `&type` and `&lvl` will be replaced with the current value, maximum value, current percentage, lost value, name, rank, class, type and level.

This can be used to customize the information displayed in the bar. For example; if you do not like the percentage display but would like to see the target level and percentage next to the name in the target health bar, issue these commands:

    	/statusbars thealth percentage none
    	/statusbars thealth text &name, &lvl (&frac%)

This will remove the percentage display and instead show text similar to "Defias Looter, 13 (43%)".

If you would like to see the amount of health lost as well as amount left, use:

    	/statusbars thealth text &cur / &max (-&-cur)

This will show "580 / 700 (-120)".

#### Color Expressions

Color expressions are used to make the bar color dependant on the current value. The facility is perhaps best described by an example, the default health bar color is:

    	<25%:red <50%:orange <75%:yellow green

This reads as "If health is lower than 25%, the bar is red. If health is below 50%, the bar is orange. If health is below 75%, the bar is yellow. Otherwise, the bar is green."

The available conditions are `=`, `!=`, `<`, `>`, `<=` and `>=.`

The value to test against can be either absolute or a percentage.

Conditions are tested in order and the first one that matches will be selected, so make sure you list conditions in the reverse order they are expected to apply. The exception is the default color, which does not have a condition and is applied when no condition matches. Every color expression must have one and only one default color, and its placement is irrelevant.

As a trivial example, the default mana bar color is:

    	blue

The following examples implement a request for functionality I got earlier:
"Is there any way to color the combo bar. Like for 1/2 points it's red. 3/4 points it's yellow. 5 points it is green?"

    	/statusbars combo color =5:green >=3:yellow red

"Energy bar: Could it be yellow if Energy >= 40 (Sinister Strike), orange >= 35 (Eviscerate), and red for Energy < 35?"

    	/statusbars energy color <35:f00 <40:ff8000 ff0

In the last example, colors were specified in hexadecimal `rgb` for illustration. You can use your favourite html color picker to find out the hex code for a color.

If you start using complex color expressions I would suggest storing them in a macro so that you will not have to retype everything when making changes.

## History

#### Version 1.6.6

- Compatible with version 1.9.
- Added example for how to disable all buffs/debuff displays.

#### Version 1.6.5

- Added text variable &type.
- Made fadein/-out duration more easily accessible for users in the lua file.
- Bugfix?: Possible fix for unconfirmed bug where buffs were shown on corpses.

#### Version 1.6.4

- Bugfix: Used nonexistant string.trim() (bad Ephemeral!)

#### Version 1.6.3

- Added pet happiness bar.
- Added text variables &rank, &class and &happy.
- Changed default target health text to include rank.

#### Version 1.6.2

- Bugfix: Some settings were not always used correctly during initialization.
- General cleanup and optimization.

#### Version 1.6.1

- Bars can now be locked with `/statusbars lock`.
- Loading and saving of settings.

#### Version 1.6

- Added buff and debuff bars.
- Made the pet health text default dependant on if MobHealth is used, so that it matches the appearance of target health.
- Optimizations for disabled bars.
- Bugfix: Target power bar changed color before fading out in some cases.
- Bugfix: Target frame sometimes faded out and back in again when switching targets.

#### Version 1.5.6

- Replaced text variables &player, &target, &pet, &tlvl and &plvl with generic &name and &lvl.
- Display level ?? for targets with much higher level.
- Bugfix: Target bars used to show up momentarily when selecting a new target if set to enable in combat only.

#### Version 1.5.5

- Bugfix: Druid mana bar was not updating since 1.5.1.

#### Version 1.5.4

- Now compatible with old MobHealth versions.
- Bugfix: Worked around a bug in WoW that causes empty frames to forget their position, usually affecting the target group.

#### Version 1.5.3

- Bugfix: Finally fixed bug with bars getting stuck in move mode?
- Bugfix: Worked around problem with using /console reloadui while damaged.

#### Version 1.5.2

- Added 5 generic groups.
- Added enable mode for only showing bars when in combat.
- Bugfix: Combo flashing was broken in the last release.
- Bugfix: Bars no longer get stuck in move mode.

#### Version 1.5.1

- Bars can now be clicked through.
- Any bar can be used to drag the group (not only the first).
- Reduced CPU usage a tiny bit again.
- Changed the druid mana bar default behaviour to hide when full, even if in combat.

#### Version 1.5

- Customizable bar grouping.
- Added scale option.
- Customizable text color.
- Combo display stays visible when switching to another form if there are combo points left.
- Much improved bar sorting, resulting in better behaviour when bars are manually disabled.
- Reduced CPU load through improvements and bugfixes.
- More slash command error checking and possibly bugfixes.
- Doc bugfix: Combo/energy examples were incorrect.

#### Version 1.4.4

- Bugfix: Druid mana bar did not work in French and German clients.

#### Version 1.4.3

- Compatible with DruidBar 2.01.
- Made target health text default adaptive depending on if MobHealth is installed.
- Added German localization, by Tenvan.
- Completed French localization, by Juki.
- Bugfix: Fixed problems with combat mode getting stuck when leaving an instance while in combat.

#### Version 1.4.2

- MobHealth is used if available.
- Customizable "percentage text".
- Added text variable `&-cur`, for showing the amount a bar differs from the default value.
- Bugfix: Stupid bug that made it impossible to disable flashing.

#### Version 1.4.1

- Bugfix: Error when targeting elite mobs.
- Bugfix: Could not change percentage display for combo bar (fixed in 1.4 R2).

#### Version 1.4

- New combo display.
- Configurable bar colors.
- Added pet bars.
- Configurable percentage display placement.
- Added French localization, by Juki.
- Text can include player, target and pet level.
- You can now print and reset options.
- Improved documentation.
- Bugfix: Worked around druid mana decimal display problem.
- Bugfix: Druid mana bar was not always loading settings immediately.
- General code cleanup and many tiny improvements and bugfixes.

#### Version 1.3.3

- Bugfix: Settings were not always loaded correctly.

#### Version 1.3.2

- Improved error checking when setting options.
- Bugfix: Percentage option was not being honored.
- Bugfix: Settings were sometimes reset.

#### Version 1.3.1

- Bugfix: Error when printing boolean option values.
- Bugfix: Setting options with target = all only updated the first option.

#### Version 1.3

- Added target mana/rage/energy bar.
- Customizable text.
- Improved (more obvious) flashing.
- Per-character settings.
- Added druid mana bar in shifted form (uses the DruidBar addon).
- Bugfix: Target health bar did not always update immediately.
- Bugfix: Several minor alpha-related bugs.

#### Version 1.2.1

- Added option to set alpha.
- Bugfix: Target health bar hides when a targeted nonhostile is dead.
- Bugfix: Weird flashing behaviour.

#### Version 1.2

- Made the bars draggable (in two groups).
- Added target health bar.
- Added slash command for configuration.
- Cleaned up the code. Version 1.1 could potentially conflict with other addons.

#### Version 1.1

- Health bar color changes.
- Added combo bar.

#### Version 1.0

- First release.