lotrointerface.com
Search Downloads

LoTROInterface SVN KragenBars

[/] [trunk/] [KragenPlugs/] [KragenBars/] [HunterBars.lua] - Rev 134

Compare with Previous | Blame | View Log

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

HunterBars =  class( KragenPlugs.KragenBars.ClassBar );

function HunterBars:Constructor()

        KragenPlugs.KragenBars.ClassBar.Constructor( self );

        -- CLASS SPECIFIC VARIABLES
        self.poison = 0;
        self.swiftcount = 0;

        self.effectlist["ParryResponse"]        = Effect();
        self.effectlist["FindthePath"]          = Effect();
        self.effectlist["SwiftStroke"]          = Effect();
        self.effectlist["SimpleFireoil"]        = Effect();
        self.effectlist["Fireoil"]                      = Effect();
        self.effectlist["RefinedFireoil"]       = Effect();
        self.effectlist["PureFireoil"]          = Effect();
        self.effectlist["SimpleLightoil"]       = Effect();
        self.effectlist["Lightoil"]                     = Effect();
        self.effectlist["RefinedLightoil"]      = Effect();
        self.effectlist["PureLightoil"]         = Effect();
        self.effectlist["BowChant"]                     = Effect();
        self.effectlist["SwiftMercy"]           = Effect();
        self.effectlist["StanceEndurance"]      = Effect();
    
        
        -- DEFINE THE EFFECT LIST BASED ON CLIENT LANGUAGE
        self.DefineEffectList = function()
                -- ENGLISH CLIENT
                if (settings.language == 1) then
                        self.effectlist["ParryResponse"]        :SetName("Parry Response");
                        self.effectlist["FindthePath"]          :SetName("Find the Path");
                        self.effectlist["SwiftStroke"]          :SetName("Swift Stroke");
                        self.effectlist["SimpleFireoil"]        :SetName("Simple Fire-oil");
                        self.effectlist["Fireoil"]                      :SetName("Fire-oil");
                        self.effectlist["RefinedFireoil"]       :SetName("Refined Fire-oil");
                        self.effectlist["PureFireoil"]          :SetName("Pure Fire-oil");
                        self.effectlist["SimpleLightoil"]       :SetName("Simple Light-oil");
                        self.effectlist["Lightoil"]                     :SetName("Light-oil");
                        self.effectlist["RefinedLightoil"]      :SetName("Refined Light-oil");
                        self.effectlist["PureLightoil"]         :SetName("Pure Light-oil");
                        self.effectlist["BowChant"]                     :SetName("Bow Chant");
                        self.effectlist["SwiftMercy"]           :SetName("Swift Mercy");
                        self.effectlist["StanceEndurance"]      :SetName("Stance: Endurance");
                elseif (settings.language == 2) then
                        self.effectlist["ParryResponse"]        :SetName("Parry Response");
                        self.effectlist["FindthePath"]          :SetName("Find the Path");
                        self.effectlist["SwiftStroke"]          :SetName("Swift Stroke");
                        self.effectlist["SimpleFireoil"]        :SetName("Simple Fire-oil");
                        self.effectlist["Fireoil"]                      :SetName("Fire-oil");
                        self.effectlist["RefinedFireoil"]       :SetName("Refined Fire-oil");
                        self.effectlist["PureFireoil"]          :SetName("Pure Fire-oil");
                        self.effectlist["SimpleLightoil"]       :SetName("Simple Light-oil");
                        self.effectlist["Lightoil"]                     :SetName("Light-oil");
                        self.effectlist["RefinedLightoil"]      :SetName("Refined Light-oil");
                        self.effectlist["PureLightoil"]         :SetName("Pure Light-oil");
                        self.effectlist["BowChant"]                     :SetName("Bow Chant");
                        self.effectlist["SwiftMercy"]           :SetName("Swift Mercy");
                        self.effectlist["StanceEndurance"]      :SetName("Stance: Endurance");
                        Turbine.Shell.WriteLine("Some features may not function with the French Client.  If you would like to help with French effect names goto http://www.lotrointerface.com/downloads/info384-KragenBars.html");
                elseif (settings.language == 3) then
                        self.effectlist["ParryResponse"]        :SetName("Parry Response");
                        self.effectlist["FindthePath"]          :SetName("Find the Path");
                        self.effectlist["SwiftStroke"]          :SetName("Swift Stroke");
                        self.effectlist["SimpleFireoil"]        :SetName("Simple Fire-oil");
                        self.effectlist["Fireoil"]                      :SetName("Fire-oil");
                        self.effectlist["RefinedFireoil"]       :SetName("Refined Fire-oil");
                        self.effectlist["PureFireoil"]          :SetName("Pure Fire-oil");
                        self.effectlist["SimpleLightoil"]       :SetName("Simple Light-oil");
                        self.effectlist["Lightoil"]                     :SetName("Light-oil");
                        self.effectlist["RefinedLightoil"]      :SetName("Refined Light-oil");
                        self.effectlist["PureLightoil"]         :SetName("Pure Light-oil");
                        self.effectlist["BowChant"]                     :SetName("Bow Chant");
                        self.effectlist["SwiftMercy"]           :SetName("Swift Mercy");
                        self.effectlist["StanceEndurance"]      :SetName("Stance: Endurance");
                        Turbine.Shell.WriteLine("Some features may not function with the German Client.  If you would like to help with German effect names goto http://www.lotrointerface.com/downloads/info384-KragenBars.html");
                end
        end
        
    -- BUILD WINDOWS BARS SKILLS AND MULTIS --
        
        -- Build Skills         SkillSlot( parent:SkillBar, x:int, y:int, active:Boolean, level:int, hexcode:String );
    self.skills["AgileRejoinder"]                       = SkillSlot(self.bars["Parry"],         1, 1, false, 24, "0x70003F3C");
        
    self.skills["SwiftStroke"]                          = SkillSlot(self.bars["Melee"],         1, 1, true, 1, "0x70003F38");
    self.skills["Blindside"]                            = SkillSlot(self.bars["Melee"],         4, 1, true, 1, "0x70003F3B");
    self.skills["ScourgingBlow"]                        = SkillSlot(self.bars["Melee"],         2, 1, true, { 4, 72 }, { "0x70003F3A", "0x70029859" });
    self.skills["LowCut"]                                       = SkillSlot(self.bars["Melee"],         3, 1, true, 16, "0x70003F39");
    self.skills["DazingBlow"]                           = SkillSlot(self.bars["Melee"],         5, 1, true, { 48, 52 }, { "0x70021D0E", "0x70021D18" });
    
    self.skills["QuickShot"]                            = SkillSlot(self.bars["BowInduct"], 1, 1, true, { 1, 74 }, { "0x70003F32", "0x70029856" });
    self.skills["BarbedArrow"]                          = SkillSlot(self.bars["BowInduct"], 2, 1, true, 4, "0x70003F33");
    self.skills["SwiftBow"]                                     = SkillSlot(self.bars["BowInduct"], 3, 1, true, { 10, 54 }, { "0x70003F34", "0x700153E2" });
        self.skills["SplitShot"]                                = SkillSlot(self.bars["BowInduct"], 4, 1, true, 26, "0x700292DC");
    self.skills["HeartSeeker"]                          = SkillSlot(self.bars["BowInduct"], 5, 1, true, 50, "0x7000A2D3");
    self.skills["DistractingShot"]                      = SkillSlot(self.bars["BowInduct"], 6, 1, true, 58, "0x7000F9AB");
   
    self.skills["PenetratingShot"]                      = SkillSlot(self.bars["BowFocus"],      1, 1, true, { 2, 68 }, { "0x70003F35", "0x7002984F" });
    self.skills["RainofArrows"]                         = SkillSlot(self.bars["BowFocus"],      2, 1, true, 20, "0x70003F36");
    self.skills["MercifulShot"]                         = SkillSlot(self.bars["BowFocus"],      3, 1, true, { 30, 52 }, { "0x70003F37", "0x700153E5" });
    self.skills["HuntersArt"]                           = SkillSlot(self.bars["BowFocus"],      4, 1, true, 40, "0x7002958E");
    self.skills["BloodArrow"]                           = SkillSlot(self.bars["BowFocus"],      5, 1, true, 44, "0x70021D0D");
    self.skills["RainofThorns"]                         = SkillSlot(self.bars["BowFocus"],      6, 1, self.settings.traits["RainofThorns"].active, 41, "0x700010F4");
    
    self.skills["BeneathNotice"]                        = SkillSlot(self.bars["Dethreat"],      1, 1, true, { 38, 64 }, { "0x700030EC", "0x70020DF8" });
        
    self.skills["DesperateFlight"]                      = SkillSlot(self.bars["Utility"],       1, 1, true, 20, "0x70003F40");
    self.skills["BrightCampfire"]                       = SkillSlot(self.bars["Utility"],       2, 1, true, 22, "0x70003F3F");
    self.skills["Camouflage"]                           = SkillSlot(self.bars["Utility"],       3, 1, true, 40, "0x70003F48");
    
    self.skills["CryofthePredator"]                     = SkillSlot(self.bars["Fear"],          1, 1, true, 12, "0x70003F49");
    self.skills["BardsArrow"]                           = SkillSlot(self.bars["Fear"],          2, 1, self.settings.traits["BardsArrow"].active, 41, "0x700010D3");

    self.skills["FindthePath"]                          = SkillSlot(self.bars["Stance"],        2, 1, true, 14, "0x70003F3D");
        
    self.skills["Focus"]                                        = SkillSlot(self.bars["Focus"],         1, 1, true, { 8, 66} , { "0x70003F4C", "0x70029854" });
    self.skills["IntentConcentration"]          = SkillSlot(self.bars["Focus"],         2, 1, true, 20, "0x700030DE");
    self.skills["NeedfulHaste"]                         = SkillSlot(self.bars["Focus"],         3, 1, true, 34, "0x700030F3");
        self.skills["Fleetness"]                                = SkillSlot(self.bars["Focus"],         4, 1, true, 56, "0x70010065");
    self.skills["BurnHot"]                                      = SkillSlot(self.bars["Focus"],         5, 1, true, 60, "0x7000F835");
    
    self.skills["PurgePoison"]                          = SkillSlot(self.bars["Restoration"],1, 1, true, 16, "0x70003F3E");
    self.skills["StrengthoftheEarth"]           = SkillSlot(self.bars["Restoration"],2, 1, true, { 42, 70 }, { "0x7000A2D4", "0x70010007" });
    self.skills["PressOnward"]                          = SkillSlot(self.bars["Restoration"],3, 1, self.settings.traits["PressOnward"].active, 41, "0x700010E5");
    
        -- Build Quickslots         ItemSlot( parent:SkillBar, x:int, y:int, active:Boolean, type:int, data:String );
        self.skills["FireOil"]                                  = ItemSlot(self.bars["Oils"],           1, 1, true, self.settings.quickslots["FireOil"]);
        self.skills["LightOil"]                                 = ItemSlot(self.bars["Oils"],           2, 1, true, self.settings.quickslots["LightOil"]);
        self.skills["BowChant"]                                 = ItemSlot(self.bars["Oils"],           3, 1, true, self.settings.quickslots["BowChant"]);
        
    self.multi["TrapsSlot"]                     = ItemMultiSlot(self.bars["Trapping"], 2, 1, true);
        self.multi["TrapsSlot"]:AddShortCut("Trap1",            self.settings.quickslots["Trap1"]);
        self.multi["TrapsSlot"]:AddShortCut("Trap2",            self.settings.quickslots["Trap2"]);
        self.multi["TrapsSlot"]:AddShortCut("Trap3",            self.settings.quickslots["Trap3"]);
        
    -- Build MultiSlots         SkillMultiSlot( parent:SkillBar, x:int, y:int, active:Boolean );
    --                                                  multi:AddShortCut(name:String, level:int, hex:String);
        self.multi["TrackingSlot"]              = SkillMultiSlot(self.bars["Tracking"], 1, 1, true);
        self.multi["TrackingSlot"]:AddShortCut("PassageofNature",       12, "0x70003F45");
    self.multi["TrackingSlot"]:AddShortCut("PassageofFoes",             22, "0x70003F46");
    self.multi["TrackingSlot"]:AddShortCut("PassageofShadow",   32, "0x70003F47");
    self.multi["TrackingSlot"]:LevelCheck();

        self.multi["StanceSlot"]                        = SkillMultiSlot(self.bars["Stance"], 1, 1, true);
        self.multi["StanceSlot"]:AddShortCut("StrengthStance",          6, "0x70003F4E");
    self.multi["StanceSlot"]:AddShortCut("PrecisionStance",             18, "0x70003F4D");
    self.multi["StanceSlot"]:AddShortCut("EnduranceStance",             28, "0x70003F4F");
    self.multi["StanceSlot"]:LevelCheck();
        self.multi["StanceSlot"]:SetIndex(self.settings.defaults["PrimaryStance"].selected);

        self.multi["TrappingSlot"]              = SkillMultiSlot(self.bars["Trapping"], 1, 1, true);
        self.multi["TrappingSlot"]:AddShortCut("SetTrap",                       6, "0x700030BB");
    self.multi["TrappingSlot"]:AddShortCut("SetSnare",                  36, "0x7000A6B1");
    self.multi["TrappingSlot"]:LevelCheck();

        self.multi["PortsSlot"]                 = SkillMultiSlot(self.bars["Ports"], 1, 1, true);
    self.multi["PortsSlot"]:AddShortCut("GuidetoMichelDelving", 22, "0x7000A2C3");
    self.multi["PortsSlot"]:AddShortCut("GuidetoThorinsHall",   24, "0x70003F41");
        self.multi["PortsSlot"]:AddShortCut("ReturntoCamp",                     26, "0x7000A2C1");
    self.multi["PortsSlot"]:AddShortCut("GuidetoOstGuruth",             26, "0x7000A2C2");
    self.multi["PortsSlot"]:AddShortCut("GuidetoBree",                  32, "0x70003F42");
    self.multi["PortsSlot"]:AddShortCut("GuidetoEsteldin",              34, "0x70003F43");
    self.multi["PortsSlot"]:AddShortCut("GuidetoEvendim",               36, "0x7000A2C4");
    self.multi["PortsSlot"]:AddShortCut("GuidetoWestAngmar",    44, "0x7000A2C5");
    self.multi["PortsSlot"]:AddShortCut("GuidetoRivendell",             46, "0x70003F44");
    self.multi["PortsSlot"]:AddShortCut("GuidetoSuriKyla",              48, "0x70017C82");
    self.multi["PortsSlot"]:AddShortCut("GuidetoEastAngmar",    48, "0x7000A2C6");
    self.multi["PortsSlot"]:AddShortCut("GuidetoEchadDunann",   50, "0x70017C81");
    self.multi["PortsSlot"]:AddShortCut("GuidetoTwentyFirstHall",56, "0x70017C7A");
    self.multi["PortsSlot"]:AddShortCut("GuidetoMirkEaves",             62, "0x7001F459");
    self.multi["PortsSlot"]:AddShortCut("GuidetoHarndirion",    62, "0x700235EF");
    self.multi["PortsSlot"]:AddShortCut("GuidetoGaltrev",               70, "0x7002A93F");
    self.multi["PortsSlot"]:LevelCheck();
        

        -- SET COMBAT STATES
        self.skills["Focus"]:SetCombat(false, true);
        self.skills["Camouflage"]:SetCombat(false, true);
        self.skills["BrightCampfire"]:SetCombat(false, true);
        self.multi["TrackingSlot"]:SetCombat(false, true);
        self.multi["TrappingSlot"]:SetCombat(self.settings.traits["CombatTraps"].active, true);
        self.multi["PortsSlot"]:SetCombat(false, true);

        -- CLASS SPECIFIC SETUP/DEFAULT CODE
        
        
    -- EVENTS
        
        -- Stance Change Event
        AddCallback(vars.classattr, "StanceChanged", function(sender, args)
                KragenBars:StanceChange(vars.classattr:GetStance());
        end);
        
        -- Focus Change Event
        AddCallback(vars.classattr, "FocusChanged", function(sender, args)
                KragenBars:FocusChange(vars.classattr:GetFocus());
        end);
        
        
         -- INITIALIZE BARS
        self:InitBars();
        self:CombatChange(vars.player:IsInCombat());
        self:StanceChange(vars.classattr:GetStance());
        self:FocusChange(vars.classattr:GetFocus());
        
end


-- ADD EFFECT EVENT
function HunterBars:AddEffect( effectIndex )
        local effect = vars.player:GetEffects():Get( effectIndex );
        local name = effect:GetName();
        local id = effect:GetID();

        if (effect:GetName() == self.effectlist["ParryResponse"]:GetName()) then
        if (self.effectlist["ParryResponse"]:SetState(true, id)) then
                        self.skills["AgileRejoinder"]:SetActive(true);
                end
        
        elseif (effect:GetName() == self.effectlist["StanceEndurance"]:GetName()) then
        if (self.effectlist["StanceEndurance"]:SetState(true, id)) then
                        self:StanceChange(vars.classattr:GetStance());
                end
        
        elseif (effect:GetName() == self.effectlist["FindthePath"]:GetName()) then
        if (self.effectlist["FindthePath"]:SetState(true, id)) then
                        if (self.settings.defaults["FindPathActive"].selected == 1) then
                                self.skills["FindthePath"]:SetActive(true);
                        elseif (self.settings.defaults["FindPathActive"].selected == 2) then
                                self.skills["FindthePath"]:SetActive(true);
                                self.skills["FindthePath"]:SetHover(true);
                        else
                                self.skills["FindthePath"]:SetActive(false);
                        end
                end
                
        elseif (string.find(effect:GetName(), self.effectlist["BowChant"]:GetName()) ~= nil) then
        if (self.effectlist["BowChant"]:SetState(true, id)) then
                        self.skills["BowChant"]:SetActive(false);
                        self.skills["BowChant"]:SetHover(true);
                        self.skills["BowChant"]:StartTimer(effect:GetDuration() * .85, true);
                end
                
        elseif (effect:GetName() == self.effectlist["SwiftStroke"]:GetName() and self.settings.features["DimSwiftStroke"].active) then
        if (self.effectlist["SwiftStroke"]:SetState(true, id)) then
                        self.skills["SwiftStroke"]:SetActive(true);
                        self.skills["SwiftStroke"]:SetHover(true);
                end

        elseif (effect:GetName() == self.effectlist["SwiftMercy"]:GetName()) then
                if (self.swiftcount < 6) then
                        self.swiftcount = self.swiftcount + 1;
                        self:FocusChange(vars.classattr:GetFocus());
                end
        self.effectlist["SwiftMercy"]:SetState(true, id)

        elseif (effect:GetName() == self.effectlist["SimpleFireoil"]:GetName() or  effect:GetName() == self.effectlist["Fireoil"]:GetName() or effect:GetName() == self.effectlist["RefinedFireoil"]:GetName() or effect:GetName() == self.effectlist["PureFireoil"]:GetName()) then
        if (self.effectlist["Fireoil"]:SetState(true, id)) then
                        self.skills["FireOil"]:SetActive(false);
                        self.skills["FireOil"]:SetHover(true);
                        self.skills["FireOil"]:StartTimer(effect:GetDuration() * .85, true);
                        self.skills["LightOil"]:SetHover(true);
                end

        elseif (effect:GetName() == self.effectlist["SimpleLightoil"]:GetName() or  effect:GetName() == self.effectlist["Lightoil"]:GetName() or effect:GetName() == self.effectlist["RefinedLightoil"]:GetName() or effect:GetName() == self.effectlist["PureLightoil"]:GetName()) then
        if (self.effectlist["Lightoil"]:SetState(true, id)) then
                        self.skills["LightOil"]:SetActive(false);
                        self.skills["LightOil"]:SetHover(true);
                        self.skills["LightOil"]:StartTimer(effect:GetDuration() * .85, true);
                        self.skills["FireOil"]:SetHover(true);
                end
        
        elseif (effect:GetCategory() == Turbine.Gameplay.EffectCategory.Poison ) then
                self.poison = self.poison + 1;
                if (settings.skilldata["PurgePoison"].parent ~= nil and vars.playerlevel >= self.skills["PurgePoison"].level[1] and self.settings.features["PoisonIndicator"].active) then
                        if (self.settings.userconf[settings.skilldata["PurgePoison"].parent].active) then
                                self.skills["PurgePoison"]:SetColor("green");
                        end
                end
        
    end
end


-- REMOVE EFFECT EVENT
function HunterBars:RemoveEffect( effect )
        local name = effect:GetName();
        local id = effect:GetID();

        if (effect:GetName() == self.effectlist["ParryResponse"]:GetName()) then
                if (not self.effectlist["ParryResponse"]:SetState(false, id)) then
                        self.skills["AgileRejoinder"]:SetActive(false);
                end

        elseif (effect:GetName() == self.effectlist["StanceEndurance"]:GetName()) then
        if (not self.effectlist["StanceEndurance"]:SetState(false, id)) then
                        self:StanceChange(vars.classattr:GetStance());
                end
        
        elseif (effect:GetName() == self.effectlist["FindthePath"]:GetName()) then
                if (not self.effectlist["FindthePath"]:SetState(false, id)) then
                        self.skills["FindthePath"]:SetActive(true);
                        self.skills["FindthePath"]:SetHover(false);
                end

        elseif (string.find(effect:GetName(), self.effectlist["BowChant"]:GetName()) ~= nil) then
                if (not self.effectlist["BowChant"]:SetState(false, id)) then
                        self.skills["BowChant"]:SetActive(true);
                        self.skills["BowChant"]:SetHover(false);
                end
                
        elseif (effect:GetName() == self.effectlist["SwiftStroke"]:GetName()) then
                if (not self.effectlist["SwiftStroke"]:SetState(false, id)) then
                        self.skills["SwiftStroke"]:SetActive(true);
                        self.skills["SwiftStroke"]:SetHover(false);
                end

        elseif (effect:GetName() == self.effectlist["SwiftMercy"]:GetName()) then
                if (not self.effectlist["SwiftMercy"]:SetState(false, id)) then
                        self.swiftcount = 0;
                end
                
        elseif (effect:GetName() == self.effectlist["SimpleFireoil"]:GetName() or  effect:GetName() == self.effectlist["Fireoil"]:GetName() or effect:GetName() == self.effectlist["RefinedFireoil"]:GetName() or effect:GetName() == self.effectlist["PureFireoil"]:GetName()) then
                if (not self.effectlist["Fireoil"]:SetState(false, id)) then
                        self.skills["FireOil"]:SetActive(true);
                        self.skills["LightOil"]:SetHover(false);
                        self.skills["FireOil"]:SetHover(false);
                end

        elseif (effect:GetName() == self.effectlist["SimpleLightoil"]:GetName() or  effect:GetName() == self.effectlist["Lightoil"]:GetName() or effect:GetName() == self.effectlist["RefinedLightoil"]:GetName() or effect:GetName() == self.effectlist["PureLightoil"]:GetName()) then
                if (not self.effectlist["Lightoil"]:SetState(false, id)) then
                        self.skills["LightOil"]:SetActive(true);
                        self.skills["FireOil"]:SetHover(false);
                        self.skills["LightOil"]:SetHover(false);
                end

        elseif (effect:GetCategory() == Turbine.Gameplay.EffectCategory.Poison ) then
                self.poison = self.poison - 1;
                if (self.poison == 0) then
                        self.skills["PurgePoison"]:SetColor();
                end
                
        end
end


function HunterBars:FocusChange(focus)

        if (focus >= (6 - self.swiftcount)) then
                self.skills["MercifulShot"]:SetActive(true);
        else
                self.skills["MercifulShot"]:SetActive(false);
        end
        
        if (focus == 0) then
                self.skills["PenetratingShot"]:SetActive(false);
                self.skills["BloodArrow"]:SetActive(false);
                self.skills["RainofArrows"]:SetActive(false);
                self.skills["HuntersArt"]:SetActive(false);
                self.skills["NeedfulHaste"]:SetActive(false);
                self.skills["Fleetness"]:SetActive(false);
                self.skills["RainofThorns"]:SetActive(false);
        elseif (focus > 0 and focus < 3) then
                self.skills["PenetratingShot"]:SetActive(false);
                self.skills["BloodArrow"]:SetActive(false);
                self.skills["RainofArrows"]:SetActive(false);
                self.skills["HuntersArt"]:SetActive(false);
                self.skills["NeedfulHaste"]:SetActive(false);
                self.skills["Fleetness"]:SetActive(false);
                self.skills["RainofThorns"]:SetActive(false);
        elseif (focus >= 3 and focus < 6) then
                self.skills["PenetratingShot"]:SetActive(true);
                self.skills["BloodArrow"]:SetActive(true);
                self.skills["RainofArrows"]:SetActive(true);
                self.skills["HuntersArt"]:SetActive(true);
                self.skills["NeedfulHaste"]:SetActive(true);
                self.skills["Fleetness"]:SetActive(false);
                self.skills["RainofThorns"]:SetActive(false);
        elseif (focus >= 6) then
                self.skills["PenetratingShot"]:SetActive(true);
                self.skills["BloodArrow"]:SetActive(true);
                self.skills["RainofArrows"]:SetActive(true);
                self.skills["HuntersArt"]:SetActive(true);
                self.skills["NeedfulHaste"]:SetActive(true);
                self.skills["Fleetness"]:SetActive(true);
                self.skills["RainofThorns"]:SetActive(self.settings.traits["RainofThorns"].active);

        end
end


function HunterBars:StanceChange(stance)
        local stancenew = 0;
        
        -- Hack because Turbine put the stances in the wrong order
        if (stance == 1) then
                stancenew = 2;
        elseif (stance == 2) then
                stancenew = 1;
        else
                stancenew = stance;
        end
        
        -- Hack because Turbine broke Endurance Stance
        if (self.effectlist["StanceEndurance"]:GetState()) then
                stancenew = 3;
        end
        
        if (stancenew ~= self.settings.defaults["PrimaryStance"].selected) then
                self.multi["StanceSlot"]:SetIndex(self.settings.defaults["PrimaryStance"].selected);
        else
                self.multi["StanceSlot"]:SetIndex(self.settings.defaults["SecondaryStance"].selected);
        end
        
        if (stancenew == 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

-- DEFAULT SETTINGS
function HunterBars:DefaultSettings()
        self.settings = { preconf = { }, userconf = { }, traits = { }, features = { }, defaults = { }, quickslots = { } };
        
        self.settings.userconf["Parry"]                 = { id = 1,     name = "Parry",                         defpos = {1,1},         size={1,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Melee"]                 = { id = 2,     name = "Melee",                         defpos = {2,1},         size={5,1}, pos = {0,0}, combat = {true,true}, active = true };
    self.settings.userconf["BowInduct"]         = { id = 3,     name = "Bow: Induction",        defpos = {1,2},         size={6,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["BowFocus"]              = { id = 4,     name = "Bow: Focus",            defpos = {1,3},         size={6,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Dethreat"]              = { id = 5,     name = "Dethreat",                      defpos = {9,2},         size={1,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Utility"]               = { id = 6,     name = "Utility",                       defpos = {1,4},         size={3,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Tracking"]              = { id = 7,     name = "Tracking",                      defpos = {4,4},         size={1,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Fear"]                  = { id = 8,     name = "Fear",                          defpos = {7,2},         size={2,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Stance"]                = { id = 9,     name = "Stance",                        defpos = {7,4},         size={2,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Focus"]                 = { id = 10,    name = "Focus",                         defpos = {1,5},         size={5,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Restoration"]   = { id = 11,    name = "Restoration",           defpos = {5,5},         size={3,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Trapping"]              = { id = 12,    name = "Trapping",                      defpos = {5,4},         size={2,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Oils"]                  = { id = 13,    name = "Oils",                          defpos = {9,3},         size={4,1}, pos = {0,0}, combat = {true,true}, active = true };
        self.settings.userconf["Ports"]                 = { id = 14,    name = "Ports",                         defpos = {8,5},         size={1,1}, pos = {0,0}, combat = {true,true}, active = true }; 
        
        self.settings.traits["CombatTraps"]                     = { id = 1, name = "Combat Traps", active = false };
        self.settings.traits["RainofThorns"]            = { id = 2, name = "Rain of Thorns", active = false };
        self.settings.traits["BardsArrow"]                      = { id = 3, name = "Bard's Arrow", active = false };
        self.settings.traits["PressOnward"]             = { id = 4, name = "Press Onward", active = false };
        
        self.settings.features["PoisonIndicator"]       = { id = 1, name = 'Poison Indicator', active = true };
        self.settings.features["DimSwiftStroke"]        = { id = 2, name = 'Dim Swift Stroke', active = true };
        
        self.settings.defaults["PrimaryStance"]         = { id = 1, name = 'Primary Stance', selected = 1, list = { "Strength", "Precision", "Endurance" } };
        self.settings.defaults["SecondaryStance"]       = { id = 2, name = 'Secondary Stance', selected = 3, list = { "Strength", "Precision", "Endurance" } };
        self.settings.defaults["StanceActive"]          = { id = 3, name = 'Stance Active', selected = 2, list = { "None", "Dim", "Hide" } };
        self.settings.defaults["FindPathActive"]        = { id = 4, name = 'Find Path Active', selected = 3, list = { "None", "Dim", "Hide" } };
        
        self.settings.quickslots["FireOil"]     = {id = 1, name = "Fire-Oil", active = false, type = 0, data = ""};
        self.settings.quickslots["LightOil"]    = {id = 2, name = "Light-Oil",active = false, type = 0, data = ""};
        self.settings.quickslots["BowChant"]    = {id = 3, name = "Bow Chant", active = false, type = 0, data = ""};
        self.settings.quickslots["Trap1"]               = {id = 4, name = "Crafted Trap", active = false, type = 0, data = ""};
        self.settings.quickslots["Trap2"]               = {id = 5, name = "Crafted Trap", active = false, type = 0, data = ""};
        self.settings.quickslots["Trap3"]               = {id = 6, name = "Crafted Trap", active = false, type = 0, data = ""};

end


-- UPDATE SETTINGS
function HunterBars:UpdateSettings()

        if (settings.vers < 3.10) then
                self.settings["Features"].stanceactive = 2;
                self.settings["Ports"] = { active = true, x = 0, y = 0, rotate = 0 };
                self.settings["Quickslots"].bowchant = { active = false, type = Turbine.UI.Lotro.ShortcutType.Undefined, data = "" };
                self.settings["Quickslots"].trap1 = { active = false, type = Turbine.UI.Lotro.ShortcutType.Undefined, data = "" };
                self.settings["Quickslots"].trap2 = { active = false, type = Turbine.UI.Lotro.ShortcutType.Undefined, data = "" };
                self.settings["Quickslots"].trap3 = { active = false, type = Turbine.UI.Lotro.ShortcutType.Undefined, data = "" };
        elseif (settings.vers < 3.20) then
                self.settings["Quickslots"].bowchant = { active = false, type = Turbine.UI.Lotro.ShortcutType.Undefined, data = "" };
                self.settings["Quickslots"].trap1 = { active = false, type = Turbine.UI.Lotro.ShortcutType.Undefined, data = "" };
                self.settings["Quickslots"].trap2 = { active = false, type = Turbine.UI.Lotro.ShortcutType.Undefined, data = "" };
                self.settings["Quickslots"].trap3 = { active = false, type = Turbine.UI.Lotro.ShortcutType.Undefined, 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 == 'combattraps') then
                                                self.settings.traits["CombatTraps"].active = value;
                                        elseif (key == 'strongdraw') then
                                                self.settings.traits["StrongDraw"].active = value;
                                        elseif (key == 'arrowstorm') then
                                                self.settings.traits["ArrowStorm"].active = value;
                                        elseif (key == 'thorns') then
                                                self.settings.traits["RainofThorns"].active = value;
                                        elseif (key == 'bards') then
                                                self.settings.traits["BardsArrow"].active = value;
                                        elseif (key == 'pressonward') then
                                                self.settings.traits["PressOnward"].active = value;
                                        elseif (key == 'dimswiftstroke') then
                                                self.settings.features["DimSwiftStroke"].active = value;
                                        elseif (key == 'stanceactive') then
                                                self.settings.defaults["StanceActive"].selected = value;
                                        elseif (key == 'findpathactive') then
                                                self.settings.defaults["FindPathActive"].selected = value;
                                        elseif (key == 'primarystance') 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 == 'fireoil') then
                                                self.settings.quickslots["FireOil"].active = value.active;
                                                self.settings.quickslots["FireOil"].type = value.type;
                                                self.settings.quickslots["FireOil"].data = value.data;
                                        elseif (key == 'lightoil') then
                                                self.settings.quickslots["LightOil"].active = value.active;
                                                self.settings.quickslots["LightOil"].type = value.type;
                                                self.settings.quickslots["LightOil"].data = value.data;
                                        elseif (key == 'bowchant') then
                                                self.settings.quickslots["BowChant"].active = value.active;
                                                self.settings.quickslots["BowChant"].type = value.type;
                                                self.settings.quickslots["BowChant"].data = value.data;
                                        elseif (key == 'trap1') then
                                                self.settings.quickslots["Trap1"].active = value.active;
                                                self.settings.quickslots["Trap1"].type = value.type;
                                                self.settings.quickslots["Trap1"].data = value.data;
                                        elseif (key == 'trap2') then
                                                self.settings.quickslots["Trap2"].active = value.active;
                                                self.settings.quickslots["Trap2"].type = value.type;
                                                self.settings.quickslots["Trap2"].data = value.data;
                                        elseif (key == 'trap3') then
                                                self.settings.quickslots["Trap3"].active = value.active;
                                                self.settings.quickslots["Trap3"].type = value.type;
                                                self.settings.quickslots["Trap3"].data = value.data;
                                        end
                                end
                        end
                end
        end
                
        if (settings.vers < 4.10) then
                local vartemp = nil;
                settings.skilldata["Fleetness"] = {parent = nil, pos = {1,1}};
                if (settings.multidata["StanceSlot"].current[1] == 4) then
                        settings.multidata["StanceSlot"].current[1] = 1;
                end
                if (self.settings.defaults["PrimaryStance"].selected == 4) then
                        vartemp = 1;
                else
                        vartemp = self.settings.defaults["PrimaryStance"].selected;
                end
                self.settings.defaults["PrimaryStance"] = { };
                self.settings.defaults["PrimaryStance"]         = { id = 1, name = 'Primary Stance', selected = vartemp, list = { "Strength", "Precision", "Endurance" } };
                if (self.settings.defaults["SecondaryStance"].selected == 4) then
                        vartemp = 1;
                else
                        vartemp = self.settings.defaults["SecondaryStance"].selected;
                end
                self.settings.defaults["SecondaryStance"] = { };
                self.settings.defaults["SecondaryStance"]       = { id = 2, name = 'Secondary Stance', selected = vartemp, list = { "Strength", "Precision", "Endurance" } };
                self.settings.traits["CombatPressOnward"]       = nil;
                vartemp = self.settings.traits["BardsArrow"].active;
                self.settings.traits["BardsArrow"] = { };
                self.settings.traits["BardsArrow"]                      = { id = 5, name = "Bard's Arrow", active = vartemp };
                vartemp = self.settings.traits["RainofThorns"].active;
                self.settings.traits["RainofThorns"] = { };
                self.settings.traits["RainofThorns"]            = { id = 6, name = "Rain of Thorns", active = vartemp };
        end

        if (settings.vers < 5.00) then
                self.settings.traits["StrongDraw"] = nil;
                self.settings.traits["ArrowStorm"] = nil;
                self.settings.traits["RainofThorns"].id = 2;
                self.settings.traits["BardsArrow"].id = 3;
                if (self.settings.userconf["BowInduct"] ~= nil) then
                        self.settings.userconf["BowInduct"].size[1] = self.settings.userconf["BowInduct"].size[1] + 1;
                        settings.skilldata["SplitShot"] = { parent = "BowInduct", pos = { self.settings.userconf["BowInduct"].size[1], 1 } };
                end
                if (self.settings.userconf["BowFocus"] ~= nil) then
                        self.settings.userconf["BowFocus"].size[1] = self.settings.userconf["BowFocus"].size[1] + 1;
                        settings.skilldata["HuntersArt"] = { parent = "BowFocus", pos = { self.settings.userconf["BowFocus"].size[1], 1 } };
                end
                if (self.settings.userconf["Fear"] ~= nil) then
                        self.settings.userconf["Fear"].defpos = {7,2};
                end
                if (self.settings.userconf["Dethreat"] ~= nil) then
                        self.settings.userconf["Dethreat"].defpos = {9,2};
                end
        end
        
        settings.vers = vars.vers;

end


-- REFRESH SKILLS AND BARS
function HunterBars: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["RainofThorns"]:SetActive(self.settings.traits["RainofThorns"].active);
        self.skills["BardsArrow"]:SetActive(self.settings.traits["BardsArrow"].active);
        self.skills["PressOnward"]:SetActive(self.settings.traits["PressOnward"].active);

        self.skills["FireOil"]:SetQuickslot(self.settings.quickslots["FireOil"]);
        self.skills["LightOil"]:SetQuickslot(self.settings.quickslots["LightOil"]);
        self.skills["BowChant"]:SetQuickslot(self.settings.quickslots["BowChant"]);
        
    self.multi["TrapsSlot"]:Clear();
        self.multi["TrapsSlot"]:AddShortCut("Trap1",            self.settings.quickslots["Trap1"]);
        self.multi["TrapsSlot"]:AddShortCut("Trap2",            self.settings.quickslots["Trap2"]);
        self.multi["TrapsSlot"]:AddShortCut("Trap3",            self.settings.quickslots["Trap3"]);
    self.multi["TrapsSlot"]:Refresh(true);
        
        self.multi["TrackingSlot"]:Clear();
        self.multi["TrackingSlot"]:AddShortCut("PassageofNature",       12, "0x70003F45");
    self.multi["TrackingSlot"]:AddShortCut("PassageofFoes",             22, "0x70003F46");
    self.multi["TrackingSlot"]:AddShortCut("PassageofShadow",   32, "0x70003F47");
    self.multi["TrackingSlot"]:LevelCheck();

        self.multi["StanceSlot"]:Clear();
        self.multi["StanceSlot"]:AddShortCut("StrengthStance",          6, "0x70003F4E");
    self.multi["StanceSlot"]:AddShortCut("PrecisionStance",             18, "0x70003F4D");
    self.multi["StanceSlot"]:AddShortCut("EnduranceStance",             28, "0x70003F4F");
    self.multi["StanceSlot"]:LevelCheck();

        self.multi["TrappingSlot"]:Clear();
        self.multi["TrappingSlot"]:AddShortCut("SetTrap",                       6, "0x700030BB");
    self.multi["TrappingSlot"]:AddShortCut("SetSnare",                  36, "0x7000A6B1");
    self.multi["TrappingSlot"]:LevelCheck();
        
        self.multi["PortsSlot"]:Clear();
    self.multi["PortsSlot"]:AddShortCut("GuidetoMichelDelving", 22, "0x7000A2C3");
    self.multi["PortsSlot"]:AddShortCut("GuidetoThorinsHall",   24, "0x70003F41");
        self.multi["PortsSlot"]:AddShortCut("ReturntoCamp",                     26, "0x7000A2C1");
    self.multi["PortsSlot"]:AddShortCut("GuidetoOstGuruth",             26, "0x7000A2C2");
    self.multi["PortsSlot"]:AddShortCut("GuidetoBree",                  32, "0x70003F42");
    self.multi["PortsSlot"]:AddShortCut("GuidetoEsteldin",              34, "0x70003F43");
    self.multi["PortsSlot"]:AddShortCut("GuidetoEvendim",               36, "0x7000A2C4");
    self.multi["PortsSlot"]:AddShortCut("GuidetoWestAngmar",    44, "0x7000A2C5");
    self.multi["PortsSlot"]:AddShortCut("GuidetoRivendell",             46, "0x70003F44");
    self.multi["PortsSlot"]:AddShortCut("GuidetoSuriKyla",              48, "0x70017C82");
    self.multi["PortsSlot"]:AddShortCut("GuidetoEastAngmar",    48, "0x7000A2C6");
    self.multi["PortsSlot"]:AddShortCut("GuidetoEchadDunann",   50, "0x70017C81");
    self.multi["PortsSlot"]:AddShortCut("GuidetoTwentyFirstHall",56, "0x70017C7A");
    self.multi["PortsSlot"]:AddShortCut("GuidetoMirkEaves",             62, "0x7001F459");
    self.multi["PortsSlot"]:AddShortCut("GuidetoHarndirion",    62, "0x700235EF");
    self.multi["PortsSlot"]:AddShortCut("GuidetoGaltrev",               70, "0x7002A93F");
        self.multi["PortsSlot"]:LevelCheck();
        
        if (self.settings.defaults["FindPathActive"].selected == 1) then
                self.skills["FindthePath"]:SetActive(true);
                self.skills["FindthePath"]:SetHover(false);
        elseif (self.settings.defaults["FindPathActive"].selected == 2) then
                self.skills["FindthePath"]:SetActive(true);
                self.skills["FindthePath"]:SetHover(self.effectlist["FindthePath"]:GetState());
        else
                self.skills["FindthePath"]:SetActive(not self.effectlist["FindthePath"]:GetState());
        end
        self.multi["TrappingSlot"]:SetCombat(self.settings.traits["CombatTraps"].active, true);

        if (settings.skilldata["PurgePoison"].parent ~= nil and vars.playerlevel >= self.skills["PurgePoison"].level[1] and self.settings.features["PoisonIndicator"].active and self.poison > 0) then
                if (self.settings.userconf[settings.skilldata["PurgePoison"].parent].active) then
                        self.skills["PurgePoison"]:SetColor("green");
                end
        else
                self.skills["PurgePoison"]:SetColor();
        end
        
    -- Refresh States
    self:CombatChange(vars.player:IsInCombat());
        self:StanceChange(vars.classattr:GetStance());
        self:FocusChange(vars.classattr:GetFocus());

end

Compare with Previous | Blame


All times are GMT -5. The time now is 02:29 PM.


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