lotrointerface.com
Search Downloads

LoTROInterface SVN KragenBars

[/] [trunk/] [KragenPlugs/] [KragenBars/] [GuardianBars.lua] - Rev 133

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 SPECIFIC VARIABLES
    self.wound = 0;
        
        self.effectlist = {};
        self.effectlist['GuardiansWard'] = Effect();
        self.effectlist['GuardiansWardTactics'] = Effect();
        self.effectlist['ImprovedGuardiansWard'] = Effect();
        self.effectlist['ImprovedGuardiansWardTactics'] = Effect();
        self.effectlist['BlockResponse'] = Effect();
        self.effectlist['ShieldSwipe'] = Effect();
        self.effectlist['ParryResponse'] = Effect();
        self.effectlist['Retaliation'] = Effect();
        self.effectlist['Stunned'] = Effect();
        self.effectlist['Dazed'] = Effect();
        self.effectlist['KnockedDown'] = Effect();
        self.effectlist['Overpower'] = Effect();
        self.effectlist['Campsite'] = Effect();
        self.effectlist['ShieldSpikes'] = Effect();
        
        -- DEFINE THE EFFECT LIST BASED ON CLIENT LANGUAGE
        self.DefineEffectList = function()
                -- ENGLISH CLIENT
                if (settings.language == 1) then
                        self.effectlist['GuardiansWard']                        :SetName("Guardian's Ward");
                        self.effectlist['ImprovedGuardiansWard']        :SetName("Improved Guardian's Ward");
                        self.effectlist['GuardiansWardTactics']         :SetName("Guardian's Ward Tactics");
                        self.effectlist['ImprovedGuardiansWardTactics'] :SetName("Improved Guardian's Ward Tactics");
                        self.effectlist['BlockResponse']                        :SetName('Block Response');
                        self.effectlist['ShieldSwipe']                          :SetName('Shield Swipe');
                        self.effectlist['ParryResponse']                        :SetName('Parry Response');
                        self.effectlist['Retaliation']                          :SetName('Retaliation');
                        self.effectlist['Stunned']                                      :SetName('Stunned');
                        self.effectlist['Dazed']                                        :SetName('Dazed');      
                        self.effectlist['KnockedDown']                          :SetName('Knocked Down');
                        self.effectlist['Overpower']                            :SetName('Overpower');
                        self.effectlist['Campsite']                             :SetName('Campsite');
                        self.effectlist['ShieldSpikes']                         :SetName(' Spike');

                -- FRENCH CLIENT
                elseif (vars.locale == 'fr') then
                        self.effectlist['GuardiansWard']                        :SetName('Protection de gardien');
                        self.effectlist['ImprovedGuardiansWard']        :SetName('Protection de gardien améliorée');
                        self.effectlist['GuardiansWardTactics']         :SetName("Guardian's Ward Tactics");
                        self.effectlist['ImprovedGuardiansWardTactics'] :SetName("Improved Guardian's Ward Tactics");
                        self.effectlist['BlockResponse']                        :SetName('Block Response');
                        self.effectlist['ShieldSwipe']                          :SetName('Balayage au bouclier');
                        self.effectlist['ParryResponse']                        :SetName('Réaction de parade');
                        self.effectlist['Retaliation']                          :SetName('Riposte');
                        self.effectlist['Stunned']                                      :SetName('Etourdi');
                        self.effectlist['Dazed']                                        :SetName('Hébété');
                        self.effectlist['KnockedDown']                          :SetName('Renversé');
                        self.effectlist['Overpower']                            :SetName('Surpuissance');
                        self.effectlist['Campsite']                             :SetName('Campsite');
                        self.effectlist['ShieldSpikes']                         :SetName(' Spike');
                        
                -- GERMAN CLIENT
                elseif (vars.locale == 'de') then
                        self.effectlist['GuardiansWard']                        :SetName('Wächterschild');
                        self.effectlist['ImprovedGuardiansWard']        :SetName('Verbesserung: Wächterschild');
                        self.effectlist['GuardiansWardTactics']         :SetName("Guardian's Ward Tactics");
                        self.effectlist['ImprovedGuardiansWardTactics'] :SetName("Improved Guardian's Ward Tactics");
                        self.effectlist['BlockResponse']                        :SetName('Block Response');
                        self.effectlist['ShieldSwipe']                          :SetName('Schildstreich');
                        self.effectlist['ParryResponse']                        :SetName('Erwiderung "Parade"');
                        self.effectlist['Retaliation']                          :SetName('Vergeltung');
                        self.effectlist['Stunned']                                      :SetName('Bewusstlos geschlagen');
                        self.effectlist['Dazed']                                        :SetName('Benommenheit');
                        self.effectlist['KnockedDown']                          :SetName('Zu Boden geschlagen');
                        self.effectlist['Overpower']                            :SetName('Überwältigen');
                        self.effectlist['Campsite']                             :SetName('Lagerplatz');
                        self.effectlist['ShieldSpikes']                         :SetName(' Spike');
                end
        end
    
        
        -- BUILD WINDOWS BARS SKILLS AND MULTIS --
        
    -- Build Bars
    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"], 1, 1, 2, 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, 1, 1, true, true);
    

        -- Build Skills
    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");
    
    if (vars.playerlevel >= 70) then
                self.skills["WhirlingRetaliation"]      = SkillSlot(self.bars["ParryTier1"],1, 1, false, { 14, 70 }, { "0x70003EE4", "0x7002845C" });
        end
    self.skills["Retaliation"]                  = SkillSlot(self.bars["ParryTier1"],    2, 1, false, 8, "0x70003EE0");
    
        if (vars.playerlevel < 70) then
                self.skills["WhirlingRetaliation"]      = SkillSlot(self.bars["ParryTier2"],1, 1, false, { 14, 70 }, { "0x70003EE4", "0x7002845C" });
        end
    self.skills["Overwhelm"]                    = SkillSlot(self.bars["ParryTier2"],    2, 1, false, { 8, 68 }, { "0x70003EE2", "0x70028414" });
        self.skills["Thrust"]                           = SkillSlot(self.bars["ParryTier2"],    3, 1, false, 18, "0x70003EE5");
    
        self.skills["ToTheKing"]                        = SkillSlot(self.bars["ParryTier3"],    1, 1, false, 41, "0x70002EA5");
    
    self.skills["GuardiansWard"]                = SkillSlot(self.bars["Ward"],                  1, 1, true, { 1, 66 }, { "0x70003066", "0x700283E7" });
        
    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["SaltTheWound"]                     = SkillSlot(self.bars["Melee"],                 5, 1, true, 22, "0x7000D4AF");
    self.skills["Stamp"]                                = SkillSlot(self.bars["Melee"],                 6, 1, true, 32, "0x70003EE7");
        self.skills["TakeToHeart"]                      = SkillSlot(self.bars["Melee"],                 7, 1, true, 58, "0x7000ED87");

    self.skills["Challenge"]                    = SkillSlot(self.bars["Taunt"],                 1, 1, true, { 16, 74 }, { "0x70003097", "0x70028B62" });
    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.traits["ChallengeTheDarkness"].active, 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, 72 }, { "0x70003EE8", "0x70028B82" });
    
    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");
        
        self.skills["OverpowerTactics"]         = ItemSlot(self.bars["ClassItems"],     1, 1, false, self.settings.quickslots["Tactics"]);

    
        -- Build Stance Slot        
        self.multi["StanceSlot"]           = SkillMultiSlot(self.bars["Stances"], 1, 1, true);
        if (vars.playerlevel >= 74) then
                self.multi["StanceSlot"]:AddShortCut("GuardiansDefence",         74, "0x70028510");
        else
                self.multi["StanceSlot"]:AddShortCut("GuardiansDefence",         4, "0x70003EDF");
        end
    self.multi["StanceSlot"]:AddShortCut("GuardiansParry",              12, "0x70003EE3");
    self.multi["StanceSlot"]:AddShortCut("Overpower",                   10, "0x7000D4B1");
    if (self.settings.traits["ThreatStance"].active) then self.multi["StanceSlot"]:AddShortCut("GuardiansThreat",       41, "0x70002ED4"); end
    self.multi["StanceSlot"]:LevelCheck();
        
        -- Build Spike Slot
        self.multi["ShieldSpikes"]           = ItemMultiSlot(self.bars["ClassItems"], 1, 1, true);
        self.multi["ShieldSpikes"]:AddShortCut("Spikes1", self.settings.quickslots["Spike1"]);
    self.multi["ShieldSpikes"]:AddShortCut("Spikes2", self.settings.quickslots["Spike2"]);
    self.multi["ShieldSpikes"]:AddShortCut("Spikes3", self.settings.quickslots["Spike3"]);
        self.multi["ShieldSpikes"]:AddShortCut("Spikes4", self.settings.quickslots["Spike4"]);
        self.multi["ShieldSpikes"]:Refresh(true);
        
        -- SET COMBAT STATES
        self.skills["ThrillOfDanger"]:SetCombat( true, false );
        self.skills["GuardiansPromise"]:SetCombat( false, true );
        self.skills["SummonTinker"]:SetCombat( false, true );
        
        -- ITEM MANAGER
        --self.itemmanager = ItemManager();
        --self.itemmanager:RegisterItem("spike Kit", { "Expert","Resiliant Expert","Artisan","Resiliant Artisan","Master","Resiliant Master","Supreme","Resiliant Supreme","Basic","Resiliant Basic","Improved","Resiliant Improved","Sharp","Resiliant Sharp","Deadly","Resiliant Deadly","Lethal","Resiliant Lethal" }, {"Recipe"}, self.skills["ShieldSpikes"]);
        --self.itemmanager:RegisterItem("Overpower Tactic", { "Journeyman","Skillful Journeyman","Expert","Skillful Expert","Artisan","Skillful Artisan","Master","Skillful Master","Supreme","Skillful Supreme" }, {"Recipe"}, self.skills["OverpowerTactics"]);
        --self.itemmanager:ParseItems();
        
        -- CLASS SPECIFIC SETUP/DEFAULT CODE
        self.windows["Overpower"]:SetZOrder(-10);
        self.windows["Block"]:SetZOrder(0);
        
        -- CLASS SPECIFIC EVENTS
        
        -- Stance Changed Event
        AddCallback(vars.classattr, "StanceChanged", function(sender, args)
                KragenBars:StanceChange(vars.classattr:GetStance());
        end);
        
        -- Block Changed Event
        AddCallback(vars.classattr, "IsBlockTier3AvailableChanged", function(sender, args)
                KragenBars:BlockChange(3, vars.classattr:IsBlockTier3Available());
        end);
        
        -- Parry Changed Event
        AddCallback(vars.classattr, "IsParryTier3AvailableChanged", function(sender, args)
                KragenBars:ParryChange(3, vars.classattr:IsParryTier3Available());
        end);

        if (vars.playerlevel >= 70) then
                self.skills["WhirlingRetaliation"]:SetParent(self.bars["ParryTier1"]);
                self.skills["WhirlingRetaliation"]:SetPosition(0,0);
        else
                self.skills["WhirlingRetaliation"]:SetParent(self.bars["ParryTier2"]);
                self.skills["WhirlingRetaliation"]:SetPosition(0,0);
        end
        
        -- INITIALIZE BARS
        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


-- ADD EFFECT EVENT
function GuardianBars:AddEffect( effectIndex )
        local effect = vars.player:GetEffects():Get( effectIndex );
        local effectname = effect:GetName();
        local effectid = effect:GetID();

        -- Guardian's Ward
        if (effectname == self.effectlist["GuardiansWard"]:GetName() or effectname == self.effectlist["ImprovedGuardiansWard"]:GetName() or effectname == self.effectlist["GuardiansWardTactics"]:GetName() or effectname == self.effectlist["ImprovedGuardiansWardTactics"]:GetName()) then
        if (self.effectlist["GuardiansWard"]:SetState( true , effectid)) then
                        self.skills["GuardiansWard"]:SetActive(self.settings.defaults["WardActive"].selected < 3);
                        if (self.settings.defaults["WardActive"].selected == 2) then
                                self.skills["GuardiansWard"]:SetHover( true );
                        elseif (self.settings.defaults["WardActive"].selected == 4) then
                                self.skills["GuardiansWard"]:StartTimer( effect:GetDuration() * .70, true );
                        end
                end
                
        elseif (effectname == self.effectlist["BlockResponse"]:GetName()) then
                if (self.effectlist["BlockResponse"]:SetState( true, effectid)) then
                        if (not self.effectlist["ShieldSwipe"]:GetState()) 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
                end
                
    elseif (effectname == self.effectlist["ShieldSwipe"]:GetName()) then
                if (self.effectlist["ShieldSwipe"]:SetState( true, effectid)) then
                        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);
                end
                
        elseif (effectname == self.effectlist["ParryResponse"]:GetName()) then
                if (self.effectlist["ParryResponse"]:SetState( true, effectid)) then
                        if (not self.effectlist["Retaliation"]:GetState()) then
                                self.skills["Retaliation"]:SetActive( true );
                                if (vars.playerlevel >= 70) then
                                        self.skills["WhirlingRetaliation"]:SetActive(true);
                                end
                                self.bars["ParryTier1"]:SetZOrder(0);
                                self.bars["ParryTier2"]:SetZOrder(-10);
                        end
                end
                
    elseif (effectname == self.effectlist["Retaliation"]:GetName()) then
                if (self.effectlist["Retaliation"]:SetState( true, effectid)) then
                        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 );
                        if (vars.playerlevel < 70) then
                                self.skills["WhirlingRetaliation"]:SetActive( true );
                        end
                end

        -- Stunned, Dazed, Knocked Down
        elseif (effectname == self.effectlist["Stunned"]:GetName() or effectname == self.effectlist["Dazed"]:GetName() or effectname == self.effectlist["KnockedDown"]:GetName()) then
        if (self.effectlist["Stunned"]:SetState( true , effectid)) then
                        self.skills["TurnTheTables"]:SetActive( true );
                end

        -- Stance Change
        elseif (effectname == self.effectlist["Overpower"]:GetName()) then
                if (self.effectlist["Overpower"]:SetState( true, effectid )) then
                        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["OverpowerTactics"]:SetActive( true );
                        self.skills["OverpowerTactics"]:SetZOrder( 0 );
                        self.skills["ShieldBlow"]:SetActive( false );
                        self.skills["ShieldWall"]:SetActive( false );
                        self.multi["ShieldSpikes"]:SetActive( false );
                        self.multi["ShieldSpikes"]:SetZOrder( -10 );
                end
                
        elseif (effectname == self.effectlist["Campsite"]:GetName()) then
                if (self.effectlist["Campsite"]:SetState( true, effectid )) then
                        self.skills["SummonTinker"]:SetActive( true );
                end
                
    elseif (string.find(effectname, self.effectlist["ShieldSpikes"]:GetName()) ~= nil ) then
                if (self.effectlist["ShieldSpikes"]:SetState( true, effectid )) then
                        self.multi["ShieldSpikes"]:SetHover(true);
                end
                
        -- Wound
        elseif (effect:GetCategory() == Turbine.Gameplay.EffectCategory.Wound ) then
                self.wound = self.wound + 1;
                if (settings.skilldata["IgnoreThePain"].parent ~= nil and vars.playerlevel >= self.skills["IgnoreThePain"].level[1] and self.settings.features["WoundIndicator"].active) then
                        if (self.settings.userconf[settings.skilldata["IgnoreThePain"].parent].active) then
                                self.skills["IgnoreThePain"]:SetColor("red");
                        end
                end
                
    end
end

-- REMOVE EFFECT EVENT
function GuardianBars:RemoveEffect( effect )
        local effectname = effect:GetName();
        local effectid = effect:GetID();
        
        -- Guardian's Ward
        if (effectname == self.effectlist["GuardiansWard"]:GetName() or effectname == self.effectlist["ImprovedGuardiansWard"]:GetName() or effectname == self.effectlist["GuardiansWardTactics"]:GetName() or effectname == self.effectlist["ImprovedGuardiansWardTactics"]:GetName()) then
        if (not self.effectlist["GuardiansWard"]:SetState( false, effectid)) then
                self.skills["GuardiansWard"]:SetActive( true );
                        self.skills["GuardiansWard"]:SetHover( false );
                end
        
    elseif (effectname == self.effectlist["BlockResponse"]:GetName()) then
                if (not self.effectlist["BlockResponse"]:SetState( false, effectid )) then
                        self.skills["ShieldSwipe"]:SetActive(false);
                        self.skills["CatchABreath"]:SetActive(false);
                        self.skills["LitanyOfDefiance"]:SetActive(false);
                end
                
    elseif (effectname == self.effectlist["ShieldSwipe"]:GetName()) then
        if (not self.effectlist["ShieldSwipe"]:SetState( false, effectid )) then
                        self.skills["ShieldTaunt"]:SetActive(false);
                        self.skills["ShieldBash"]:SetActive(false);
                        if (self.effectlist["BlockResponse"]:GetState()) 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 (effectname == self.effectlist["ParryResponse"]:GetName()) then
                if (not self.effectlist["ParryResponse"]:SetState( false, effectid )) then
                        self.skills["Retaliation"]:SetActive(false);
                        if (vars.playerlevel >= 70) then
                                self.skills["WhirlingRetaliation"]:SetActive(false);
                        end
                end
                
    elseif (effectname == self.effectlist["Retaliation"]:GetName()) then
        if (not self.effectlist["Retaliation"]:SetState( false, effectid )) then
                        self.skills["Overwhelm"]:SetActive(false);
                        self.skills["Thrust"]:SetActive(false);
                        if (vars.playerlevel < 70) then
                                self.skills["WhirlingRetaliation"]:SetActive(false);
                        end
                        if (self.effectlist["ParryResponse"]:GetState()) then
                                self.skills["Retaliation"]:SetActive(true);
                                if (vars.playerlevel >= 70) then
                                        self.skills["WhirlingRetaliation"]:SetActive(true);
                                end
                                self.bars["ParryTier1"]:SetZOrder(0);
                                self.bars["ParryTier2"]:SetZOrder(-10);
                        end
                end

        -- Stunned, Dazed or Knocked Down
        elseif (effectname == self.effectlist["Stunned"]:GetName() or effectname == self.effectlist["Dazed"]:GetName() or effectname == self.effectlist["KnockedDown"]:GetName()) then
        if (not self.effectlist["Stunned"]:SetState( false , effectid )) then
                        self.skills["TurnTheTables"]:SetActive( false );
                end

    -- Overpower
        elseif (effectname == self.effectlist["Overpower"]:GetName()) then
                if (not self.effectlist["Overpower"]:SetState( false, effectid )) 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["OverpowerTactics"]:SetActive( false );
                        self.skills["OverpowerTactics"]:SetZOrder( -10 );
                        self.skills["ShieldBlow"]:SetActive( true );
                        self.skills["ShieldWall"]:SetActive( true );
                        self.multi["ShieldSpikes"]:SetActive( true );
                        self.multi["ShieldSpikes"]:SetZOrder( 0 );
                end
                
        -- Summon Tinker Available      
        elseif (effectname == self.effectlist["Campsite"]:GetName()) then
                if (not self.effectlist["Campsite"]:SetState(false, effectid )) then
                        self.skills["SummonTinker"]:SetActive( false );
                end
        
        -- Shield Spikes Used
    elseif (string.find(effectname, self.effectlist["ShieldSpikes"]:GetName()) ~= nil ) then
                if (not self.effectlist["ShieldSpikes"]:SetState(false, effectid )) then
                        self.multi["ShieldSpikes"]:SetHover(false);
                end
                
        -- 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


-- STANCE CHANGED EVENT
function GuardianBars:StanceChange(stance)      
        -- PRIMARY STANCE SWITCHING
        if (self.settings.features["StancePriority"].active) then

                local newstance = 0;

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

                if (newstance == self.settings.defaults["PrimaryStance"].selected) then
                        self.multi["StanceSlot"]:SetIndex(self.settings.defaults["SecondaryStance"].selected);
                else
                    self.multi["StanceSlot"]:SetIndex(self.settings.defaults["PrimaryStance"].selected);
                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.defaults["StanceActive"].selected ~= 3);
        self.multi["StanceSlot"]:SetHover( self.settings.defaults["StanceActive"].selected == 2 );
        end
end

-- BLOCK CHANGED EVENT
function GuardianBars:BlockChange(tier, state)
        if (tier == 3) then
                self.skills["ShieldSmash"]:SetActive( state and self.settings.traits["ShieldSmash"].active );
        end
end

-- PARRY CHANGED EVENT
function GuardianBars:ParryChange(tier, state)
    if (tier == 3) then
                self.skills["ToTheKing"]:SetActive( state and self.settings.traits["ToTheKing"].active );
        end
end

-- DEFAULT SETTINGS
function GuardianBars:DefaultSettings()
        self.settings = { preconf = { }, userconf = { }, traits = { }, features = { }, defaults = { }, quickslots = { } };
        
        self.settings.preconf["Block"]                  = { id = 1,     name = "Block Reactives",       defpos = {1,3},         size={4,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.preconf["Parry"]                  = { id = 2,     name = "Parry Reactives",       defpos = {1,2},         size={4,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.preconf["Overpower"]              = { id = 3,     name = "Overpower",             defpos = {1,3},         size={3,1}, pos = {0,0}, combat = {true,true}, active = true };
        
        self.settings.userconf["Ward"]                  = { id = 4,     name = "Ward",                          defpos = {1,4},         size={1,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Melee"]                 = { id = 5,     name = "Melee",                         defpos = {2,4},         size={7,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Taunt"]                 = { id = 6,     name = "Taunt",                         defpos = {6,3},         size={4,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["SelfBuffs"]     = { id = 7,     name = "Self Buffs",            defpos = {1,1},         size={6,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Protect"]               = { id = 8,     name = "Protect",                       defpos = {6,2},         size={2,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Stances"]               = { id = 9,     name = "Stances",                       defpos = {12,3},        size={1,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Stunned"]               = { id = 10,    name = "Stunned",                       defpos = {12,2},        size={1,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Utility"]               = { id = 11,    name = "Utility",                       defpos = {8,1},         size={2,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Ranged"]                = { id = 12,    name = "Ranged",                        defpos = {12,4},        size={1,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["ClassItems"]    = { id = 13,    name = "Class Items",           defpos = {12,1},        size={1,1}, pos = {0,0}, combat = {true,true}, active = true };
        
        self.settings.traits["ToTheKing"]                               = { id = 1, name = 'To The King', active = false };
        self.settings.traits["ShieldSmash"]                     = { id = 2, name = 'Shield Smash', active = false };
        self.settings.traits["ThreatStance"]                    = { id = 3, name = 'Threat Stance', active = false };
        self.settings.traits["ChallengeTheDarkness"]    = { id = 4, name = 'Challenge The Darkness', active = false };

        self.settings.features["StancePriority"] = { id = 1, name = 'Stance Priority', active = true };
        self.settings.features["WoundIndicator"] = { id = 2, name = 'Wound Indicator', active = true };
        
        self.settings.defaults["PrimaryStance"]         = { id = 1, name = 'Primary Stance', selected = 1, list = { "Guardian's Defence", "Guardian's Parry", "Overpower", "Threat" } };
        self.settings.defaults["SecondaryStance"]       = { id = 2, name = 'Secondary Stance', selected = 3, list = { "Guardian's Defence", "Guardian's Parry", "Overpower", "Threat" } };
        self.settings.defaults["StanceActive"]          = { id = 3, name = 'Stance Active', selected = 2, list = { "None", "Dim", "Hide" } };
        self.settings.defaults["WardActive"]            = { id = 4, name = 'Guardians Ward Active', selected = 4, list = { "None", "Dim", "Hide", "Early Warning" } };
        
        self.settings.quickslots["Spike1"]              = {id = 1, name = "Shield Spikes 1", active = false, type = 0, data = ""};
        self.settings.quickslots["Spike2"]              = {id = 2, name = "Shield Spikes 2", active = false, type = 0, data = ""};
        self.settings.quickslots["Spike3"]              = {id = 3, name = "Shield Spikes 3", active = false, type = 0, data = ""};
        self.settings.quickslots["Spike4"]              = {id = 4, name = "Shield Spikes 4", active = false, type = 0, data = ""};
        self.settings.quickslots["Tactics"]             = {id = 5, name = "Overpower Tactics", active = false, type = 0, data = ""};

end

-- UPDATE SETTINGS
function GuardianBars:UpdateSettings()
        if (settings.vers < 3.01) then
                
                if (self.settings["Features"].wardwarning) then self.settings.defaults["WardActive"].selected = 4; else self.settings.defaults["WardActive"].selected = 3; end
                if (self.settings["Features"].stancehover) then self.settings.defaults["StanceActive"].selected = 2; else if (self.settings["Features"].stancedisappear) then self.settings.defaults["StanceActive"].selected = 3; else self.settings.defaults["StanceActive"].selected = 1; end end
                
                self.settings["Features"].wardwarning = nil;
                self.settings["Features"].stancehover = nil;
                self.settings["Features"].stancedisappear = nil;
        end
        
        if (settings.vers < 3.20) then
                self.settings["Quickslots"].tactics = {active = false, type = 0, data = "" }
        end
        
        if (settings.vers < 4.00) then
                local oldclassinfo = self.settings;
                self:DefaultSettings();
                for k,v in pairs(oldclassinfo) do
                        if (k ~= "Features" and k ~= "Quickslots") then
                                if (self.settings.preconf[k] == nil) then
                                        if (self.settings.userconf[k] ~= nil) then
                                                self.settings.userconf[k].pos = { v.x, v.y };
                                                self.settings.userconf[k].combat = { true, true };
                                                self.settings.userconf[k].active = v.active;
                                        end
                                else
                                        self.settings.preconf[k].pos = { v.x, v.y };
                                        self.settings.preconf[k].combat = { true, true };
                                        self.settings.preconf[k].active = v.active;
                                end
                        elseif (k == "Features") then
                                for key, value in pairs(v) do
                                        if (key == 'totheking') then
                                                self.settings.traits["ToTheKing"].active = value;
                                        elseif (key == 'shieldsmash') then
                                                self.settings.traits["ShieldSmash"].active = value;
                                        elseif (key == 'darkness') then
                                                self.settings.traits["ChallengeTheDarkness"].active = value;
                                        elseif (key == 'threat') then
                                                self.settings.traits["ThreatStance"].active = value;
                                        elseif (key == 'woundindicator') then
                                                self.settings.features["WoundIndicator"].active = value;
                                        elseif (key == 'stancepriority') then
                                                self.settings.features["StancePriority"].active = value;
                                        elseif (key == 'stanceactive') then
                                                self.settings.defaults["StanceActive"].selected = value;
                                        elseif (key == 'wardactive') then
                                                self.settings.defaults["WardActive"].selected = value;
                                        elseif (key == 'stanceactive') then
                                                self.settings.defaults["PrimaryStance"].selected = value;
                                        elseif (key == 'secondarystance') then
                                                self.settings.defaults["SecondaryStance"].selected = value;
                                        end
                                end
                        elseif (k == "Quickslots") then
                                for key, value in pairs(v) do
                                        if (key == 'spike1') then
                                                self.settings.quickslots["Spike1"].active = value.active;
                                                self.settings.quickslots["Spike1"].type = value.type;
                                                self.settings.quickslots["Spike1"].data = value.data;
                                        elseif (key == 'spike2') then
                                                self.settings.quickslots["Spike2"].active = value.active;
                                                self.settings.quickslots["Spike2"].type = value.type;
                                                self.settings.quickslots["Spike2"].data = value.data;
                                        elseif (key == 'spike3') then
                                                self.settings.quickslots["Spike3"].active = value.active;
                                                self.settings.quickslots["Spike3"].type = value.type;
                                                self.settings.quickslots["Spike3"].data = value.data;
                                        elseif (key == 'spike4') then
                                                self.settings.quickslots["Spike4"].active = value.active;
                                                self.settings.quickslots["Spike4"].type = value.type;
                                                self.settings.quickslots["Spike4"].data = value.data;
                                        end
                                end
                        end
                end
                if (settings.skilldata["SaltTheWound"] ~= nil) then
                        settings.skilldata["SaltTheWound"].parent = "Melee";
                        settings.skilldata["SaltTheWound"].pos = {7, 1};
                end
                if (settings.multidata["ShieldSpikes"] ~= nil) then
                        settings.multidata["ShieldSpikes"].parent = "ClassItems";
                        settings.multidata["ShieldSpikes"].pos = {1, 1};
                end
                if (settings.skilldata["OverpowerTactics"] ~= nil) then
                        settings.skilldata["OverpowerTactics"].parent = "ClassItems";
                        settings.skilldata["OverpowerTactics"].pos = {1, 1};
                end
                settings.skilldata["SaltTheWound"].parent = "Melee";
                settings.skilldata["SaltTheWound"].pos = {7, 1};
                if (self.settings.userconf["Taunt"] ~= nil) then self.settings.userconf["Taunt"].defpo = { 8,4 }; end
                if (self.settings.userconf["SelfBuffs"] ~= nil) then self.settings.userconf["SelfBuffs"].size = { 6,1 }; end
                if (self.settings.userconf["Melee"] ~= nil) then self.settings.userconf["Melee"].size = { 7,1 }; end
                if (self.settings.preconf["Parry"] ~= nil) then self.settings.preconf["Parry"].size = { 4,1 }; end
                if (self.settings.userconf["ClassItems"] ~= nil) then self.settings.userconf["ClassItems"].size = { 1,1 }; end
        end
        
        if (settings.vers < 5.04) then
                if (vars.playerlevel >= 70) then
                        settings.skilldata["WhirlingRetaliation"] = { parent = "ParryTier1", pos = { 1, 1 } };
                else
                        settings.skilldata["WhirlingRetaliation"] = { parent = "ParryTier2", pos = { 1, 1 } };
                end
                settings.skilldata["Retaliation"] = { parent = "ParryTier1", pos = { 2, 1 } };
                settings.skilldata["Overwhelm"] = { parent = "ParryTier2", pos = { 2, 1 } };
        end
        
        settings.vers = vars.vers;

end

-- REFRESH SKILLS AND BARS
function GuardianBars:Refresh()

        -- GENERIC REFRESH (Required for all classes)
        self:RefreshBars();
        
        -- REDEFINE EFFECTLIST IN CASE OF LANGUAGE CHANGE
        self.DefineEffectList();
        
        -- CLASS SPECIFIC REFRESH
    -- Setup Features
        self.skills["GuardiansWard"]:SetActive( true );
        if (self.settings.defaults["WardActive"].selected == 2) then
                self.skills["GuardiansWard"]:SetHover( self.effectlist["GuardiansWard"]:GetState() );
        elseif (self.settings.defaults["WardActive"].selected >= 3) then
                self.skills["GuardiansWard"]:SetActive( not self.effectlist["GuardiansWard"]:GetState() );
        end
        
        -- Reset Quickslots
        self.skills["OverpowerTactics"]:SetQuickslot(self.settings.quickslots["Tactics"]);
        
        self.multi["ShieldSpikes"]:Clear();
        self.multi["ShieldSpikes"]:AddShortCut("Spikes1", self.settings.quickslots["Spike1"]);
    self.multi["ShieldSpikes"]:AddShortCut("Spikes2", self.settings.quickslots["Spike2"]);
    self.multi["ShieldSpikes"]:AddShortCut("Spikes3", self.settings.quickslots["Spike3"]);
        self.multi["ShieldSpikes"]:AddShortCut("Spikes4", self.settings.quickslots["Spike4"]);
        self.multi["ShieldSpikes"]:Refresh(not self.effectlist["Overpower"]:GetState());
                
        -- Set State on Legendary Skills
        self.skills["ShieldSmash"]:SetActive(self.settings.traits["ShieldSmash"].active and vars.classattr:IsBlockTier3Available());
        self.skills["ToTheKing"]:SetActive(self.settings.traits["ToTheKing"].active and vars.classattr:IsParryTier3Available());
        self.skills["ChallengeTheDarkness"]:SetActive(self.settings.traits["ChallengeTheDarkness"].active);

        -- Rebuild Stance Slot
        self.multi["StanceSlot"]:Clear();
        self.multi["StanceSlot"]:AddShortCut("GuardiansDefence",         4, "0x70003EDF");
    self.multi["StanceSlot"]:AddShortCut("GuardiansParry",              12, "0x70003EE3");
    self.multi["StanceSlot"]:AddShortCut("Overpower",                   12, "0x7000D4B1");
    if (self.settings.traits["ThreatStance"].active) then self.multi["StanceSlot"]:AddShortCut("GuardiansThreat",       41, "0x70002ED4"); end
    self.multi["StanceSlot"]:LevelCheck();
    
        -- Set Wound Indicator
        if (settings.skilldata["IgnoreThePain"].parent ~= nil and vars.playerlevel >= self.skills["IgnoreThePain"].level[1] and self.settings.features["WoundIndicator"].active and self.wound > 0) then
                if (self.settings.userconf[settings.skilldata["IgnoreThePain"].parent].active) then
                        self.skills["IgnoreThePain"]:SetColor("green");
                end
        else
                self.skills["IgnoreThePain"]:SetColor();
        end
    
        -- Refresh States
        self:StanceChange(vars.classattr:GetStance());
        self:CombatChange(vars.player:IsInCombat());
        
        if (self.effectlist["Overpower"]:GetState()) then
                self.windows["Overpower"]:SetZOrder(0);
                self.windows["Block"]:SetZOrder(-10);
        else
                self.windows["Overpower"]:SetZOrder(-10);
                self.windows["Block"]:SetZOrder(0);
        end

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

end

Compare with Previous | Blame


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


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