// Cooldown

        public HeraldEyeModule(GameState gameState, int itemSlot, AbilityCastPreference preferredCastMode)
            : base(ITEM_ID, ITEM_NAME, itemSlot, gameState, preferredCastMode, true)
        {
            // Initialization for the item module occurs here.

            ItemCooldownController.SetCooldown(ITEM_ID, 240000);
        }
Example #2
0
        private TwistedFateModule(int ledCount, GameState gameState, string championName, LightingMode preferredLightMode, AbilityCastPreference preferredCastMode)
            : base(ledCount, championName, gameState, preferredLightMode)
        {
            // Initialization for the champion module occurs here.

            // Set preferred cast mode. It's a player choice (Quick cast, Quick cast with indicator, or Normal cast)
            PreferredCastMode = preferredCastMode;

            // Set cast modes for abilities.
            Dictionary <AbilityKey, AbilityCastMode> abilityCastModes = new Dictionary <AbilityKey, AbilityCastMode>()
            {
                [AbilityKey.Q] = AbilityCastMode.Normal(),
                [AbilityKey.W] = AbilityCastMode.Instant(6000, 1),
                [AbilityKey.E] = AbilityCastMode.UnCastable(),
                [AbilityKey.R] = AbilityCastMode.Instant(6000, 1, AbilityCastMode.Normal()),
            };

            AbilityCastModes = abilityCastModes;

            // Preload all the animations you'll want to use. MAKE SURE that each animation file
            // has its Build Action set to "Content" and "Copy to Output Directory" is set to "Always".
            animator.PreloadAnimation(ANIMATION_PATH + "TwistedFate/q_cast.txt");
            animator.PreloadAnimation(ANIMATION_PATH + "TwistedFate/w_loop.txt");
            animator.PreloadAnimation(ANIMATION_PATH + "TwistedFate/r_cast.txt");

            ChampionInfoLoaded += OnChampionInfoLoaded;
        }
Example #3
0
        private LeagueOfLegendsModule(int ledCount, LightingMode mode, AbilityCastPreference castMode)
        {
            // League of Legends integration Initialization

            // Init Item Attributes
            ItemUtils.Init();
            ItemCooldownController.Init();

            this.preferredCastMode = castMode;

            // LED Initialization
            lightingMode = mode;
            this.leds    = new Led[ledCount];
            for (int i = 0; i < ledCount; i++)
            {
                leds[i] = new Led();
            }

            // Load animation module
            animationModule = AnimationModule.Create(this.leds.Length);
            animationModule.NewFrameReady += OnNewFrameReceived;
            CurrentLEDSource = animationModule;

            PlayLoadingAnimation();
            WaitForGameInitialization();
        }
        private HeraldEyeModule(int ledCount, GameState gameState, int itemID, int itemSlot, LightingMode preferredLightMode, AbilityCastPreference preferredCastMode)
            : base(itemID, itemSlot, gameState, preferredLightMode)
        {
            // Initialization for the item module occurs here.

            PreferredCastMode = preferredCastMode;

            ItemCast         += OnItemActivated;
            GameStateUpdated += OnGameStateUpdated;

            ItemCastMode = AbilityCastMode.Instant();

            ItemCooldownController.SetCooldown(ITEM_ID, 240000);

            // Preload all the animations you'll want to use. MAKE SURE that each animation file
            // has its Build Action set to "Content" and "Copy to Output Directory" is set to "Always".

            animator = AnimationModule.Create(ledCount);
            animator.NewFrameReady += (_, ls, mode) => DispatchNewFrame(ls, mode);

            animator.PreloadAnimation(ITEM_ANIMATION_PATH + "HeraldEye/anim_1.txt");
            animator.PreloadAnimation(ITEM_ANIMATION_PATH + "HeraldEye/anim_2.txt");
            animator.PreloadAnimation(ITEM_ANIMATION_PATH + "HeraldEye/anim_3.txt");
            animator.PreloadAnimation(ITEM_ANIMATION_PATH + "HeraldEye/anim_4.txt");
        }
        private WardingTotemModule(int ledCount, GameState gameState, int itemID, int itemSlot, LightingMode preferredLightMode, AbilityCastPreference preferredCastMode)
            : base(itemID, itemSlot, gameState, preferredLightMode)
        {
            // Initialization for the item module occurs here.

            // Set preferred cast mode. It's a player choice (Quick cast, Quick cast with indicator, or Normal cast)
            PreferredCastMode = preferredCastMode;

            ItemCast += OnItemActivated;

            /*GameStateUpdated += OnGameStateUpdated;
             * OnGameStateUpdated(gameState);*/

            // Set item cast mode.
            // For Oracle Lens, for example:
            // It's Instant Cast (press it, and the trinket activates)
            // For a ward, it's normal cast (press & click)
            ItemCastMode = AbilityCastMode.Normal();

            // TODO: This is because of a game bug, IT WILL GET FIXED and this will have to be changed
            ItemCooldownController.SetCooldown(this.ItemID, GetCooldownPerCharge(gameState));

            // Preload all the animations you'll want to use. MAKE SURE that each animation file
            // has its Build Action set to "Content" and "Copy to Output Directory" is set to "Always".

            animator = AnimationModule.Create(ledCount);
            animator.NewFrameReady += (_, ls, mode) => DispatchNewFrame(ls, mode);
        }
Example #6
0
        private XerathModule(int ledCount, GameState gameState, string championName, LightingMode preferredLightMode, AbilityCastPreference preferredCastMode)
            : base(ledCount, championName, gameState, preferredLightMode, true)
        {
            // Initialization for the champion module occurs here.

            // Set preferred cast mode. It's a player choice (Quick cast, Quick cast with indicator, or Normal cast)
            PreferredCastMode = preferredCastMode;

            // Set cast modes for abilities.
            // For Vel'Koz, for example:
            // Q -> Normal ability, but it can be recast within 1.15s
            // W -> Normal ability
            // E -> Normal ability
            // R -> Instant ability, it is cast the moment the key is pressed, but it can be recast within 2.3s
            Dictionary <AbilityKey, AbilityCastMode> abilityCastModes = new Dictionary <AbilityKey, AbilityCastMode>()
            {
                [AbilityKey.Q] = AbilityCastMode.Instant(3500, 1, AbilityCastMode.KeyUpRecast()),
                [AbilityKey.W] = AbilityCastMode.Normal(),
                [AbilityKey.E] = AbilityCastMode.Normal(),
                [AbilityKey.R] = AbilityCastMode.Instant(10000, 3, AbilityCastMode.Instant()), // TODO: Handle levels! Recast number changes
            };

            AbilityCastModes = abilityCastModes;

            ChampionInfoLoaded += OnChampionInfoLoaded;
            GameStateUpdated   += OnGameStateUpdated;
        }
        private VelKozModule(int ledCount, GameState gameState, string championName, LightingMode preferredLightMode, AbilityCastPreference preferredCastMode)
            : base(ledCount, championName, gameState, preferredLightMode)
        {
            // Initialization for the champion module occurs here.

            // Set preferred cast mode. It's a player choice (Quick cast, Quick cast with indicator, or Normal cast)
            PreferredCastMode = preferredCastMode;

            // Set cast modes for abilities.
            // For Vel'Koz, for example:
            // Q -> Normal ability, but it can be recast within 1.15s
            // W -> Normal ability
            // E -> Normal ability
            // R -> Instant ability, it is cast the moment the key is pressed, but it can be recast within 2.3s
            Dictionary <AbilityKey, AbilityCastMode> abilityCastModes = new Dictionary <AbilityKey, AbilityCastMode>()
            {
                [AbilityKey.Q] = AbilityCastMode.Normal(1150),
                [AbilityKey.W] = AbilityCastMode.Normal(),
                [AbilityKey.E] = AbilityCastMode.Normal(),
                [AbilityKey.R] = AbilityCastMode.Instant(2300),
            };

            AbilityCastModes = abilityCastModes;

            // Preload all the animations you'll want to use. MAKE SURE that each animation file
            // has its Build Action set to "Content" and "Copy to Output Directory" is set to "Always".
            animator.PreloadAnimation(ANIMATION_PATH + "Vel'Koz/q_start.txt");
            animator.PreloadAnimation(ANIMATION_PATH + "Vel'Koz/q_recast.txt");
            animator.PreloadAnimation(ANIMATION_PATH + "Vel'Koz/w_cast.txt");
            animator.PreloadAnimation(ANIMATION_PATH + "Vel'Koz/w_close.txt");
            animator.PreloadAnimation(ANIMATION_PATH + "Vel'Koz/r_loop.txt");


            ChampionInfoLoaded += OnChampionInfoLoaded;
        }
Example #8
0
        private JaxModule(int ledCount, GameState gameState, string championName, LightingMode preferredLightMode, AbilityCastPreference preferredCastMode)
            : base(ledCount, championName, gameState, preferredLightMode, true)
        {
            // Initialization for the champion module occurs here.

            // Set preferred cast mode. It's a player choice (Quick cast, Quick cast with indicator, or Normal cast)
            PreferredCastMode = preferredCastMode;

            // Set cast modes for abilities.
            // For Vel'Koz, for example:
            // Q -> Normal ability, but it can be recast within 1.15s
            // W -> Normal ability
            // E -> Normal ability
            // R -> Instant ability, it is cast the moment the key is pressed, but it can be recast within 2.3s
            Dictionary <AbilityKey, AbilityCastMode> abilityCastModes = new Dictionary <AbilityKey, AbilityCastMode>()
            {
                [AbilityKey.Q] = AbilityCastMode.PointAndClick(),
                [AbilityKey.W] = AbilityCastMode.Instant(),
                [AbilityKey.E] = AbilityCastMode.Instant(recastTime: 3000),
                [AbilityKey.R] = AbilityCastMode.Instant(),
            };

            AbilityCastModes = abilityCastModes;

            ChampionInfoLoaded += OnChampionInfoLoaded;
        }
Example #9
0
        // Variables


        // Cooldown

        public RedemptionModule(GameState gameState, int itemSlot, AbilityCastPreference preferredCastMode)
            : base(ITEM_ID, ITEM_NAME, itemSlot, gameState, preferredCastMode, true)
        {
            // Initialization for the item module occurs here.

            ItemCooldownController.SetCooldown(ITEM_ID, 0);
            WaitForItemInfo();
        }
        public WardingTotemModule(GameState gameState, int itemSlot, AbilityCastPreference preferredCastMode)
            : base(ITEM_ID, ITEM_NAME, itemSlot, gameState, preferredCastMode, true)
        {
            // Initialization for the item module occurs here.

            // TODO: This is because of a game bug, IT WILL GET FIXED and this will have to be changed
            ItemCooldownController.SetCooldown(this.ItemID, GetCooldownPerCharge());
        }
Example #11
0
        protected BaseGameModule(GameState gameState, AbilityCastPreference castMode)
        {
            PreferredCastMode = castMode;

            GameState = gameState;
            // Load animation module
            Animator         = AnimationModule.Create();
            CurrentLEDSource = Animator;
        }
        // TODO: Handle champions with cooldown resets?

        protected GameElementModule(string name, GameState gameState, AbilityCastPreference preferredCastMode, bool preloadAllAnimations = false)
            : base(gameState, preferredCastMode)
        {
            Name = name;

            if (preloadAllAnimations)
            {
                PreloadAllAnimations();
            }
        }
        // Events

        /// <summary>
        /// Creates a new <see cref="LeagueOfLegendsModule"/> instance.
        /// </summary>
        /// <param name="ledCount">Number of LEDs in the strip</param>
        public static LeagueOfLegendsModule Create(Dictionary <string, string> options)
        {
            AbilityCastPreference castMode = AbilityCastPreference.Normal;

            if (options.ContainsKey("castMode"))
            {
                castMode = GetCastPreference(options["castMode"]);
            }
            return(new LeagueOfLegendsModule(castMode));
        }
Example #14
0
        // TODO: Handle champions with cooldown resets?

        protected ChampionModule(string champName, GameState gameState, AbilityCastPreference preferredCastMode, bool preloadAllAnimations = false) // TODO: Pass gamestate instead of active player
            : base(champName, gameState, preferredCastMode, preloadAllAnimations)
        {
            AbilityCastModes = new Dictionary <AbilityKey, AbilityCastMode>
            {
                [AbilityKey.Q] = GetQCastMode(),
                [AbilityKey.W] = GetWCastMode(),
                [AbilityKey.E] = GetECastMode(),
                [AbilityKey.R] = GetRCastMode(),
            };

            LoadChampionInformation(champName);

            ChampionInfoLoaded += OnChampionInfoLoaded;
        }
Example #15
0
        protected ItemModule(int itemID, string name, int itemSlot, GameState state, AbilityCastPreference preferredCastMode, bool preloadAllAnimations = false)
            : base(name, state, preferredCastMode, preloadAllAnimations)
        {
            ItemAttributes     = ItemUtils.GetItemAttributes(itemID);
            this.ItemID        = itemID;
            this.itemSlot      = itemSlot;
            this.activationKey = GetKeyForItemSlot(itemSlot); // TODO: Handle key rebinds...

            ItemCast    += OnItemActivated;
            ItemCastMode = GetItemCastMode();

            AddAnimatorEvent();
            // Should this be needed for all items modules? Only active ones
            AddInputHandlers();
        }
Example #16
0
        private WardingTotemModule(int ledCount, GameState gameState, int itemID, int itemSlot, LightingMode preferredLightMode, AbilityCastPreference preferredCastMode)
            : base(itemID, itemSlot, gameState, preferredLightMode)
        {
            // Initialization for the item module occurs here.

            // Set preferred cast mode. It's a player choice (Quick cast, Quick cast with indicator, or Normal cast)
            PreferredCastMode = preferredCastMode;

            ItemCast += OnItemActivated;

            /*GameStateUpdated += OnGameStateUpdated;
             * OnGameStateUpdated(gameState);*/

            // Set item cast mode.
            // For Oracle Lens, for example:
            // It's Instant Cast (press it, and the trinket activates)
            // For a ward, it's normal cast (press & click)
            ItemCastMode = AbilityCastMode.Normal();

            ItemCooldownController.SetCooldown(this.ItemID, GetCooldownPerCharge(gameState)); // Game bug? Set the cooldown to 0, because everytime

            // Since it's a ward trinket, setup ward recharging

            /*Task.Run(async () =>
             * {
             *  while (true)
             *  {
             *      if (wardCharges < 2)
             *      {
             *          await Task.Delay(cooldownPerCharge);
             *          wardCharges++;
             *      } else
             *      {
             *          await Task.Delay(300);
             *      }
             *  }
             *
             * });*/

            // Preload all the animations you'll want to use. MAKE SURE that each animation file
            // has its Build Action set to "Content" and "Copy to Output Directory" is set to "Always".

            animator = AnimationModule.Create(ledCount);
            animator.NewFrameReady += (_, ls, mode) => DispatchNewFrame(ls, mode);
        }
Example #17
0
        private XerathModule(int ledCount, GameState gameState, string championName, LightingMode preferredLightMode, AbilityCastPreference preferredCastMode)
            : base(ledCount, championName, gameState, preferredLightMode)
        {
            // Initialization for the champion module occurs here.

            // Set preferred cast mode. It's a player choice (Quick cast, Quick cast with indicator, or Normal cast)
            PreferredCastMode = preferredCastMode;

            // Set cast modes for abilities.
            // For Vel'Koz, for example:
            // Q -> Normal ability, but it can be recast within 1.15s
            // W -> Normal ability
            // E -> Normal ability
            // R -> Instant ability, it is cast the moment the key is pressed, but it can be recast within 2.3s
            Dictionary <AbilityKey, AbilityCastMode> abilityCastModes = new Dictionary <AbilityKey, AbilityCastMode>()
            {
                [AbilityKey.Q] = AbilityCastMode.Instant(3500, 1, AbilityCastMode.KeyUpRecast()),
                [AbilityKey.W] = AbilityCastMode.Normal(),
                [AbilityKey.E] = AbilityCastMode.Normal(),
                [AbilityKey.R] = AbilityCastMode.Instant(10000, 3, AbilityCastMode.Instant()), // TODO: Handle levels! Recast number changes
            };

            AbilityCastModes = abilityCastModes;

            // Preload all the animations you'll want to use. MAKE SURE that each animation file
            // has its Build Action set to "Content" and "Copy to Output Directory" is set to "Always".

            animator.PreloadAnimation(ANIMATION_PATH + "Xerath/q_charge.txt");
            animator.PreloadAnimation(ANIMATION_PATH + "Xerath/q_retract.txt");
            animator.PreloadAnimation(ANIMATION_PATH + "Xerath/w_cast.txt");
            animator.PreloadAnimation(ANIMATION_PATH + "Xerath/e_cast.txt");
            animator.PreloadAnimation(ANIMATION_PATH + "Xerath/r_launch.txt");
            animator.PreloadAnimation(ANIMATION_PATH + "Xerath/r_open.txt");


            ChampionInfoLoaded += OnChampionInfoLoaded;
            GameStateUpdated   += OnGameStateUpdated;
        }
        private OracleLensModule(int ledCount, GameState gameState, int itemID, int itemSlot, LightingMode preferredLightMode, AbilityCastPreference preferredCastMode)
            : base(itemID, itemSlot, gameState, preferredLightMode)
        {
            // Initialization for the item module occurs here.

            // Set preferred cast mode. It's a player choice (Quick cast, Quick cast with indicator, or Normal cast)
            PreferredCastMode = preferredCastMode;

            ItemCast         += OnItemActivated;
            GameStateUpdated += OnGameStateUpdated;
            // Set item cast mode.
            // For Oracle Lens, for example:
            // It's Instant Cast (press it, and the trinket activates)
            // For a ward, it's normal cast (press & click)
            ItemCastMode = AbilityCastMode.Instant();

            // Preload all the animations you'll want to use. MAKE SURE that each animation file
            // has its Build Action set to "Content" and "Copy to Output Directory" is set to "Always".

            animator = AnimationModule.Create(ledCount);
            animator.NewFrameReady += (_, ls, mode) => DispatchNewFrame(ls, mode);

            animator.PreloadAnimation(ITEM_ANIMATION_PATH + "OracleLens/activation.txt");
        }
Example #19
0
        /// <summary>
        /// Creates a new <see cref="LeagueOfLegendsModule"/> instance.
        /// </summary>
        /// <param name="ledCount">Number of LEDs in the strip</param>
        public static LeagueOfLegendsModule Create(LightingMode preferLightMode, int ledCount, Dictionary <string, string> options)
        {
            AbilityCastPreference castMode = AbilityCastPreference.Normal;

            if (options.ContainsKey("castMode"))
            {
                if (options["castMode"] == "quick")
                {
                    castMode = AbilityCastPreference.Quick;
                }
                else if (options["castMode"] == "quickindicator")
                {
                    castMode = AbilityCastPreference.QuickWithIndicator;
                }
            }
            if (preferLightMode == LightingMode.Keyboard)
            {
                return(new LeagueOfLegendsModule(88, preferLightMode, castMode));
            }
            else
            {
                return(new LeagueOfLegendsModule(ledCount, preferLightMode, castMode));
            }
        }
Example #20
0
        // Cooldown

        /// <summary>
        /// Creates a new champion instance.
        /// </summary>
        /// <param name="ledCount">Number of LEDs in the strip</param>
        /// <param name="gameState">Game state data</param>
        /// <param name="preferredLightMode">Preferred light mode</param>
        /// <param name="preferredCastMode">Preferred ability cast mode (Normal, Quick Cast, Quick Cast with Indicator)</param>
        public static HeraldEyeModule Create(int ledCount, GameState gameState, int itemSlot, LightingMode preferredLightMode, AbilityCastPreference preferredCastMode = AbilityCastPreference.Normal)
        {
            return(new HeraldEyeModule(ledCount, gameState, ITEM_ID, itemSlot, preferredLightMode, preferredCastMode));
        }
Example #21
0
 public TwistedFateModule(GameState gameState, AbilityCastPreference preferredCastMode)
     : base(CHAMPION_NAME, gameState, preferredCastMode, true)
 {
     // Initialization for the champion module occurs here.
 }
        bool rCastInProgress = false; // this is used to make the animation for Vel'Koz's R to take preference over other animations


        /// <summary>
        /// Creates a new champion instance.
        /// </summary>
        /// <param name="ledCount">Number of LEDs in the strip</param>
        /// <param name="gameState">Game state data</param>
        /// <param name="preferredLightMode">Preferred light mode</param>
        /// <param name="preferredCastMode">Preferred ability cast mode (Normal, Quick Cast, Quick Cast with Indicator)</param>
        public static VelKozModule Create(int ledCount, GameState gameState, LightingMode preferredLightMode, AbilityCastPreference preferredCastMode = AbilityCastPreference.Normal)
        {
            return(new VelKozModule(ledCount, gameState, "Velkoz", preferredLightMode, preferredCastMode));
        }
Example #23
0
 /// <summary>
 /// Creates a new champion instance.
 /// </summary>
 /// <param name="ledCount">Number of LEDs in the strip</param>
 /// <param name="gameState">Game state data</param>
 /// <param name="preferredLightMode">Preferred light mode</param>
 /// <param name="preferredCastMode">Preferred ability cast mode (Normal, Quick Cast, Quick Cast with Indicator)</param>
 public static AhriModule Create(int ledCount, GameState gameState, LightingMode preferredLightMode, AbilityCastPreference preferredCastMode = AbilityCastPreference.Normal)
 {
     return(new AhriModule(ledCount, gameState, CHAMPION_NAME, preferredLightMode, preferredCastMode));
 }
Example #24
0
        // Variables


        // Cooldown

        public OracleLensModule(int ledCount, GameState gameState, int itemSlot, AbilityCastPreference preferredCastMode)
            : base(ITEM_ID, ITEM_NAME, itemSlot, gameState, preferredCastMode, true)
        {
            // Initialization for the item module occurs here.
        }