lotrointerface.com
Search Downloads

LoTROInterface SVN BuffWatch

[/] [trunk/] [JackdawPlugins/] [BuffWatch/] [Main.lua] - Rev 12

Compare with Previous | Blame | View Log

import "Turbine"
import "Turbine.UI";
import "Turbine.UI.Lotro";
import "Turbine.Gameplay";
import "JackdawPlugins.BuffWatch.Functions"
import "JackdawPlugins.BuffWatch.Options"

--[[
Buff Watch
*******************]]--
verno="0.4 Beta"
--[[
Reminds you to replace some buffs if you forget.

You can click the window to dismiss it... but it will always come back!

Will watch for a maximum of 10 categories of buffs. More than enough I think...

The slash commands /bw or /buffwatch will bring up the options window.

The showincombat option below allows the window to show even in combat! Only added for testing purposes.

NOTES:
There seems to be a bug in effects. EffectRemoved that means it is fired even when you GAIN a buff.
So, currently this calls all the functions TWICE when a buff is gained.

KNOWN "Features";
If you click "New Category" after editing the current categories buffs then... you lose the changes. Not serious enough to block.

TODO:
Turbine bug - checkboxes you must click on the text NOT the checkbox.
Make more efficient by not always "scanning all" whenever a buff changes. -- See note above however.
]]--

--Load data
        RemindMe=Turbine.PluginData.Load( Turbine.DataScope.Character, "BuffWatch" );

        if RemindMe==nil then
                --Default to a hunter who wants food, would like to be in at least one stance and likes to run quick...
                RemindMe={}

                RemindMe[1]={}
                RemindMe[1].bufflist={  "Stance: Strength",     
                                                                                                "Stance: Precision",
                                                                                                "Stance: Endurance",
                                                                                                "Stance: Fleet"}
                RemindMe[1].reminder=   "Stance"
                RemindMe[1].AndOr="or"

                RemindMe[2]={}
                RemindMe[2].bufflist={  "Find the Path"}
                RemindMe[2].reminder=   "Find the Path"
                RemindMe[2].AndOr="or"
                
                RemindMe[3]={}
                RemindMe[3].bufflist={  "Food"}
                RemindMe[3].reminder= "Food"    
                RemindMe[3].AndOr="or"
        end
        --This is a compatability module to stop problems with those who downloaded the original version of this plugin.
        for i=1, #RemindMe do
                if RemindMe[i].AndOr==nil then
                        RemindMe[i].AndOr="or"
                end
        end
        if RemindMe.x==nil then RemindMe.x,RemindMe.y=(Turbine.UI.Display.GetWidth()/2)-75,50 end

--Variables
--*********
Player = Turbine.Gameplay.LocalPlayer.GetInstance();
effects = Player:GetEffects();
showincombat=false

--Register for events

 handle1 = AddCallback(effects, "EffectAdded", function(sender, args)
 --Called when an effect is added
        if Player:IsInCombat() then
                Reminder.window:SetVisible(showincombat)
                if showincombat then scanner () end
        else
                scanner()
        end
end)
    
 handle2 = AddCallback(effects, "EffectRemoved", function(sender, args)
--Called when an effect is removed, 
-- but FRUSTRATINGLY!, also called when an effect is added, unless the player has no buffs. I think this is because it is re-ordering the buffs.
        if Player:IsInCombat() then
                Reminder.window:SetVisible(showincombat)
                if showincombat then scanner () end
        else
                scanner ()
        end
end)

--EffectsCleared not called when adding or removing buffs.
        --effects.EffectsCleared = function(sender, args)
        --end
-- add a callback
handle3 = AddCallback(Player, "InCombatChanged", function( sender, args )
        --Turbine.Shell.WriteLine("BW: In combat changed")
        --called when entering or leaving combat
        if Player:IsInCombat() then
                Reminder.window:SetVisible(showincombat)
                if showincombat then scanner () end
        else
                --Always do a full scan on leaving combat
                scanner ()
        end
end)
                
--Build the table
BuildTable()
--And finally - run for the first time!
scanner()

Compare with Previous | Blame


All times are GMT -5. The time now is 12:49 PM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui