Exemplo n.º 1
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();
        }
Exemplo n.º 2
0
        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");
        }
Exemplo n.º 3
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();

            // 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);
        }
Exemplo n.º 4
0
        private RedemptionModule(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)
            this.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.Normal();

            ItemCooldownController.SetCooldown(ITEM_ID, 0);
            WaitForItemInfo();

            // 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 + "Redemption/start.txt");
            animator.PreloadAnimation(ITEM_ANIMATION_PATH + "Redemption/impact.txt");

        }
Exemplo n.º 5
0
        // TODO: Handle champions with cooldown resets?

        protected ChampionModule(int ledCount, string champName, GameState gameState, LightingMode preferredLightingMode) // TODO: Pass gamestate instead of active player
        {
            Name         = champName;
            GameState    = gameState;
            LightingMode = preferredLightingMode;
            animator     = AnimationModule.Create(ledCount);

            LoadChampionInformation(champName);
        }
Exemplo n.º 6
0
        protected BaseGameModule(GameState gameState, AbilityCastPreference castMode)
        {
            PreferredCastMode = castMode;

            GameState = gameState;
            // Load animation module
            Animator         = AnimationModule.Create();
            CurrentLEDSource = Animator;
        }
        private LeagueOfLegendsModule(int ledCount)
        {
            // League of Legends integration Initialization
            Process[] pname = Process.GetProcessesByName("League of Legends");
            if (pname.Length == 0)
            {
                throw new InvalidOperationException("Game client is not open.");
            }

            // Queries the game information
            QueryPlayerInfo();

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

            // Load animation module
            animationModule = AnimationModule.Create(ledCount);
            animationModule.NewFrameReady += OnNewFrameReceived;

            // Load champion module. Different modules will be loaded depending on the champion.
            // If there is no suitable module for the selected champion, just the health bar will be displayed.

            // TODO: Make this easily extendable when there are many champion modules
            if (playerChampion.RawChampionName.ToLower().Contains("velkoz"))
            {
                championModule = VelKozModule.Create(ledCount, activePlayer);
                championModule.NewFrameReady        += OnNewFrameReceived;
                championModule.TriedToCastOutOfMana += OnAbilityCastNoMana;
            }
            CurrentLEDSource = championModule;

            // Sets up a task to always check for updated player info
            Task.Run(async() =>
            {
                while (true)
                {
                    QueryPlayerInfo();
                    await Task.Delay(150);
                }
            });

            // start frame timer
            Task.Run(FrameTimer);
        }
Exemplo n.º 8
0
        private VelKozModule(int ledCount, ActivePlayer playerInfo, string championName) : base(championName, playerInfo)
        {
            // Initialization for the champion module occurs here.
            // 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.PreloadAnimation(@"Animations/Vel'Koz/q_start.txt");
            animator.PreloadAnimation(@"Animations/Vel'Koz/q_recast.txt");
            animator.PreloadAnimation(@"Animations/Vel'Koz/w_cast.txt");
            animator.PreloadAnimation(@"Animations/Vel'Koz/w_close.txt");

            animator.NewFrameReady += (_, ls) => DispatchNewFrame(ls);

            KeyboardHookService.Instance.OnMouseClicked += OnMouseClick;
            KeyboardHookService.Instance.OnKeyPressed   += OnKeyPress;
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
 public GoalModule()
 {
     animator = AnimationModule.Create();
     animator.PreloadAnimation(GOAL_ANIM_PATH);
     animator.NewFrameReady += NewFrameReadyHandler;
 }
Exemplo n.º 11
0
 protected BaseRLModule()
 {
     // Load animation module
     Animator         = AnimationModule.Create();
     CurrentLEDSource = Animator;
 }