lotrointerface.com
Search Downloads

LoTROInterface SVN KragenBars

[/] [branches/] [3.10/] [KragenBars/] [SkillBar.lua] - Rev 15

Compare with Previous | Blame | View Log

import "Turbine.UI";
import "Turbine.UI.Lotro";
import "KragenPlugs.Utils";
import "KragenPlugs.Utils.Extensions";
import "KragenPlugs.KragenBars";

SkillBar = class ( KragenPlugs.Utils.Extensions.SimpleWindow );

function SkillBar:Constructor ( parent, x, y, width, height, active, exclusive )
        KragenPlugs.Utils.Extensions.SimpleWindow.Constructor( self );
        
        -- declare variables
        self.parent         = parent;
    self.x              = x;
        self.y              = y;
        self.width                      = width;
        self.height         = height;
        self.exclusive      = exclusive;
        self.state          = false;
        self.effectid       = 0;

    -- set properties
        self:SetParent( parent );
        self:SetVisible(true);
        self:SetPosition( (x - 1) * 35, (y - 1) * 35 );
        self:SetSize( width * 35, height * 35 );

        if (parent.rotate == 1) then
                self:RotateBar();
        end
        
        -- SETUP BLANKSLOTS
        self.quickslots = { };
        for i = 1, width do
                if (parent.rotate == 0) then
                        self.quickslots[i] = BlankSlot(self, i, 1);
                else
                        self.quickslots[i] = BlankSlot(self, 1, i);
                end
        end
end

-- SET STATE (To be used to track the effect state of buffs/debuffs)
function SkillBar:SetState( state, id )
        -- update state and effect id
        if ( state ) then
                self.state = true;
                self.effectid = id;
        else
                if ( id == self.effectid ) then
                    self.state = false;
                        self.effectid = 0;
                end

        end
end

-- ROTATE BAR
function SkillBar:RotateBar()
        local newwidth = self.height;
        local newheight = self.width;
        self:SetSize( newwidth * 35, newheight * 35 );
        
        self.width = newwidth;
        self.height = newheight;
        
        local newx = self.y;
        local newy = self.x;
        
        self:SetPosition( (newx - 1) * 35, (newy - 1) * 35 );
        self.x = newx;
        self.y = newy;
        
        if (self.quickslots ~= nil) then
                for k,v in pairs(self.quickslots) do
                        local blankpos = { };
                        blankpos[1], blankpos[2] = v:GetPosition();
                        v:SetPosition(blankpos[2], blankpos[1]);
                end
        end
end

Compare with Previous | Blame


All times are GMT -5. The time now is 07:32 PM.


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