示例#1
0
 private void OnGameStateUpdated(GameState state) // TODO: Handle when player buys a different trinket and cooldown gets transferred over
 {
     // Check the cooldown
     if (ItemCooldownController.GetCooldownRemaining(ITEM_ID) < 30000 && !didWarning)
     {
         didWarning = true;
         RequestLEDActivation(); // needed for showing animations
         Task.Run(async() =>
         {
             for (int i = 0; i < 3; i++)
             {
                 if (wasCast)
                 {
                     return;
                 }
                 await animator.HoldColor(PurpleColor, 300);
                 if (wasCast)
                 {
                     return;
                 }
                 animator.StopCurrentAnimation();
                 await Task.Delay(300);
             }
         });
     }
 }
        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");

        }
示例#3
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");
        }
        // 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);
        }
        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);
        }
示例#6
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());
        }
示例#8
0
        protected override void OnItemActivated(object s, EventArgs e) // TODO: Redemption can be used when dead!
        {
            if (!ItemCooldownController.IsOnCooldown(ITEM_ID))
            {
                // Play relevant animations here
                RunAnimationOnce("start", LightZone.Keyboard, timeScale: 0.08f);
                RunAnimationOnce("impact", LightZone.Keyboard, 0.05f);

                ItemCooldownController.SetCooldown(ITEM_ID, CooldownDuration);
            }
        }
        protected override void OnItemActivated(object s, EventArgs e)
        {
            // Play relevant animations here
            RunAnimationOnce("activation", LightZone.Keyboard, 3f);

            double avgChampLevel = GameState.AverageChampionLevel;

            ItemCooldownController.SetCooldown(ITEM_ID, GetCooldownDuration(avgChampLevel));
            ItemCooldownController.SetCooldown(OracleLensModule.ITEM_ID,
                                               OracleLensModule.GetCooldownDuration(avgChampLevel));
        }
        private void OnItemActivated(object s, EventArgs e)
        {
            // Play relevant animations here
            animator.RunAnimationOnce(ITEM_ANIMATION_PATH + "FarsightAlteration/activation.txt", false, 0.05f);

            double avgChampLevel = ItemCooldownController.GetAverageChampionLevel(GameState);

            ItemCooldownController.SetCooldown(ITEM_ID, GetCooldownDuration(avgChampLevel));
            ItemCooldownController.SetCooldown(OracleLensModule.ITEM_ID,
                                               OracleLensModule.GetCooldownDuration(avgChampLevel));
        }
示例#11
0
        protected override void OnItemActivated(object s, EventArgs e)
        {
            if (ItemCooldownController.IsOnCooldown(ITEM_ID))
            {
                return;                                               // If the item is on cooldown, nothing to do here.
            }
            // Play relevant animations here
            RunAnimationInLoop("activation", LightZone.Keyboard, 8.5f);

            double avgChampLevel = GameState.AverageChampionLevel;

            ItemCooldownController.SetCooldown(ITEM_ID, GetCooldownDuration(avgChampLevel));
            ItemCooldownController.SetCooldown(FarsightAlterationModule.ITEM_ID,
                                               FarsightAlterationModule.GetCooldownDuration(avgChampLevel));
        }
示例#12
0
        private void OnItemActivated(object s, EventArgs e)
        {
            if (ItemCooldownController.IsOnCooldown(ITEM_ID))
            {
                return;                                               // If the item is on cooldown, nothing to do here.
            }
            // Play relevant animations here
            animator.RunAnimationInLoop(ITEM_ANIMATION_PATH + "OracleLens/activation.txt", 8500);

            double avgChampLevel = ItemCooldownController.GetAverageChampionLevel(GameState);

            ItemCooldownController.SetCooldown(ITEM_ID, GetCooldownDuration(avgChampLevel));
            ItemCooldownController.SetCooldown(FarsightAlterationModule.ITEM_ID,
                                               FarsightAlterationModule.GetCooldownDuration(avgChampLevel));
        }
示例#13
0
        private static void WardView(Led[] leds, LightingMode lightMode, GameState gameState)
        {
            if (lightMode != LightingMode.Keyboard)
            {
                return;                                     // TODO: Implement some sort of notification for LED strip perhaps
            }
            Item trinket = gameState.PlayerChampion.Items.FirstOrDefault(x => x.Slot == 6);

            if (trinket == null ||
                (ItemCooldownController.IsSlotOnCooldown(6) &&
                 trinket.ItemID != ItemModules.WardingTotemModule.ITEM_ID &&
                 trinket.ItemID != ItemModules.HeraldEyeModule.ITEM_ID))
            {
                // if trinket is on cooldown, set black
                foreach (int k in trinketKeys)
                {
                    leds[k].SetBlack();
                }
            }
            else
            {
                HSVColor col = HSVColor.Black;
                if (trinket.ItemID == 3340)
                {
                    if (ItemModules.WardingTotemModule.Current.HasCharge)
                    {
                        col = YellowTrinketColor;
                    }
                }
                else if (trinket.ItemID == 3364)
                {
                    col = RedTrinketColor;
                }
                else if (trinket.ItemID == 3363)
                {
                    col = BlueTrinketColor;
                }
                else if (trinket.ItemID == 3513)
                {
                    col = HeraldColor;
                }
                // TODO: HANDLE HERALD EYE
                foreach (int k in trinketKeys)
                {
                    leds[k].Color(col);
                }
            }
        }
示例#14
0
        private void OnItemActivated(object s, EventArgs e) // TODO: Redemption can be used when dead!
        {
            if (!ItemCooldownController.IsOnCooldown(ITEM_ID))
            {
                // Play relevant animations here
                Task.Run(async () =>
                {
                    await animator.RunAnimationOnce(ITEM_ANIMATION_PATH + "Redemption/start.txt", true, timeScale: 0.08f);
                    _ = animator.RunAnimationOnce(ITEM_ANIMATION_PATH + "Redemption/impact.txt", false, 0.05f);
                });

                ItemCooldownController.SetCooldown(ITEM_ID, CooldownDuration);
            }
            

        }
示例#15
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);
        }
示例#16
0
        private void OnItemActivated(object s, EventArgs e)
        {
            int wardCharges           = 0;
            int cd                    = ItemCooldownController.GetCooldownRemaining(this.ItemID);
            int cdpercharge           = GetCooldownPerCharge(GameState);
            int rechargedSecondCharge = -1;

            if (cd > cdpercharge)
            {
                wardCharges = 0;
            }
            else if (cd > 0)
            {
                wardCharges           = 1;
                rechargedSecondCharge = cdpercharge - cd;
            }
            else
            {
                wardCharges = 2;
            }

            if (wardCharges > 0)
            {
                if (wardCharges > 1)
                {
                    ItemCooldownController.SetCooldown(ITEM_ID, GetCooldownPerCharge(GameState) + 1800); // Warding small 2s cooldown
                }
                else
                {
                    // some magic here regarding trinket cooldowns to handle edge cases when you swap trinkets.
                    ItemCooldownController.SetCooldown(ITEM_ID, GetCooldownPerCharge(GameState) * 2 - rechargedSecondCharge - 100);
                    ItemCooldownController // this trinket affects the other trinket cooldowns
                    .SetCooldown(
                        FarsightAlterationModule.ITEM_ID,
                        FarsightAlterationModule.GetCooldownDuration(ItemCooldownController.GetAverageChampionLevel(GameState)) - rechargedSecondCharge - 100);
                    ItemCooldownController
                    .SetCooldown(
                        OracleLensModule.ITEM_ID,
                        OracleLensModule.GetCooldownDuration(ItemCooldownController.GetAverageChampionLevel(GameState)) - rechargedSecondCharge - 100);

                    //CooldownDuration = cooldownPerCharge - 100; // substract some duration to account for other delays;
                }
                wardCharges--;
            }
        }
 private int GetCooldownPerCharge(GameState state)
 {
     return(GetCooldownDuration(ItemCooldownController.GetAverageChampionLevel(state)));
 }