(631 Kb)
Updated: 06-18-18 02:21 PM
File Info
Battle for Azeroth Beta (8.0.1)
Updated:06-18-18 02:21 PM
Created:06-12-18 02:08 PM
Categories:DPS, Battle for Azeroth Beta

Prediction  New this week!

Version: 8.0.1_201806180816
by: Chosenfish [More]

The aim of Prediction is to take your character's current state (gear, buffs, debuffs, etc) and attempt to predict what abilities you should be using within the next few moments. It does this by keeping an internal database of 'Rules' - similar to SimC - and a list of 'Effects'. These Rules and Effects make use of a simple API that I have exposed for the player to use, and can be edited/updated in-game. The config frame is restricted to your class and talent specialization, but it allows you to select/make different configs of your own choosing, based on your selected talents and/or named rulesets.

This version is only usable on Beta:Battle for Azeroth. The examples given in the Shaman class are for demonstration purposes only, and not intended to optimize your play.

Updating this addon will cause the default Rulesets to be changed to the author's versions. You can create your own rulesets to prevent losing any customisations you may have made. You can also use the new Import/Export feature to save and share Rulesets.

NEW! Now includes a mini dps meter.


/prediction [option string]

    ruleset [name]                 Switch to the specified ruleset
    frequency [num]                The frequency for calculations to take place (0-30)
    overlay on|off                 If the debug overlay is visible or not
    overlay [+-]spells             Display all spells in overlay
    overlay [+-]spell [spell name] Display the selected spell in the overlay
    overlay [+-]prediction         Display the prediction calculations
    ooc on|off                     Display the HUD when out of combat
    latency [num]                  The latency in seconds
    size [pixels]                  The base size of the icons. All icons are scaled from this (default 80)
    offsetX [pixels]               Positioning of center of current prediction
    offsetY [pixels]               Positioning of center of current prediction
    secondBest on|off              Display the second best cast also [bugged atm]
    showDPS on|off                 Display the personal damage meter.

    1)    Rules                  Evaluated to determine what is cast.
    2)    SpellEffects.Instant   Effects that happen immediately upon cast.
    3)    DelayedEffects         If any have been specified by an action in the current sequence, evaluate when time past.
    4)    BuffEffects            Effects related to buffs that happen during the cast/GCD. An example is Voidform effect on haste generation.
    5)    RegenEffects           Regen effects that happen during the cast/GCD. This can be as simple as energy regen, or complex such as Maelstrom Weapon and Voidform Insanity degeneration.
    6)    SpellEffects.Cast      The effects of the cast. Last thing evaluated.
Any delayed effects that happen after the SpellEffect.Cast will be processed in the next prediction, if reached.


        Player {
            name            The character's name
            class           The character's class
            spec            The character's current specialization
            talents         A list of the character's chosen talents
            gear            A list of the character's equipped gear
            enchants        NOT YET IMPLEMENTED
            haste           The character's haste value, where 1 = 100%
            hp_percent      The character's life, as percent
            resources       A list of resources the character may have, with associated values
            maxResources    A list of the maximums a character may have of each resource
            runes           For Death Knights, recharge times for each rune
            buffs           A named list of buffs that the character currently has
            debuffs         A named list of debuffs that the character currently has
            spells          A named list of spells that the character has available
        Pet {
            name            The pet's name
            class           The pet's class
            spec            The pet's current specialization
            haste           The pet's haste value, where 1 = 100%
            hp_percent      The pet's life, as percent
            resources       A list of resources the pet may have, with associated values
            maxResources    A list of the maximums a pet may have of each resource
            buffs           A named list of buffs the pet currently has
            debuffs         A named list of debuffs the pet currently has
        Target {
            name            The target's name
            hp_percent      The target's life, as percent
            resources       A list of resources the target may have, with associated values
            buffs           A named list of buffs that the target currently has
            debuffs         A named list of debuffs that the target currently has
            cast            The name of the currently casting spell, or NIL
            channel         The name of the currently channeled spell, or NIL
            interruptible   If the cast/channel can be interrupted
        Buff/Debuff {
            count           How many stacks the buff/debuff has
            timeRemaining   How long the buff/debuff has left till it is exhausted, in seconds
            caster          Who cast the ability
        Spell {
            spellId             The id of the spell
            name                The name of the spell
            icon                Path to the icon file
            baseCastTime        Cast time without haste taken into account
            castTime            Current cast time
            baseCooldown        Cooldown without haste and abilities taken into account
            effects             List of effects that this spell has on successful cast
            maxCharges          How many charges this spell may have
            currentCharges      How many charges the spell currently has
            remainingCooldown   How long (in seconds) till reusable
Utility functions are also available:

         Player.runes.available How many runes are available right now
         AddRunes(x)            Recharge x runes
         UseRunes(x)            Use x runes
         GetPeriod()            Return how long in seconds to apply a buff/regen/cast update for
         Procced(chance)        Returns true chance percent of the time
         OverrideGCD(time)      Tell the engine the spell uses a different GCD.
         SetInstant()           Tells the engine the spell used an instant version instead of a cast.
         SetDelayEffect(time, instructions)
                                Tells the engine there is an effect that is delayed, e.g. Elemental T21_2PC causes Earthen Strength when spell lands, not when cast.
The author primarily plays an Elemental Shaman, so the data for that (was!) pretty fleshed out, though possibly not optimal, and you are recommended to use it as an example of what to do. For example, the effect of the spell 'Flame Shock' is given below:

        Target.debuffs['Flame Shock'] = { count = 0, timeRemaining = 15, caster = 'player', }
        local spent = math.min(20, Player.resources['Maelstrom'])
        if Player.talents['Aftershock'] then
            spent = spent * 0.7
        Player.resources['Maelstrom'] = Player.resources['Maelstrom'] - spent
Rules have two fields for you to enter - the name of the ability, and a condition that must evaluate to either TRUE or FALSE, with TRUE indicating that ability should be used. You do not need to check if the ability is available or off cooldown - Prediction will do that for you, before testing any other conditions. For a real example, one of the conditions for 'Totem Mastery' as an Elemental Shaman is

        (not Player.buffs['Totem Mastery'] or Player.buffs['Totem Mastery'].timeRemaining < 1.5)
Rules are evaluated in order of prescription - the first ability found that is both available and matches it's condition is the ability that will be recommended at that time. The addon then simulates the use of that ability, via it's Effect if defined, and continues to make predictions in this way until a predetermined limit (at the time of writing, 4) is reached.

When checking the property of an item, particularly gear or debuff, you should check that the gear/debuff first exists. E.g:

        (Target.debuffs['Flame Shock'] and Target.debuffs['Flame Shock'].timeRemaining < 9)
Improve help/instructions.
Add very basic defaults per class/spec combination (only for Shaman, Resto Druid atm).
Catch parsing errors when running (already caught on data entry, but in case of manual file edits)

Added workaround for IsSpellKnown bug (Data.BrokenSpellIDs in Data.lua). This should also fix the talented spells missing bug. Will add missing spellIds to table as required/found.
Fixed bug where infinite auras were giving a negative timeRemaining.
Add ruleset for Restoration Druid as a real example.
Renamed constants to more global-friendly names.
Added basic DPS meter to GUI, with associated showDPS on|off switch.

Added hasted cooldowns for all specs.
Added Target.{cast,channel,interruptible}
Added Import/Export rulesets.
[FOUND BUG, NOT FIXED]: Some talented abilities missing from spell tracking - what and why?
[TODO]: Catch parsing errors so they don't crash client (I use bugsack, so no crashes for me.)
[TODO]: Rename constants into namespace.

Persisted Options in DB by name/realm.
Added ruleset, size, offsetX and offsetY config options.
Fixed bug where Pet object not properly exposed.

Fixed bug where Edit UI didn't change spec with character.
Fixed bug where Regen and Buff Effects couldn't be deleted.
Verified buff/regen implementation works as intended.
Added examples for Shaman class.

Added Pet object.

Updated for Battle for Azeroth.
Archived Files (5)
File Name
06-17-18 06:05 AM
06-14-18 08:23 PM
06-14-18 05:35 AM
06-13-18 10:06 PM
06-12-18 02:08 PM

There have been no comments posted to this file.
Be the first to add one.

Category Jump: