lotrointerface.com
Search Downloads

LoTROInterface SVN KragenBars

[/] [branches/] [3.02/] [KragenBars/] [GuardianBars.lua] - Rev 40

Go to most recent revision | Compare with Previous | Blame | View Log

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

GuardianBars = class( KragenPlugs.KragenBars.ClassBar );

function GuardianBars:Constructor()
        KragenPlugs.KragenBars.ClassBar.Constructor( self );

    -- class settings arent saved then load the default settings
    if (not settings.class) then
        settings.class = vars.playerclass;
        self:DefaultSettings();
        self:ShowSetup();
    else
        self.settings = settings.classinfo;
        if (settings.vers ~= vars.vers) then
                self:UpdateSettings();
        end
    end
    
    self.wound = 0;
    
    -- ALL X, Y, WIDTH, HEIGHT values are in quickslot (ie: 1 width = the width of one quickslot: 35 px);
    
    -- Build Windows        SkillWindow( name:String, defaultx:int, defaulty:int, width:int, height:int, settings:table);
    self.windows["SelfBuffs"]   = SkillWindow("Self Buffs",                     1, 1, 6, 1,     self.settings["SelfBuffs"]      );
        self.windows["Utility"]         = SkillWindow("Utility",                        8, 1, 2, 1,     self.settings["Utility"]        );
        self.windows["ClassItems"]      = SkillWindow("Class Items",            11, 1, 2, 1,    self.settings["ClassItems"]     );
        self.windows["Parry"]           = SkillWindow("Parry",                          1, 2, 5, 1,     self.settings["Parry"]          );
        self.windows["Protect"]         = SkillWindow("Protect Fellows",        6, 2, 2, 1,     self.settings["Protect"]        );
        self.windows["Stunned"]         = SkillWindow("Stunned",                        12, 2, 1, 1,    self.settings["Stunned"]        );
        self.windows["Overpower"]       = SkillWindow("Overpower",                      1, 3, 3, 1,     self.settings["Overpower"]  );
        self.windows["Block"]           = SkillWindow("Block",                          1, 3, 4, 1,     self.settings["Block"]          );
    self.windows["Stances"]             = SkillWindow("Stances",                        12, 3, 1, 1,    self.settings["Stances"]        );
    self.windows["Ward"]                = SkillWindow("Ward",                           1, 4, 1, 1,     self.settings["Ward"]           );
        self.windows["Melee"]           = SkillWindow("Melee",                          2, 4, 6, 1,     self.settings["Melee"]          );
    self.windows["Taunt"]               = SkillWindow("Taunt",                          7, 4, 4, 1,     self.settings["Taunt"]          );
    self.windows["Ranged"]              = SkillWindow("Ranged",                         12, 4, 1, 1,    self.settings["Ranged"] );
    
    
    -- Build Bars           SkillBar( parent:SkillWindow, x:int, y:int, width:int, height:int, active:Boolean);
    self.bars["Overpower"]                              = SkillBar(self.windows["Overpower"], 1, 1, 3, 1, true, true);
        self.bars["BlockTier1"]                         = SkillBar(self.windows["Block"], 1, 1, 3, 1, true, true);
    self.bars["BlockTier2"]                             = SkillBar(self.windows["Block"], 1.5, 1, 2, 1, true, true);
    self.bars["BlockTier3"]                             = SkillBar(self.windows["Block"], 4, 1, 1, 1, true, true);
    self.bars["ParryTier1"]                             = SkillBar(self.windows["Parry"], 2, 1, 1, 1, true, true);
    self.bars["ParryTier2"]                             = SkillBar(self.windows["Parry"], 1, 1, 3, 1, true, true);
    self.bars["ParryTier3"]                             = SkillBar(self.windows["Parry"], 4, 1, 2, 1, true, true);
    self.bars["Ward"]                                   = SkillBar(self.windows["Ward"], 1, 1, 1, 1, true, false);
        self.bars["Melee"]                                      = SkillBar(self.windows["Melee"], 1, 1, 6, 1, true, false);
    self.bars["Taunt"]                                  = SkillBar(self.windows["Taunt"], 1, 1, 4, 1, true, false);
    self.bars["SelfBuffs"]                              = SkillBar(self.windows["SelfBuffs"], 1, 1, 6, 1, true, false);
    self.bars["Protect"]                = SkillBar(self.windows["Protect"], 1, 1, 2, 1, true, false);
    self.bars["Stances"]                                = SkillBar(self.windows["Stances"], 1, 1, 3, 1, true, false);
    self.bars["Stunned"]                                = SkillBar(self.windows["Stunned"], 1, 1, 1, 1, true, false);
    self.bars["Utility"]                                = SkillBar(self.windows["Utility"], 1, 1, 2, 1, true, false);
    self.bars["ClassItems"]                             = SkillBar(self.windows["ClassItems"], 1, 1, 2, 1, true, false);
    self.bars["Ranged"]                                 = SkillBar(self.windows["Ranged"], 1, 1, 1, 1, true, false);
    

        -- Build Skills         SkillSlot( parent:SkillBar, x:int, y:int, active:Boolean, level:int, hexcode:String );
        --                      For skills that need to be replaced with a new version you can enter level as a table
        --                                              ie.  {["start"] = 1, ["end"] = 34]}
        --                                              then set the new skill level to 34 and it will replace the old at that level
    self.skills["ShieldSwipe"]                  = SkillSlot(self.bars["BlockTier1"],    1, 1, false, 2, "0x7000305D");
    self.skills["CatchABreath"]                 = SkillSlot(self.bars["BlockTier1"],    2, 1, false, 16, "0x7000307D");
        self.skills["LitanyOfDefiance"]         = SkillSlot(self.bars["BlockTier1"],    3, 1, false, 60, "0x7000F095");
    
    self.skills["ShieldBash"]                   = SkillSlot(self.bars["BlockTier2"],    1, 1, false, 10, "0x70003EE1");
    self.skills["ShieldTaunt"]                  = SkillSlot(self.bars["BlockTier2"],    2, 1, false, 22, "0x70003EE6");
    
    self.skills["ShieldSmash"]                  = SkillSlot(self.bars["BlockTier3"],    1, 1, false, 41, "0x70002EC4");
    
    self.skills["Retaliation"]                  = SkillSlot(self.bars["ParryTier1"],    1, 1, false, 8, "0x70003EE0");
    
    self.skills["Overwhelm"]                    = SkillSlot(self.bars["ParryTier2"],    1, 1, false, 8, "0x70003EE2");
    self.skills["WhirlingRetaliation"]  = SkillSlot(self.bars["ParryTier2"],    2, 1, false, 14, "0x70003EE4");
        self.skills["Thrust"]                           = SkillSlot(self.bars["ParryTier2"],    3, 1, false, 18, "0x70003EE5");
    
    self.skills["SaltTheWound"]                 = SkillSlot(self.bars["ParryTier3"],    2, 1, true, 22, "0x7000D4AF");
        self.skills["ToTheKing"]                        = SkillSlot(self.bars["ParryTier3"],    1, 1, false, 41, "0x70002EA5");
    
    self.skills["GuardiansWard"]                = SkillSlot(self.bars["Ward"],                  1, 1, true, 1, "0x70003066");
    self.skills["ShieldBlow"]                   = SkillSlot(self.bars["Melee"],                 1, 1, true, { 1, 54 }, { "0x7000306F", "0x7000F1E0" });
        self.skills["Sting"]                            = SkillSlot(self.bars["Melee"],                 2, 1, true, { 1, 52 }, { "0x70003058", "0x7000F1E1" });
        self.skills["SweepingCut"]                      = SkillSlot(self.bars["Melee"],                 3, 1, true, 4, "0x70003EDE");
    self.skills["VexingBlow"]                   = SkillSlot(self.bars["Melee"],                 4, 1, true, 6, "0x7000308A");
    self.skills["Stamp"]                                = SkillSlot(self.bars["Melee"],                 5, 1, true, 32, "0x70003EE7");
    self.skills["TakeToHeart"]                  = SkillSlot(self.bars["Melee"],                 6, 1, true, 58, "0x7000ED87");

    self.skills["Challenge"]                    = SkillSlot(self.bars["Taunt"],                 1, 1, true, 16, "0x70003097");
    self.skills["FrayTheEdge"]                  = SkillSlot(self.bars["Taunt"],                 2, 1, true, 40, "0x7000D4B5");
        self.skills["Engage"]                           = SkillSlot(self.bars["Taunt"],                 3, 1, true, 42, "0x7000D4B2");
        self.skills["ChallengeTheDarkness"]     = SkillSlot(self.bars["Taunt"],                 4, 1, self.settings["Features"].darkness, 41, "0x70002EDF");
    
    self.skills["GuardiansPledge"]              = SkillSlot(self.bars["SelfBuffs"],     1, 1, true, 20, "0x700030A4");
    self.skills["ThrillOfDanger"]               = SkillSlot(self.bars["SelfBuffs"],     2, 1, true, 26, "0x700030B4");
        self.skills["WarriorsHeart"]            = SkillSlot(self.bars["SelfBuffs"],     3, 1, true, { 30, 64 }, { "0x700030AC", "0x70020DF5" });
    self.skills["DeepBreath"]                   = SkillSlot(self.bars["SelfBuffs"],     4, 1, true, 34, "0x700030A8");
    self.skills["IgnoreThePain"]                = SkillSlot(self.bars["SelfBuffs"],     5, 1, true, 44, "0x70021663");
    self.skills["Charge"]                               = SkillSlot(self.bars["SelfBuffs"],     6, 1, true, { 48, 62 }, { "0x7000DD14", "0x7001F4B6" });
    
    self.skills["Protection"]                   = SkillSlot(self.bars["Protect"],               1, 1, true, 24, "0x7000309A");
        self.skills["ShieldWall"]                       = SkillSlot(self.bars["Protect"],               2, 1, true, 50, "0x7000D4AE");

    self.skills["ForcedOpening"]                = SkillSlot(self.bars["Overpower"],     1, 1, false, 30, "0x7000D4B0");
    self.skills["Stagger"]                              = SkillSlot(self.bars["Overpower"],     2, 1, false, 46, "0x7000D4B3");
    self.skills["BrutalAssault"]                = SkillSlot(self.bars["Overpower"],     3, 1, false, 56, "0x7000F158");
    
    self.skills["TurnTheTables"]                = SkillSlot(self.bars["Stunned"],               1, 1, false, 36, "0x70003EE8");
    
    self.skills["SummonTinker"]                 = SkillSlot(self.bars["Utility"],               1, 1, false, 26, "0x7000D4B4");
        self.skills["GuardiansPromise"]         = SkillSlot(self.bars["Utility"],               2, 1, true, 38, "0x70003EE9");
        
        self.skills["LetFly"]                           = SkillSlot(self.bars["Ranged"],                1, 1, true, 30, "0x70003E14");

    
        -- Build Stance Slot (Multi)        SkillMultiSlot(parent:SkillBar, x:int, y:int, active:Boolean);
    -- AddShortcut to Multi Slot        SkillMultiSlot:AddShortcut(skillname:String, level:int, hex:String);
    --                                  After Declaring Shortcuts you need to call LevelCheck to validate the levels
        --                                  LevelCheck should also be called on refresh.
    self.multi = { };
        self.multi["StanceSlot"]           = SkillMultiSlot(self.bars["Stances"], 1, 1, true);
        self.multi["StanceSlot"]:AddShortCut("GuardiansDefence",         4, "0x70003EDF");
    self.multi["StanceSlot"]:AddShortCut("GuardiansParry",              12, "0x70003EE3");
    self.multi["StanceSlot"]:AddShortCut("Overpower",                   30, "0x7000D4B1");
    if (self.settings["Features"].threatstance) then self.multi["StanceSlot"]:AddShortCut("GuardiansThreat",    41, "0x70002ED4"); end
    self.multi["StanceSlot"]:LevelCheck();
    
    self.multi["ShieldSpikes"]                  = ItemMultiSlot(self.bars["ClassItems"], 2, 1, true);
        self.multi["ShieldSpikes"]:AddShortCut("Spike1",                self.settings["Quickslots"].spike1["active"], self.settings["Quickslots"].spike1["type"], self.settings["Quickslots"].spike1["data"]);
        self.multi["ShieldSpikes"]:AddShortCut("Spike2",                self.settings["Quickslots"].spike2["active"], self.settings["Quickslots"].spike2["type"], self.settings["Quickslots"].spike2["data"]);
        self.multi["ShieldSpikes"]:AddShortCut("Spike3",        self.settings["Quickslots"].spike3["active"], self.settings["Quickslots"].spike3["type"], self.settings["Quickslots"].spike3["data"]);
    self.multi["ShieldSpikes"]:AddShortCut("Spike4",    self.settings["Quickslots"].spike4["active"], self.settings["Quickslots"].spike4["type"], self.settings["Quickslots"].spike4["data"]);
        
        -- Stance Change Event
        AddCallback(vars.classattr, "StanceChanged", function(sender, args)
                KragenBars:StanceChange(vars.classattr:GetStance());
        end);
        
        -- Block/Parry Events
        AddCallback(vars.classattr, "IsBlockTier3AvailableChanged", function(sender, args)
                KragenBars:BlockChange(3, vars.classattr:IsBlockTier3Available());
        end);
        AddCallback(vars.classattr, "IsParryTier3AvailableChanged", function(sender, args)
                KragenBars:ParryChange(3, vars.classattr:IsParryTier3Available());
        end);
        
        -- Set Combat States
        self.skills["ThrillOfDanger"]:SetCombat( true, false );
        self.skills["GuardiansPromise"]:SetCombat( false, true );
        self.skills["SummonTinker"]:SetCombat( false, true );
        -- self.skills["GuardiansWard"]:SetCombat( true , false );

        -- Initial Checks (Setting up inital states for combat states and stances and such)
        self:InitBars();
        self:BlockChange(3, vars.classattr:IsBlockTier3Available());
        self:ParryChange(3, vars.classattr:IsParryTier3Available());
        self:StanceChange(vars.classattr:GetStance());
        self:CombatChange(vars.player:IsInCombat());
        


end

function GuardianBars:AddEffect( effectIndex )
        local addedeffect = vars.player:GetEffects():Get( effectIndex );

        -- Guardian's Ward
        if ((addedeffect:GetName() == "Guardian's Ward" or addedeffect:GetName() == "Improved Guardian's Ward")) then
        self.skills["GuardiansWard"]:SetState( true , self.settings["Features"].wardactive < 3, addedeffect:GetID());
                if (self.settings["Features"].wardactive == 2) then
                        self.skills["GuardiansWard"]:SetHover( true );
                elseif (self.settings["Features"].wardactive == 4) then
                        self.skills["GuardiansWard"]:StartTimer( addedeffect:GetDuration() * .70, true );
                end
                
        elseif (addedeffect:GetName() == "Block Response") then
                self.bars["BlockTier1"]:SetState( true, addedeffect:GetID());
                if (not self.bars["BlockTier2"].state) then
                        self.skills["ShieldSwipe"]:SetActive(true);
                        self.skills["CatchABreath"]:SetActive(true);
                        self.skills["LitanyOfDefiance"]:SetActive(true);
                        if (vars.playerlevel >= 10) then
                                self.bars["BlockTier1"]:SetZOrder(0);
                                self.bars["BlockTier2"]:SetZOrder(-10);
                        end
                end
                
    elseif (addedeffect:GetName() == "Shield Swipe") then
                self.bars["BlockTier2"]:SetState( true, addedeffect:GetID());
                self.skills["ShieldSwipe"]:SetActive(false);
                self.skills["CatchABreath"]:SetActive(false);
                self.skills["LitanyOfDefiance"]:SetActive(false);
                self.bars["BlockTier1"]:SetZOrder(-10);
                self.bars["BlockTier2"]:SetZOrder(0);
                self.skills["ShieldTaunt"]:SetActive(true);
                self.skills["ShieldBash"]:SetActive(true);
                
        elseif (addedeffect:GetName() == "Parry Response") then
                self.bars["ParryTier1"]:SetState( true, addedeffect:GetID());
                if (not self.bars["ParryTier2"].state) then
                        self.skills["Retaliation"]:SetActive( true );
                        self.bars["ParryTier1"]:SetZOrder(0);
                        self.bars["ParryTier2"]:SetZOrder(-10);
                end
                
    elseif (addedeffect:GetName() == "Retaliation") then
                self.bars["ParryTier2"]:SetState( true, addedeffect:GetID());
                self.skills["Retaliation"]:SetActive( false );
                self.bars["ParryTier1"]:SetZOrder(-10);
                self.bars["ParryTier2"]:SetZOrder(0);
                self.skills["Overwhelm"]:SetActive( true );
                self.skills["Thrust"]:SetActive( true );
                self.skills["WhirlingRetaliation"]:SetActive( true );

        -- Stunned, Dazed, Knocked Down
        elseif (addedeffect:GetName() == "Stunned" or addedeffect:GetName() == "Dazed" or addedeffect:GetName() == "Knocked Down") then
        self.skills["TurnTheTables"]:SetState( true , true, addedeffect:GetID());

        -- Stance Change
        elseif (addedeffect:GetName() == "Overpower") then
                self.bars["Overpower"]:SetState( true, addedeffect:GetID() );
                self.windows["Overpower"]:SetZOrder(0);
            self.windows["Block"]:SetZOrder(-10);
                self.skills["ForcedOpening"]:SetActive( true );
                self.skills["Stagger"]:SetActive( true );
                self.skills["BrutalAssault"]:SetActive( true );
                self.skills["ShieldBlow"]:SetActive( false );
                self.skills["Protection"]:SetActive( false );
                self.skills["ShieldWall"]:SetActive( false );
                
        elseif (addedeffect:GetName() == "Campsite") then
                self.skills["SummonTinker"]:SetState(true, true, addedeffect:GetID() );
                
    elseif (addedeffect:GetName() == "Westernesse Spikes" or addedeffect:GetName() == "Beleriand Spikes" or addedeffect:GetName() == "Ancient-Dwarf Spikes" or addedeffect:GetName() == "Large Shield Spikes") then
                self.multi["ShieldSpikes"]:SetState(true, true, addedeffect:GetID() );
                self.multi["ShieldSpikes"]:SetHover(true);
                
        -- Wound
        elseif (addedeffect:GetCategory() == Turbine.Gameplay.EffectCategory.Wound ) then
                self.wound = self.wound + 1;
                if (self.settings["Features"].woundindicator) then
                        self.skills["IgnoreThePain"]:SetColor("red");
                end
                
                
    end
end

function GuardianBars:RemoveEffect( effect )

        -- SetState can be called on both bars and skills
        -- it will store the incoming effect id and flag the state
        -- SetState(effectstate:Boolean,  effectid:int);

        -- Guardian's Ward
        if (effect:GetName() == "Guardian's Ward" or effect:GetName() == "Improved Guardian's Ward") then
        self.skills["GuardiansWard"]:SetState( false , true, effect:GetID());
        self.skills["GuardiansWard"]:SetHover( false );
        
    elseif (effect:GetName() == "Block Response") then
                self.bars["BlockTier1"]:SetState( false, effect:GetID());
                if (not self.bars["BlockTier1"].state) then
                        self.skills["ShieldSwipe"]:SetActive(false);
                        self.skills["CatchABreath"]:SetActive(false);
                        self.skills["LitanyOfDefiance"]:SetActive(false);
                end
                
    elseif (effect:GetName() == "Shield Swipe") then
        self.bars["BlockTier2"]:SetState( false, effect:GetID());
                if (not self.bars["BlockTier2"].state) then
                        self.skills["ShieldTaunt"]:SetActive(false);
                        self.skills["ShieldBash"]:SetActive(false);
                        if (self.bars["BlockTier1"].state) then
                                self.skills["ShieldSwipe"]:SetActive(true);
                                self.skills["CatchABreath"]:SetActive(true);
                                self.skills["LitanyOfDefiance"]:SetActive(true);
                                self.bars["BlockTier1"]:SetZOrder(0);
                                self.bars["BlockTier2"]:SetZOrder(-10);
                        end
                end
                
        elseif (effect:GetName() == "Parry Response") then
                self.bars["ParryTier1"]:SetState( false, effect:GetID());
                if (not self.bars["ParryTier1"].state) then
                        self.skills["Retaliation"]:SetActive(false);
                end
                
    elseif (effect:GetName() == "Retaliation") then
        self.bars["ParryTier2"]:SetState( false, effect:GetID());
                if (not self.bars["ParryTier2"].state) then
                        self.skills["Overwhelm"]:SetActive(false);
                        self.skills["Thrust"]:SetActive(false);
                        self.skills["WhirlingRetaliation"]:SetActive(false);
                        if (self.bars["ParryTier1"].state) then
                                self.skills["Retaliation"]:SetActive(true);
                                self.bars["ParryTier1"]:SetZOrder(0);
                                self.bars["ParryTier2"]:SetZOrder(-10);
                        end
                end

        -- Stunned, Dazed or Knocked Down
        elseif (effect:GetName() == "Stunned" or effect:GetName() == "Dazed" or effect:GetName() == "Knocked Down") then
        self.skills["TurnTheTables"]:SetState( false , false, effect:GetID());

    -- Stance Change
        elseif (effect:GetName() == "Overpower") then
                self.bars["Overpower"]:SetState( false, effect:GetID() );
                if (not self.bars["Overpower"].state) then
                        self.windows["Overpower"]:SetZOrder(-10);
                self.windows["Block"]:SetZOrder(0);
                self.skills["ForcedOpening"]:SetActive( false );
                        self.skills["Stagger"]:SetActive( false );
                        self.skills["BrutalAssault"]:SetActive( false );
                        self.skills["ShieldBlow"]:SetActive( true );
                        self.skills["Protection"]:SetActive( true );
                        self.skills["ShieldWall"]:SetActive( true );
                end
                
                
        elseif (effect:GetName() == "Campsite") then
                self.skills["SummonTinker"]:SetState(false, false, effect:GetID() );
                
    elseif (effect:GetName() == "Westernesse Spikes" or effect:GetName() == "Beleriand Spikes" or effect:GetName() == "Ancient Dwarf Spikes" or effect:GetName() == "Large Shield Spikes") then
                self.multi["ShieldSpikes"]:SetState(false, true, effect:GetID() );
                self.multi["ShieldSpikes"]:SetHover(false);
                
        -- Wound
        elseif (effect:GetCategory() == Turbine.Gameplay.EffectCategory.Wound ) then
                self.wound = self.wound - 1;
                if (self.wound == 0) then
                        self.skills["IgnoreThePain"]:SetColor();
                end

        end
end


function GuardianBars:StanceChange(stance)
        
        -- PRIMARY STANCE SWITCHING
        if (self.settings["Features"].stancepriority) then
                local newstance = 0;

                if (stance == 3) then
                        newstance = 4;
                elseif (stance == 4) then
                        newstance = 3;
                else
                    newstance = stance;
                end

                if (newstance == self.settings["Features"].primarystance) then
                        self.multi["StanceSlot"]:SetIndex(self.settings["Features"].secondarystance);
                else
                    self.multi["StanceSlot"]:SetIndex(self.settings["Features"].primarystance);
                end
        end
        
        -- HOVER/DISAPPEAR SWITCHING
        if (stance == 0) then
                self.multi["StanceSlot"]:SetHover( false );
                self.multi["StanceSlot"]:SetActive( true );
        else
                self.multi["StanceSlot"]:SetActive( self.settings["Features"].stanceactive ~= 3);
        self.multi["StanceSlot"]:SetHover( self.settings["Features"].stanceactive == 2 );
        end
end

function GuardianBars:BlockChange(tier, state)
        if (tier == 3) then
                self.skills["ShieldSmash"]:SetActive( state and self.settings["Features"].shieldsmash );
        end
end

function GuardianBars:ParryChange(tier, state)
    if (tier == 3) then
                self.skills["ToTheKing"]:SetActive( state and self.settings["Features"].totheking );
        end
end


function GuardianBars:DefaultSettings()
        self.settings = { };

        self.settings["Block"] = { };
        self.settings["Block"].active = true;
        self.settings["Block"].x = 0;
        self.settings["Block"].y = 0;

        self.settings["Parry"] = { };
        self.settings["Parry"].active = true;
        self.settings["Parry"].x = 0;
        self.settings["Parry"].y = 0;

        self.settings["Overpower"] = { };
        self.settings["Overpower"].active = true;
        self.settings["Overpower"].x = 0;
        self.settings["Overpower"].y = 0;

        self.settings["Ward"] = { };
        self.settings["Ward"].active = true;
        self.settings["Ward"].x = 0;
        self.settings["Ward"].y = 0;
        
        self.settings["Melee"] = { };
        self.settings["Melee"].active = true;
        self.settings["Melee"].x = 0;
        self.settings["Melee"].y = 0;

        self.settings["SelfBuffs"] = { };
        self.settings["SelfBuffs"].active = true;
        self.settings["SelfBuffs"].x = 0;
        self.settings["SelfBuffs"].y = 0;
        
        self.settings["Protect"] = { };
        self.settings["Protect"].active = true;
        self.settings["Protect"].x = 0;
        self.settings["Protect"].y = 0;

        self.settings["Taunt"] = { };
        self.settings["Taunt"].active = true;
        self.settings["Taunt"].x = 0;
        self.settings["Taunt"].y = 0;

        self.settings["Stances"] = { };
        self.settings["Stances"].active = true;
        self.settings["Stances"].x = 0;
        self.settings["Stances"].y = 0;

        self.settings["Stunned"] = { };
        self.settings["Stunned"].active = true;
        self.settings["Stunned"].x = 0;
        self.settings["Stunned"].y = 0;
        
        self.settings["Utility"] = { };
        self.settings["Utility"].active = true;
        self.settings["Utility"].x = 0;
        self.settings["Utility"].y = 0;
        
        self.settings["ClassItems"] = { };
        self.settings["ClassItems"].active = true;
        self.settings["ClassItems"].x = 0;
        self.settings["ClassItems"].y = 0;
        
        self.settings["Ranged"] = { };
        self.settings["Ranged"].active = true;
        self.settings["Ranged"].x = 0;
        self.settings["Ranged"].y = 0;
        
        self.settings["Features"] = { };
        self.settings["Features"].threatstance = false;
        self.settings["Features"].totheking = false;
        self.settings["Features"].darkness = false;
        self.settings["Features"].shieldsmash = false;
        self.settings["Features"].stancepriority = true;
        self.settings["Features"].primarystance = 1;
        self.settings["Features"].secondarystance = 3;
        self.settings["Features"].woundindicator = true;
        self.settings["Features"].stanceactive = 2;
        self.settings["Features"].wardactive = 4;
        
        
        self.settings["Quickslots"] = { };
        self.settings["Quickslots"].spike1 = {active = false, type = 0, data = "" }
        self.settings["Quickslots"].spike2 = {active = false, type = 0, data = "" }
        self.settings["Quickslots"].spike3 = {active = false, type = 0, data = "" }
        self.settings["Quickslots"].spike4 = {active = false, type = 0, data = "" }

end


function GuardianBars:UpdateSettings()
        if (settings.vers < 3.01) then
                
                if (self.settings["Features"].wardwarning) then self.settings["Features"].wardactive = 4; else self.settings["Features"].wardactive = 3; end
                if (self.settings["Features"].stancehover) then self.settings["Features"].stanceactive = 2; else if (self.settings["Features"].stancedisappear) then self.settings["Features"].stanceactive = 3; else self.settings["Features"].stanceactive = 1; end end
                
                self.settings["Features"].wardwarning = nil;
                self.settings["Features"].stancehover = nil;
                self.settings["Features"].stancedisappear = nil;
        end
        
        settings.vers = vars.vers;

end


function GuardianBars:ShowSetup()
        self.setup:SetVisible(true);

        self.setupbb.opacityslider:SetValue(settings.opacity * 100);
        self.setupbb.checkboxlock:SetChecked(settings.lockslots);
        self.setupbb.checkboxgrid:SetChecked(settings.snaptogrid);

        self.setupbb.checkboxbb1:SetText("Block Reactives");
        self.setupbb.checkboxbb1:SetChecked (self.settings["Block"].active);
        self.setupbb.checkboxbb1:SetVisible(true);
        self.setupbb.checkboxbb2:SetText("Parry Reactives");
        self.setupbb.checkboxbb2:SetChecked (self.settings["Parry"].active);
        self.setupbb.checkboxbb2:SetVisible(true);
        self.setupbb.checkboxbb3:SetText("Overpower Skills");
        self.setupbb.checkboxbb3:SetChecked (self.settings["Overpower"].active);
        self.setupbb.checkboxbb3:SetVisible(true);
        self.setupbb.checkboxbb4:SetText("Guardians Ward");
        self.setupbb.checkboxbb4:SetChecked (self.settings["Ward"].active);
        self.setupbb.checkboxbb4:SetVisible(true);
        self.setupbb.checkboxbb5:SetText("Melee Skills");
        self.setupbb.checkboxbb5:SetChecked (self.settings["Melee"].active);
        self.setupbb.checkboxbb5:SetVisible(true);
        self.setupbb.checkboxbb6:SetText("Self Buffs");
        self.setupbb.checkboxbb6:SetChecked (self.settings["SelfBuffs"].active);
        self.setupbb.checkboxbb6:SetVisible(true);
        self.setupbb.checkboxbb7:SetText("Protect Fellows");
        self.setupbb.checkboxbb7:SetChecked (self.settings["Protect"].active);
        self.setupbb.checkboxbb7:SetVisible(true);
        self.setupbb.checkboxbb8:SetText("Taunt");
        self.setupbb.checkboxbb8:SetChecked (self.settings["Taunt"].active);
        self.setupbb.checkboxbb8:SetVisible(true);
        self.setupbb.checkboxbb9:SetText("Stances");
        self.setupbb.checkboxbb9:SetChecked (self.settings["Stances"].active);
        self.setupbb.checkboxbb9:SetVisible(true);
        self.setupbb.checkboxbb10:SetText("Stunned");
        self.setupbb.checkboxbb10:SetChecked (self.settings["Stunned"].active);
        self.setupbb.checkboxbb10:SetVisible(true);
        self.setupbb.checkboxbb11:SetText("Utility");
        self.setupbb.checkboxbb11:SetChecked (self.settings["Utility"].active);
        self.setupbb.checkboxbb11:SetVisible(true);
        self.setupbb.checkboxbb12:SetText("Class Items");
        self.setupbb.checkboxbb12:SetChecked (self.settings["ClassItems"].active);
        self.setupbb.checkboxbb12:SetVisible(true);
        self.setupbb.checkboxbb13:SetText("Ranged");
        self.setupbb.checkboxbb13:SetChecked (self.settings["Ranged"].active);
        self.setupbb.checkboxbb13:SetVisible(true);

        self.setupf.checkboxf1:SetText("Guardian's Threat");
        self.setupf.checkboxf1:SetChecked (self.settings["Features"].threatstance);
        self.setupf.checkboxf1:SetVisible(true);
        self.setupf.checkboxf2:SetText("Shield Smash");
        self.setupf.checkboxf2:SetChecked (self.settings["Features"].shieldsmash);
        self.setupf.checkboxf2:SetVisible(true);
        self.setupf.checkboxf3:SetText("To The King");
        self.setupf.checkboxf3:SetChecked (self.settings["Features"].totheking);
        self.setupf.checkboxf3:SetVisible(true);
        self.setupf.checkboxf4:SetText("Challenge The Darkness");
        self.setupf.checkboxf4:SetChecked (self.settings["Features"].darkness);
        self.setupf.checkboxf4:SetVisible(true);
        
        self.setupf.checkboxf10:SetText("Stance Priority");
        self.setupf.checkboxf10:SetChecked (self.settings["Features"].stancepriority);
        self.setupf.checkboxf10:SetVisible(true);
        
        self.setupf.checkboxf11:SetText("Wound Indicator");
        self.setupf.checkboxf11:SetChecked (self.settings["Features"].woundindicator);
        self.setupf.checkboxf11:SetVisible(true);
        
        self.setupf.combo1box.listBox:ClearItems();
        self.setupf.combo1Label:SetText("Guardian's Ward Active");
        self.setupf.combo1Label:SetVisible(true);
        local combolist = {"None", "Dim", "Hide", "Early Warning"}
        for k,v in pairs(combolist) do
                self.setupf.combo1box:AddItem(v, k);
        end
        self.setupf.combo1box:SetVisible(true);
        self.setupf.combo1box:SetSelection(self.settings["Features"].wardactive);
        
        self.setupf.combo2box.listBox:ClearItems();
        self.setupf.combo2Label:SetText("Primary Stance");
        self.setupf.combo2Label:SetVisible(true);
        local combolist = {"Guardian's Defence", "Guardian's Parry", "Overpower", "Threat"}
        for k,v in pairs(combolist) do
            self.setupf.combo2box:AddItem(v, k);
        end
        self.setupf.combo2box:SetVisible(true);
        self.setupf.combo2box:SetSelection(self.settings["Features"].primarystance);
        
        self.setupf.combo3box.listBox:ClearItems();
        self.setupf.combo3Label:SetText("Secondary Stance");
        self.setupf.combo3Label:SetVisible(true);
        local combolist = {"Guardian's Defence", "Guardian's Parry", "Overpower", "Threat"}
        for k,v in pairs(combolist) do
            self.setupf.combo3box:AddItem(v, k);
        end
        self.setupf.combo3box:SetVisible(true);
    self.setupf.combo3box:SetSelection(self.settings["Features"].secondarystance);
        
        self.setupf.combo4box.listBox:ClearItems();
        self.setupf.combo4Label:SetText("Stance Active");
        self.setupf.combo4Label:SetVisible(true);
        local combolist = {"None", "Dim", "Hide"}
        for k,v in pairs(combolist) do
                self.setupf.combo4box:AddItem(v, k);
        end
        self.setupf.combo4box:SetVisible(true);
        self.setupf.combo4box:SetSelection(self.settings["Features"].stanceactive);

        self.setupqs.quickslot1:SetVisible(true);
    pcall(function() self.setupqs.quickslot1:SetShortcut(Turbine.UI.Lotro.Shortcut( self.settings["Quickslots"].spike1["type"], self.settings["Quickslots"].spike1["data"] ) ); end);
        self.setupqs.quickslot1cb:SetText("Shield Spikes");
        self.setupqs.quickslot1cb:SetChecked(self.settings["Quickslots"].spike1["active"]);
        self.setupqs.quickslot1cb:SetVisible(true);
        self.setupqs.quickslot2:SetVisible(true);
    pcall(function() self.setupqs.quickslot2:SetShortcut(Turbine.UI.Lotro.Shortcut( self.settings["Quickslots"].spike2["type"], self.settings["Quickslots"].spike2["data"] ) ); end);
        self.setupqs.quickslot2cb:SetText("Shield Spikes");
        self.setupqs.quickslot2cb:SetChecked(self.settings["Quickslots"].spike2["active"]);
        self.setupqs.quickslot2cb:SetVisible(true);
        self.setupqs.quickslot3:SetVisible(true);
    pcall(function() self.setupqs.quickslot3:SetShortcut(Turbine.UI.Lotro.Shortcut( self.settings["Quickslots"].spike3["type"], self.settings["Quickslots"].spike3["data"] ) ); end);
        self.setupqs.quickslot3cb:SetText("Shield Spikes");
        self.setupqs.quickslot3cb:SetChecked(self.settings["Quickslots"].spike3["active"]);
        self.setupqs.quickslot3cb:SetVisible(true);
        self.setupqs.quickslot4:SetVisible(true);
    pcall(function() self.setupqs.quickslot4:SetShortcut(Turbine.UI.Lotro.Shortcut( self.settings["Quickslots"].spike4["type"], self.settings["Quickslots"].spike4["data"] ) ); end);
        self.setupqs.quickslot4cb:SetText("Shield Spikes");
        self.setupqs.quickslot4cb:SetChecked(self.settings["Quickslots"].spike4["active"]);
        self.setupqs.quickslot4cb:SetVisible(true);


end


function GuardianBars:SetupClosing()
        settings.opacity = self.setupbb.opacityslider:GetValue() / 100;
        settings.lockslots = self.setupbb.checkboxlock:IsChecked();
        settings.snaptogrid = self.setupbb.checkboxgrid:IsChecked();

        self.settings["Block"].active = self.setupbb.checkboxbb1:IsChecked();
    self.settings["Parry"].active = self.setupbb.checkboxbb2:IsChecked();
    self.settings["Overpower"].active = self.setupbb.checkboxbb3:IsChecked();
    self.settings["Ward"].active = self.setupbb.checkboxbb4:IsChecked();
        self.settings["Melee"].active = self.setupbb.checkboxbb5:IsChecked();
    self.settings["SelfBuffs"].active = self.setupbb.checkboxbb6:IsChecked();
    self.settings["Protect"].active = self.setupbb.checkboxbb7:IsChecked();
    self.settings["Taunt"].active = self.setupbb.checkboxbb8:IsChecked();
    self.settings["Stances"].active = self.setupbb.checkboxbb9:IsChecked();
    self.settings["Stunned"].active = self.setupbb.checkboxbb10:IsChecked();
    self.settings["Utility"].active = self.setupbb.checkboxbb11:IsChecked();
    self.settings["ClassItems"].active = self.setupbb.checkboxbb12:IsChecked();
    self.settings["Ranged"].active = self.setupbb.checkboxbb13:IsChecked();

        self.settings["Features"].threatstance = self.setupf.checkboxf1:IsChecked();
    self.settings["Features"].shieldsmash = self.setupf.checkboxf2:IsChecked();
    self.settings["Features"].totheking = self.setupf.checkboxf3:IsChecked();
    self.settings["Features"].darkness = self.setupf.checkboxf4:IsChecked();
    
    self.settings["Features"].stancepriority = self.setupf.checkboxf10:IsChecked();
    self.settings["Features"].woundindicator = self.setupf.checkboxf11:IsChecked();
    
    self.settings["Features"].wardactive = self.setupf.combo1box:GetSelection();
        self.settings["Features"].primarystance = self.setupf.combo2box:GetSelection();
    self.settings["Features"].secondarystance = self.setupf.combo3box:GetSelection();
    self.settings["Features"].stanceactive = self.setupf.combo4box:GetSelection();
    
    self.settings["Quickslots"].spike1 = { active = self.setupqs.quickslot1cb:IsChecked(), type = self.setupqs.quickslot1:GetShortcut():GetType(), data = self.setupqs.quickslot1:GetShortcut():GetData() };
    self.settings["Quickslots"].spike2 = { active = self.setupqs.quickslot2cb:IsChecked(), type = self.setupqs.quickslot2:GetShortcut():GetType(), data = self.setupqs.quickslot2:GetShortcut():GetData() };
    self.settings["Quickslots"].spike3 = { active = self.setupqs.quickslot3cb:IsChecked(), type = self.setupqs.quickslot3:GetShortcut():GetType(), data = self.setupqs.quickslot3:GetShortcut():GetData() };
    self.settings["Quickslots"].spike4 = { active = self.setupqs.quickslot4cb:IsChecked(), type = self.setupqs.quickslot4:GetShortcut():GetType(), data = self.setupqs.quickslot4:GetShortcut():GetData() };

        self:SaveSettings();
        self:Refresh();

end


function GuardianBars:Refresh()

        self:RefreshBars();
        
        self.skills["GuardiansWard"]:SetActive( true );
        if (self.settings["Features"].wardactive == 2) then
                self.skills["GuardiansWard"]:SetHover( self.skills["GuardiansWard"].state );
        elseif (self.settings["Features"].wardactive >= 3) then
                self.skills["GuardiansWard"]:SetActive( not self.skills["GuardiansWard"].state );
        end
                
        -- Set State on Legendary Skills
        self.skills["ShieldSmash"]:SetActive(self.settings["Features"].shieldsmash and vars.classattr:IsBlockTier3Available());
        self.skills["ToTheKing"]:SetActive(self.settings["Features"].totheking and vars.classattr:IsParryTier3Available());
        self.skills["ChallengeTheDarkness"]:SetActive(self.settings["Features"].darkness);

        -- Re-Build Stance Slot (Multi)
        self.multi["StanceSlot"]:Clear();
        self.multi["StanceSlot"]:AddShortCut("GuardiansDefence",         4, "0x70003EDF");
    self.multi["StanceSlot"]:AddShortCut("GuardiansParry",              12, "0x70003EE3");
    self.multi["StanceSlot"]:AddShortCut("Overpower",                   30, "0x7000D4B1");
    if (self.settings["Features"].threatstance) then self.multi["StanceSlot"]:AddShortCut("GuardiansThreat",    41, "0x70002ED4"); end
    self.multi["StanceSlot"]:LevelCheck();
    
    self.multi["ShieldSpikes"]:Clear();
        self.multi["ShieldSpikes"]:AddShortCut("Spike1",        self.settings["Quickslots"].spike1["active"], self.settings["Quickslots"].spike1["type"], self.settings["Quickslots"].spike1["data"]);
        self.multi["ShieldSpikes"]:AddShortCut("Spike2",        self.settings["Quickslots"].spike2["active"], self.settings["Quickslots"].spike2["type"], self.settings["Quickslots"].spike2["data"]);
        self.multi["ShieldSpikes"]:AddShortCut("Spike3",        self.settings["Quickslots"].spike3["active"], self.settings["Quickslots"].spike3["type"], self.settings["Quickslots"].spike3["data"]);
    self.multi["ShieldSpikes"]:AddShortCut("Spike4",    self.settings["Quickslots"].spike4["active"], self.settings["Quickslots"].spike4["type"], self.settings["Quickslots"].spike4["data"]);
    self.multi["ShieldSpikes"]:Refresh();
    
    if (self.settings["Features"].woundindicator and self.wound > 0) then
                self.skills["IgnoreThePain"]:SetColor("red");
        else
                self.skills["IgnoreThePain"]:SetColor();
        end
    
        self:StanceChange(vars.classattr:GetStance());
        self:CombatChange(vars.player:IsInCombat());

        Turbine.Shell.WriteLine("KragenBars: Guardian Bars refresh completed successfully.");

end

Go to most recent revision | Compare with Previous | Blame


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


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