Exemple #1
0
        public void Test_GetPredictions()
        {
            var actual = PredictionHelper.GetPredictions();

            Assert.True(actual.Count > 0);
            Assert.True(actual[0].Ticker == sut.Ticker);
        }
Exemple #2
0
        private void OnUpdateFunctions()
        {
            if (MenuHelper.getKeybindValue("dzaio.caitlyn.dashtomouse"))
            {
                if (_spells[SpellSlot.E].IsReady())
                {
                    _spells[SpellSlot.E].Cast(WhereToEForPosition(Game.CursorPos));
                }
            }

            if (MenuHelper.getKeybindValue("dzaio.caitlyn.manualr"))
            {
                var rTarget = TargetSelector.GetTarget(_spells[SpellSlot.R].Range, TargetSelector.DamageType.Physical);
                if (_spells[SpellSlot.R].IsEnabledAndReady(Mode.Combo))
                {
                    if (HeroHelper.IsSafePosition(ObjectManager.Player.ServerPosition) && _spells[SpellSlot.R].GetDamage(rTarget) >= rTarget.Health + 25 &&
                        rTarget.CountEnemiesInRange(800f) <= 2 && rTarget.CountAlliesInRange(600f) < 3 && rTarget.Distance(ObjectManager.Player) >= ObjectManager.Player.AttackRange)
                    {
                        _spells[SpellSlot.R].CastOnUnit(rTarget);
                    }
                }
            }

            if (MenuHelper.getKeybindValue("dzaio.caitlyn.eq"))
            {
                var eqTarget = TargetSelector.GetTarget(_spells[SpellSlot.Q].Range + 505f, TargetSelector.DamageType.Physical);

                if (_spells[SpellSlot.E].IsReady() && _spells[SpellSlot.Q].IsReady() && eqTarget.IsValidTarget() && eqTarget.Distance(ObjectManager.Player) >= Orbwalking.GetRealAutoAttackRange(null))
                {
                    var afterEPosition = GetPositionAfterE(WhereToEForPosition(eqTarget.ServerPosition));
                    if (!CaitlynIsSafePosition(afterEPosition))
                    {
                        return;
                    }
                    var delay = (int)Math.Ceiling(ObjectManager.Player.Distance(afterEPosition) / _spells[SpellSlot.E].Speed * 1000 + 100);
                    //var delayPrediction = Prediction.GetPrediction(eqTarget, delay);
                    //E Q
                    PredictionOutput customPrediction = PredictionHelper.GetP(afterEPosition, _spells[SpellSlot.Q], eqTarget, false);
                    if (_spells[SpellSlot.Q].IsKillable(eqTarget) && _spells[SpellSlot.Q].IsReady() &&
                        afterEPosition.Distance(eqTarget.ServerPosition) <= _spells[SpellSlot.Q].Range &&
                        !(afterEPosition.Distance(eqTarget.ServerPosition) <= Orbwalking.GetRealAutoAttackRange(null) &&
                          ObjectManager.Player.GetAutoAttackDamage(eqTarget) >= eqTarget.Health + 20))
                    {
                        _spells[SpellSlot.E].Cast(WhereToEForPosition(eqTarget.ServerPosition));
                        LeagueSharp.Common.Utility.DelayAction.Add(delay, () => _spells[SpellSlot.Q].Cast(customPrediction.CastPosition));
                    }
                }
            }
        }
Exemple #3
0
        internal dom.Prediction CreateStockData(Symbol ticker, string username)
        {
            var ph = new PredictionHelper();

            var stockData = new dmt.StockData()
            {
                timestamp = ticker.Date,
                open      = (float)ticker.Open,
                high      = (float)ticker.High,
                low       = (float)ticker.Low,
                close     = (float)ticker.Close,
                volume    = ticker.Volume
            };

            var prediction = PredictionModelHelper.RunAllPredictions(stockData);

            prediction.CompanyName = ticker.CompanyName;
            prediction.Ticker      = ticker.Ticker;

            ph.SetPrediction(prediction, username);

            return(prediction);
        }
Exemple #4
0
        private void Combo()
        {
            var comboTarget = TargetSelector.GetTarget(_spells[SpellSlot.Q].Range, TargetSelector.DamageType.Physical);
            var eqTarget    = TargetSelector.GetTarget(_spells[SpellSlot.Q].Range + 505f, TargetSelector.DamageType.Physical);
            var rTarget     = TargetSelector.GetTarget(_spells[SpellSlot.R].Range, TargetSelector.DamageType.Physical);

            if (_spells[SpellSlot.Q].IsEnabledAndReady(Mode.Combo) && comboTarget.IsValidTarget(_spells[SpellSlot.Q].Range))
            {
                if (MenuHelper.isMenuEnabled("dzaio.caitlyin.combo.skilloptions.impq"))
                {
                    if (HeroHelper.IsEmpaired(comboTarget))
                    {
                        _spells[SpellSlot.Q].CastIfHitchanceEquals(comboTarget, MenuHelper.GetHitchance());
                    }
                }
                else
                {
                    _spells[SpellSlot.Q].CastIfHitchanceEquals(comboTarget, MenuHelper.GetHitchance());
                }
            }

            if (_spells[SpellSlot.W].IsEnabledAndReady(Mode.Combo) && comboTarget.IsValidTarget(_spells[SpellSlot.W].Range) &&
                (HeroHelper.IsEmpaired(comboTarget) || comboTarget.IsRecalling()))
            {
                _spells[SpellSlot.W].CastIfHitchanceEquals(comboTarget, MenuHelper.GetHitchance());
            }

            if (_spells[SpellSlot.R].IsEnabledAndReady(Mode.Combo))
            {
                if (HeroHelper.IsSafePosition(ObjectManager.Player.ServerPosition) && _spells[SpellSlot.R].GetDamage(rTarget) >= rTarget.Health + 25 &&
                    rTarget.CountEnemiesInRange(800f) <= 2 && rTarget.CountAlliesInRange(600f) < 3 && rTarget.Distance(ObjectManager.Player) >= ObjectManager.Player.AttackRange)
                {
                    _spells[SpellSlot.R].CastOnUnit(rTarget);
                }
            }

            #region E Combos
            if (_spells[SpellSlot.E].IsEnabledAndReady(Mode.Combo) && !_spells[SpellSlot.R].IsEnabledAndReady(Mode.Combo) && eqTarget.IsValidTarget() && eqTarget.Distance(ObjectManager.Player) >= Orbwalking.GetRealAutoAttackRange(null))
            {
                var afterEPosition = GetPositionAfterE(WhereToEForPosition(eqTarget.ServerPosition));
                if (!CaitlynIsSafePosition(afterEPosition))
                {
                    return;
                }
                var delay = (int)Math.Ceiling(ObjectManager.Player.Distance(afterEPosition) / _spells[SpellSlot.E].Speed * 1000 + 100);
                //var delayPrediction = Prediction.GetPrediction(eqTarget, delay);
                //E AA
                if (afterEPosition.Distance(eqTarget.ServerPosition) <= Orbwalking.GetRealAutoAttackRange(null) - 50 && ObjectManager.Player.GetAutoAttackDamage(eqTarget) >= eqTarget.Health + 20)
                {
                    _spells[SpellSlot.E].Cast(WhereToEForPosition(eqTarget.ServerPosition));
                    LeagueSharp.Common.Utility.DelayAction.Add((int)(delay + Game.Ping / 2f), Orbwalking.ResetAutoAttackTimer);
                    _orbwalker.ForceTarget(eqTarget);
                    return;
                }
                //E Q
                PredictionOutput customPrediction = PredictionHelper.GetP(afterEPosition, _spells[SpellSlot.Q], eqTarget, false);
                if (_spells[SpellSlot.Q].IsKillable(eqTarget) && _spells[SpellSlot.Q].IsReady() &&
                    afterEPosition.Distance(eqTarget.ServerPosition) <= _spells[SpellSlot.Q].Range &&
                    !(afterEPosition.Distance(eqTarget.ServerPosition) <= Orbwalking.GetRealAutoAttackRange(null) &&
                      ObjectManager.Player.GetAutoAttackDamage(eqTarget) >= eqTarget.Health + 20))
                {
                    _spells[SpellSlot.E].Cast(WhereToEForPosition(eqTarget.ServerPosition));
                    LeagueSharp.Common.Utility.DelayAction.Add(delay, () => _spells[SpellSlot.Q].Cast(customPrediction.CastPosition));
                }
            }
            #endregion
        }
Exemple #5
0
        public void Test_GetPredictionByTicker()
        {
            var actual = PredictionHelper.GetPredictionByTicker(sut.Ticker);

            Assert.True(actual.Ticker == sut.Ticker);
        }
Exemple #6
0
 public void Test_SetAnonymousPrediction()
 {
     Assert.True(PredictionHelper.SetAnonymousPrediction(sut));
 }
Exemple #7
0
 public void Test_SetPrediction()
 {
     Assert.True(PredictionHelper.SetPrediction(sut, User.Username));
 }
Exemple #8
0
        public string Analysis(string scheduleID)
        {
            WebClientBLL.UpdateAnalysisContent(scheduleID);
            string actual = DataCache.GetCache("AnalysisContent").ToString();
            string h_data = "";
            Regex  reg    = new Regex("var h_data\\=\\[\\[" + "\\S[^;" + "]*\\]\\];");
            Match  mat    = reg.Match(actual);

            if (mat != null)
            {
                h_data = mat.Value;
            }
            h_data = h_data.Replace("var h_data=[[", "").Replace("]];", "");

            string h2h_home = "";

            reg = new Regex("var h2h_home \\= " + "\\d+;");
            mat = reg.Match(actual);
            if (mat != null)
            {
                h2h_home = StringPlus.DelLastChar(mat.Value.Replace("var h2h_home = ", ""), ";");
            }

            string a_data = "";

            reg = new Regex("var a_data\\=\\[\\[" + "\\S[^;" + "]*\\]\\];");
            mat = reg.Match(actual);
            if (mat != null)
            {
                a_data = mat.Value;
            }
            a_data = a_data.Replace("var a_data=[[", "").Replace("]];", "");

            string h2h_away = "";

            reg = new Regex("var h2h_away \\= " + "\\d+;");
            mat = reg.Match(actual);
            if (mat != null)
            {
                h2h_away = StringPlus.DelLastChar(mat.Value.Replace("var h2h_away = ", ""), ";");
            }


            //分解出主队过去成绩
            string[] h_dataArr   = Regex.Split(h_data, "\\],\\[", RegexOptions.IgnoreCase);
            float    h_point     = 100f;
            float    h_goalcount = 0f;
            int      h_sixpoint  = 0;

            foreach (string arr in h_dataArr)
            {
                string[] match = arr.Split(',');
                if (h2h_home == match[4])
                {
                    h_point      = PredictionHelper.EloHomePointsCalculation(h_point, match[17]);
                    h_goalcount += int.Parse(match[8]);
                }
                else
                {
                    h_point      = PredictionHelper.EloAwayPointsCalculation(h_point, match[17]);
                    h_goalcount += int.Parse(match[9]);
                }
                h_sixpoint = PredictionHelper.SixGamePointCalculation(h_sixpoint, match[17]);
            }

            //分解出客队过去成绩
            string[] a_dataArr   = Regex.Split(a_data, "\\],\\[", RegexOptions.IgnoreCase);
            float    a_point     = 100;
            float    a_goalcount = 0f;
            int      a_sixpoint  = 0;

            foreach (string arr in a_dataArr)
            {
                string[] match = arr.Split(',');
                if (h2h_away == match[4])
                {
                    a_point      = PredictionHelper.EloHomePointsCalculation(a_point, match[17]);
                    a_goalcount += int.Parse(match[8]);
                }
                else
                {
                    a_point      = PredictionHelper.EloAwayPointsCalculation(a_point, match[17]);
                    a_goalcount += int.Parse(match[9]);
                }
                a_sixpoint = PredictionHelper.SixGamePointCalculation(a_sixpoint, match[17]);
            }

            string HomePossible = PredictionHelper.EloHomePrediction(h_point, a_point) * 100 + "%";
            string AwayPossible = PredictionHelper.EloAwayPrediction(h_point, a_point) * 100 + "%";


            //string SixGame = PredictionHelper.SixGamePrediction(h_sixpoint, a_sixpoint);
            StringBuilder sb = new StringBuilder();

            sb.Append("埃罗预测法 :主队积分为" + h_point + ",客队积分为" + a_point + ",按照埃罗预测法主队获胜的可能性有" + HomePossible + ",客队获胜的可能性有" + AwayPossible);



            return(sb.ToString());
        }
Exemple #9
0
        internal List <dom.Prediction> GetPredictions()
        {
            var ph = new PredictionHelper();

            return(ph.GetPredictions());
        }