예제 #1
0
파일: Program.cs 프로젝트: djole353/port2
        public static void CastSpell(Spell QWER, Obj_AI_Base target)
        {
            int       predIndex = 0;
            HitChance hitchance = HitChance.Low;

            if (QWER.Slot == SpellSlot.Q)
            {
                predIndex = Config.Item("Qpred", true).GetValue <StringList>().SelectedIndex;
                if (Config.Item("QHitChance", true).GetValue <StringList>().SelectedIndex == 0)
                {
                    hitchance = HitChance.VeryHigh;
                }
                else if (Config.Item("QHitChance", true).GetValue <StringList>().SelectedIndex == 1)
                {
                    hitchance = HitChance.High;
                }
                else if (Config.Item("QHitChance", true).GetValue <StringList>().SelectedIndex == 2)
                {
                    hitchance = HitChance.Medium;
                }
            }
            else if (QWER.Slot == SpellSlot.W)
            {
                predIndex = Config.Item("Wpred", true).GetValue <StringList>().SelectedIndex;
                if (Config.Item("WHitChance", true).GetValue <StringList>().SelectedIndex == 0)
                {
                    hitchance = HitChance.VeryHigh;
                }
                else if (Config.Item("WHitChance", true).GetValue <StringList>().SelectedIndex == 1)
                {
                    hitchance = HitChance.High;
                }
                else if (Config.Item("WHitChance", true).GetValue <StringList>().SelectedIndex == 2)
                {
                    hitchance = HitChance.Medium;
                }
            }
            else if (QWER.Slot == SpellSlot.E)
            {
                predIndex = Config.Item("Epred", true).GetValue <StringList>().SelectedIndex;
                if (Config.Item("EHitChance", true).GetValue <StringList>().SelectedIndex == 0)
                {
                    hitchance = HitChance.VeryHigh;
                }
                else if (Config.Item("EHitChance", true).GetValue <StringList>().SelectedIndex == 1)
                {
                    hitchance = HitChance.High;
                }
                else if (Config.Item("EHitChance", true).GetValue <StringList>().SelectedIndex == 2)
                {
                    hitchance = HitChance.Medium;
                }
            }
            else if (QWER.Slot == SpellSlot.R)
            {
                predIndex = Config.Item("Rpred", true).GetValue <StringList>().SelectedIndex;
                if (Config.Item("RHitChance", true).GetValue <StringList>().SelectedIndex == 0)
                {
                    hitchance = HitChance.VeryHigh;
                }
                else if (Config.Item("RHitChance", true).GetValue <StringList>().SelectedIndex == 1)
                {
                    hitchance = HitChance.High;
                }
                else if (Config.Item("RHitChance", true).GetValue <StringList>().SelectedIndex == 2)
                {
                    hitchance = HitChance.Medium;
                }
            }

            if (predIndex == 3)
            {
                SebbyLib.Movement.SkillshotType CoreType2 = SebbyLib.Movement.SkillshotType.SkillshotLine;
                bool aoe2 = false;

                if (QWER.Type == SkillshotType.SkillshotCircle)
                {
                    //CoreType2 = SebbyLib.Movement.SkillshotType.SkillshotCircle;
                    //aoe2 = true;
                }

                if (QWER.Width > 80 && !QWER.Collision)
                {
                    aoe2 = true;
                }

                var predInput2 = new SebbyLib.Movement.PredictionInput
                {
                    Aoe       = aoe2,
                    Collision = QWER.Collision,
                    Speed     = QWER.Speed,
                    Delay     = QWER.Delay,
                    Range     = QWER.Range,
                    From      = Player.ServerPosition,
                    Radius    = QWER.Width,
                    Unit      = target,
                    Type      = CoreType2
                };
                var poutput2 = SebbyLib.Movement.Prediction.GetPrediction(predInput2);

                //var poutput2 = QWER.GetPrediction(target);

                if (QWER.Speed != float.MaxValue && OktwCommon.CollisionYasuo(Player.ServerPosition, poutput2.CastPosition))
                {
                    return;
                }

                if ((int)hitchance == 6)
                {
                    if (poutput2.Hitchance >= SebbyLib.Movement.HitChance.VeryHigh)
                    {
                        QWER.Cast(poutput2.CastPosition);
                    }
                    else if (predInput2.Aoe && poutput2.AoeTargetsHitCount > 1 && poutput2.Hitchance >= SebbyLib.Movement.HitChance.High)
                    {
                        QWER.Cast(poutput2.CastPosition);
                    }
                }
                else if ((int)hitchance == 5)
                {
                    if (poutput2.Hitchance >= SebbyLib.Movement.HitChance.High)
                    {
                        QWER.Cast(poutput2.CastPosition);
                    }
                }
                else if ((int)hitchance == 4)
                {
                    if (poutput2.Hitchance >= SebbyLib.Movement.HitChance.Medium)
                    {
                        QWER.Cast(poutput2.CastPosition);
                    }
                }
            }
            else if (predIndex == 1)
            {
                SebbyLib.Prediction.SkillshotType CoreType2 = SebbyLib.Prediction.SkillshotType.SkillshotLine;
                bool aoe2 = false;

                if (QWER.Type == SkillshotType.SkillshotCircle)
                {
                    CoreType2 = SebbyLib.Prediction.SkillshotType.SkillshotCircle;
                    aoe2      = true;
                }

                if (QWER.Width > 80 && !QWER.Collision)
                {
                    aoe2 = true;
                }

                var predInput2 = new SebbyLib.Prediction.PredictionInput
                {
                    Aoe       = aoe2,
                    Collision = QWER.Collision,
                    Speed     = QWER.Speed,
                    Delay     = QWER.Delay,
                    Range     = QWER.Range,
                    From      = Player.ServerPosition,
                    Radius    = QWER.Width,
                    Unit      = target,
                    Type      = CoreType2
                };
                var poutput2 = SebbyLib.Prediction.Prediction.GetPrediction(predInput2);

                //var poutput2 = QWER.GetPrediction(target);

                if (QWER.Speed != float.MaxValue && OktwCommon.CollisionYasuo(Player.ServerPosition, poutput2.CastPosition))
                {
                    return;
                }

                if (poutput2.AoeTargetsHitCount > 1 && poutput2.Hitchance >= SebbyLib.Prediction.HitChance.High)
                {
                    Console.WriteLine("AOE cast");
                    QWER.Cast(poutput2.CastPosition);
                }

                if ((int)hitchance == 6)
                {
                    if (poutput2.Hitchance >= SebbyLib.Prediction.HitChance.VeryHigh)
                    {
                        QWER.Cast(poutput2.CastPosition);
                    }
                    else if (predInput2.Aoe && poutput2.AoeTargetsHitCount > 1 && poutput2.Hitchance >= SebbyLib.Prediction.HitChance.High)
                    {
                        QWER.Cast(poutput2.CastPosition);
                    }
                }
                else if ((int)hitchance == 5)
                {
                    if (poutput2.Hitchance >= SebbyLib.Prediction.HitChance.High)
                    {
                        QWER.Cast(poutput2.CastPosition);
                    }
                }
                else if ((int)hitchance == 4)
                {
                    if (poutput2.Hitchance >= SebbyLib.Prediction.HitChance.Medium)
                    {
                        QWER.Cast(poutput2.CastPosition);
                    }
                }
                if (Game.Time - DrawSpellTime > 0.5)
                {
                    DrawSpell     = QWER;
                    DrawSpellTime = Game.Time;
                }
                DrawSpellPos = poutput2;
            }
            else if (predIndex == 0)
            {
                QWER.CastIfHitchanceEquals(target, hitchance);
            }
            else if (predIndex == 2)
            {
                if (target is AIHeroClient && target.IsValid)
                {
                    var t = target as AIHeroClient;
                    QWER.SPredictionCast(t, hitchance);
                }
                else
                {
                    QWER.CastIfHitchanceEquals(target, HitChance.High);
                }
            }
            else if (predIndex == 4)
            {
                PortAIO.SkillshotType CoreType2 = PortAIO.SkillshotType.SkillshotLine;
                bool aoe2 = false;

                if (QWER.Type == SkillshotType.SkillshotCircle)
                {
                    CoreType2 = PortAIO.SkillshotType.SkillshotCircle;
                    aoe2      = true;
                }

                if (QWER.Width > 80 && !QWER.Collision)
                {
                    aoe2 = true;
                }

                var predInput2 = new PortAIO.PredictionInput
                {
                    Aoe       = aoe2,
                    Collision = QWER.Collision,
                    Speed     = QWER.Speed,
                    Delay     = QWER.Delay,
                    Range     = QWER.Range,
                    From      = Player.ServerPosition,
                    Radius    = QWER.Width,
                    Unit      = target,
                    Type      = CoreType2
                };
                var poutput2 = PortAIO.Prediction.GetPrediction(predInput2);

                if (QWER.Speed != float.MaxValue && OktwCommon.CollisionYasuo(Player.ServerPosition, poutput2.CastPosition))
                {
                    return;
                }

                if ((int)hitchance == 6)
                {
                    if (poutput2.Hitchance >= PortAIO.HitChance.VeryHigh)
                    {
                        QWER.Cast(poutput2.CastPosition);
                    }
                    else if (predInput2.Aoe && poutput2.AoeTargetsHitCount > 1 && poutput2.Hitchance >= PortAIO.HitChance.High)
                    {
                        QWER.Cast(poutput2.CastPosition);
                    }
                }
                else if ((int)hitchance == 5)
                {
                    if (poutput2.Hitchance >= PortAIO.HitChance.High)
                    {
                        QWER.Cast(poutput2.CastPosition);
                    }
                }
                else if ((int)hitchance == 4)
                {
                    if (poutput2.Hitchance >= PortAIO.HitChance.Medium)
                    {
                        QWER.Cast(poutput2.CastPosition);
                    }
                }
            }
        }
예제 #2
0
        public static void Spellbook_OnCastSpell(Spellbook sender, SpellbookCastSpellEventArgs args)
        {
            if (sender.Owner.IsMe)
            {
                if (LSPredictioner.Config.Item("ENABLED").GetValue <bool>() && (LSPredictioner.Config.Item("COMBOKEY").GetValue <KeyBind>().Active || LSPredictioner.Config.Item("HARASSKEY").GetValue <KeyBind>().Active))
                {
                    if (!Utility.IsValidSlot(args.Slot))
                    {
                        return;
                    }

                    if (LSPredictioner.Spells[(int)args.Slot] == null)
                    {
                        return;
                    }

                    if (!LSPredictioner.Config.Item(String.Format("{0}{1}", ObjectManager.Player.ChampionName, args.Slot)).GetValue <bool>())
                    {
                        return;
                    }

                    if (handleEvent[(int)args.Slot])
                    {
                        args.Process = false;

                        var enemy = TargetSelector.GetTarget(LSPredictioner.Spells[(int)args.Slot].Range, TargetSelector.DamageType.Physical);

                        var QWER = LSPredictioner.Spells[(int)args.Slot];

                        if (enemy != null)
                        {
                            var predInput2 = new PortAIO.PredictionInput
                            {
                                Collision = QWER.Collision,
                                Speed     = QWER.Speed,
                                Delay     = QWER.Delay,
                                Range     = QWER.Range,
                                From      = Player.ServerPosition,
                                Radius    = QWER.Width,
                                Unit      = enemy,
                            };

                            var poutput2 = PortAIO.Prediction.GetPrediction(predInput2);

                            if (ShineCommon.Utility.HitchanceArray[LSPredictioner.Config.Item("SPREDHITC").GetValue <StringList>().SelectedIndex] == HitChance.VeryHigh)
                            {
                                if (poutput2.Hitchance >= PortAIO.HitChance.VeryHigh)
                                {
                                    if (QWER.Cast(poutput2.CastPosition))
                                    {
                                        handleEvent[(int)args.Slot] = false;
                                    }
                                }
                            }
                            else if (ShineCommon.Utility.HitchanceArray[LSPredictioner.Config.Item("SPREDHITC").GetValue <StringList>().SelectedIndex] == HitChance.High)
                            {
                                if (poutput2.Hitchance >= PortAIO.HitChance.High)
                                {
                                    if (QWER.Cast(poutput2.CastPosition))
                                    {
                                        handleEvent[(int)args.Slot] = false;
                                    }
                                }
                            }
                            else if (ShineCommon.Utility.HitchanceArray[LSPredictioner.Config.Item("SPREDHITC").GetValue <StringList>().SelectedIndex] == HitChance.Medium)
                            {
                                if (poutput2.Hitchance >= PortAIO.HitChance.Medium)
                                {
                                    if (QWER.Cast(poutput2.CastPosition))
                                    {
                                        handleEvent[(int)args.Slot] = false;
                                    }
                                }
                            }
                            else if (ShineCommon.Utility.HitchanceArray[LSPredictioner.Config.Item("SPREDHITC").GetValue <StringList>().SelectedIndex] == HitChance.Low)
                            {
                                if (poutput2.Hitchance >= PortAIO.HitChance.Low)
                                {
                                    if (QWER.Cast(poutput2.CastPosition))
                                    {
                                        handleEvent[(int)args.Slot] = false;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }