private void UpdateUIRiven(Riven riven) { var maxWidth = Console.BufferWidth / 2; //Draw right side if (riven != null) { UpdateUILine(0, riven.Name, false); UpdateUILine(1, "Polarity: " + riven.Polarity, false); UpdateUILine(2, "Rank: " + riven.Rank, false); UpdateUILine(3, "Mastery rank: " + riven.MasteryRank, false); UpdateUILine(4, "Rolls: " + riven.Rolls, false); var line = 5; if (riven.Modifiers != null) { foreach (var modi in riven.Modifiers) { if (line >= Console.WindowHeight) { return; } UpdateUILine(line++, modi.ToString(), false); } } else { _dataSender.AsyncSendDebugMessage("FATAL: Missing modifiers for: " + riven.ImageID).Wait(); } while (line < Console.WindowHeight) { UpdateUILine(line++, "", false); } } Console.SetCursorPosition(0, 0); }
private void InitTranslators() { dictTranslator.Clear(); foreach (var dict in translateApi.Dict) { dictTranslator.AddEntry(dict.En, dict.Zh); dictTranslator.AddEntry(dict.En, dict.Zh); searchwordTranslator.Clear(); } foreach (var sale in translateApi.Sale) { searchwordTranslator.AddEntry(sale.zh.Format(), sale.code); relicrewardTranslator.AddEntry(sale.en.Format(), sale.zh); } relicrewardTranslator.AddEntry("Forma Blueprint".Format(), "福马 蓝图"); // TODO 找一个更加全面的翻译对照表 invasionTranslator.Clear(); foreach (var invasion in translateApi.Invasion) { invasionTranslator.AddEntry(invasion.En, invasion.Zh); } translateApi.Riven.Select(r => r = new Riven { id = r.id, modulus = r.modulus, name = dictTranslator.Translate(r.name), rank = r .rank, thumb = r.thumb, type = dictTranslator.Translate(r.type) }); weapons.Clear(); weaponslist.Clear(); foreach (var riven in translateApi.Riven) { var zh = dictTranslator.Translate(riven.name); weapons.Add(zh); weaponslist.Add(new Riven { id = riven.id, modulus = riven.modulus, name = riven.name, rank = riven.rank, thumb = riven.thumb, type = riven.type, zhname = zh }); } nightwaveTranslator.Clear(); foreach (var wave in translateApi.NightWave) { nightwaveTranslator.AddEntry(wave.en.Format(), wave.zh); } }
public static string ToString(List <WarframeAlertingPrime.SDK.Models.User.Order> infos, List <RivenData> datas, Riven riven) { var weapon = infos.First().weapon; var sb = new StringBuilder(); var weaponinfo = WFResources.WFTranslateData.Riven.First(d => d.name == weapon); sb.AppendLine($"下面是 {riven.zhname} 紫卡的基本信息(来自DE)"); sb.AppendLine($"类型: {WFResources.WFTranslator.TranslateWeaponType(weaponinfo.type)} 倾向: {weaponinfo.rank}星 倍率: {Math.Round(weaponinfo.modulus, 2)}"); var rerolled = datas.Where(d => !d.rerolled).ToImmutableArray(); if (rerolled.Any()) { sb.AppendLine($"0洗均价: {rerolled.First().avg}白金"); } rerolled = datas.Where(d => d.rerolled).ToImmutableArray(); if (rerolled.Any()) { sb.AppendLine($"全部均价: {rerolled.First().avg}白金"); } sb.AppendLine($"下面是 {riven.zhname} 紫卡的 {infos.Count} 条卖家信息(来自WFA紫卡市场)"); foreach (var info in infos) { sb.Append($"[{info.account.gameName}] "); switch (info.account.status) { case UserStatus.Offline: sb.AppendLine("离线"); break; case UserStatus.Online: sb.AppendLine("在线"); break; case UserStatus.InGame: sb.AppendLine("游戏中"); break; } sb.AppendLine($"- 价格: {info.platinum}白鸡 ({info.reset}洗)"); sb.Append($" 属性: "); foreach (var property in info.properties) { var number = ""; switch (property.displayType) { case DisplayType.Percentage: /*number = property.value.ToString("P"); * break;*/ case DisplayType.Number: number = property.value.ToString(CultureInfo.InvariantCulture) + "%"; break; } sb.Append($"{property.name}{(property.isDeduction ? "-" : "+")}{number}|"); } sb.AppendLine(); } return(sb.ToString().Trim()); }
private static void Events_OnLoad() { if (!SupportList.Contains(GameObjects.Player.ChampionName)) { Manager.WriteConsole(GameObjects.Player.ChampionName + " Not Support!", true); DelayAction.Add(2000, () => Variables.Orbwalker.Enabled = false); return; } Manager.WriteConsole(GameObjects.Player.ChampionName + " Load! Version: " + Assembly.GetExecutingAssembly().GetName().Version.ToString(), true); Me = GameObjects.Player; Menu = new Menu("Flowers_Series", "Flowers' Series", true).Attach(); Menu.Add(new MenuSeparator("Credit", "Credit: NightMoon")); Menu.Add(new MenuSeparator("Version", "Version: " + Assembly.GetExecutingAssembly().GetName().Version.ToString())); Utility.Tools.Inject(); switch (Me.ChampionName) { case "Ahri": Ahri.Init(); break; case "Akali": Akali.Init(); break; case "Ashe": Ashe.Init(); break; case "Blitzcrank": Blitzcrank.Init(); break; case "Darius": Darius.Init(); break; case "Ezreal": Ezreal.Init(); break; case "Graves": Graves.Init(); break; case "Hecarim": Hecarim.Init(); break; case "Illaoi": Illaoi.Init(); break; case "Karma": Karma.Init(); break; case "Morgana": Morgana.Init(); break; case "Riven": Riven.Init(); break; case "Ryze": Ryze.Init(); break; case "Sivir": Sivir.Init(); break; case "Tristana": Tristana.Init(); break; case "TwistedFate": TwistedFate.Init(); break; case "Twitch": Twitch.Init(); break; case "Vayne": Vayne.Init(); break; case "Viktor": Viktor.Init(); break; case "Vladimir": Vladimir.Init(); break; default: break; } }
public Riven ParseRivenTextFromImage(Bitmap croppedRiven, string parsedName) { //if (croppedRiven.Width != 560 && croppedRiven.Height != 760) // return null; Riven result = new Riven() { Polarity = Polarity.Unknown, Rank = 0, }; var newModiRegex = new Regex(@"[+-][\d]"); // Set the input image var debug = new StringBuilder(); using (var pix = PixConverter.ToPix(croppedRiven)) { // Extract text from result iterator var rivenText = new List <string>(); var currentStep = Step.ReadingName; var name = string.Empty; var modis = new List <string>(); var number = 0; PageIteratorLevel pageIteratorLevel = PageIteratorLevel.TextLine; using (var page = _engine.Process(pix)) { using (var iter = page.GetIterator()) { do { var line = string.Empty; try { line = iter.GetText(pageIteratorLevel).Trim(); debug.AppendLine(line); } catch { continue; } if (line.Length > 0 && !(newModiRegex.Match(line).Success&& line.Contains(' ')) && currentStep == Step.ReadingName) { name = (name + " " + line).Trim(); } else if (line.Length > 0 && (newModiRegex.Match(line).Success&& line.Contains(' ')) && (currentStep == Step.ReadingName || currentStep == Step.ReadingModifiers)) { result.Name = name; if (parsedName != null) { result.Name = parsedName; } currentStep = Step.ReadingModifiers; modis.Add(line); } else if (line.Length > 0 && !Char.IsDigit(line[0]) && currentStep == Step.ReadingModifiers) { var last = modis.Last(); modis.Remove(last); last = last + " " + line; modis.Add(last); } else if (line.Length > 0 && Char.IsDigit(line[0]) && currentStep == Step.ReadingModifiers) { var modiObjects = modis.Select(m => Modifier.ParseString(m)).ToArray(); //Handle curses if (name.Contains("-") && modiObjects.Length == 4) { modiObjects[3].Curse = true; } else if (!name.Contains("-") && modiObjects.Length == 3) { modiObjects[2].Curse = true; } result.Modifiers = modiObjects; currentStep = Step.ReadingMRLine; if (Int32.TryParse(line, out number)) { result.Drain = number; } } else if (line.Length > 0 && currentStep == Step.ReadingMRLine) { //MR o 16 D14 var splits = line.Split(' '); if (splits.Length == 4) { if (Int32.TryParse(Regex.Match(splits[3], @"\d+").Value.TrimStart('0'), out number)) { result.Rolls = number; } } if (splits.Length >= 3 && Int32.TryParse(Regex.Match(splits[2], @"\d+").Value.TrimStart('0'), out number)) { result.MasteryRank = number; } else if (splits.Length < 3 && Int32.TryParse(Regex.Match(line, @"\d+").Value.TrimStart('0'), out number)) { result.MasteryRank = number; } } //rivenText.Add(line); } while (iter.Next(pageIteratorLevel)); } } } result.ImageID = Guid.NewGuid(); return(result); }
public async Task MonitorLive(string debugImageDectory = null) { if (debugImageDectory != null && !Directory.Exists(debugImageDectory)) { Directory.CreateDirectory(debugImageDectory); } if (!Directory.Exists(Path.Combine(Path.GetTempPath(), "wfchat"))) { Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), "wfchat")); } if (!Directory.Exists(Path.Combine(Path.GetTempPath(), "wfchat", "rivens"))) { Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), "wfchat", "rivens")); } foreach (var oldRiven in Directory.GetFiles(Path.Combine(Path.GetTempPath(), "wfchat", "rivens"))) { File.Delete(oldRiven); } var newSW = new Stopwatch(); var sw = new Stopwatch(); var scrollbarFound = false; Bitmap b = null; var scrollDots = 0; var cachedRivens = new Queue <string>(); var cachedRivenValues = new Dictionary <string, Riven>(); while (true) { UpdateUISeperators(); _UISecondLine = null; UpdateUISecondLine(); _UIThirdLine = null; UpdateUIThirdLine(); if (!scrollbarFound) { _UIFirstLine = "Finding scrollbar"; } else { _UIFirstLine = "Getting image"; } UpdateUIFirstLine(); newSW.Restart(); sw.Restart(); //var image = string.Empty; //try //{ // newSW.Restart(); // b = _gameCapture.GetFullImage(); // b.Save(Path.Combine(Path.GetTempPath(), "wfchat", "capture_0.png")); // b.Dispose(); // image = Path.Combine(Path.GetTempPath(), "wfchat", "capture_0.png"); // if (debugImageDectory != null) // { // File.Copy(image, Path.Combine(debugImageDectory, "capture_0.png"), true); // } //} //catch { continue; } var imageTime = sw.Elapsed.TotalSeconds; sw.Restart(); var image = _gameCapture.GetFullImage(); if (image == null) { _UIFirstLine = "Failed to get image"; UpdateUIFirstLine(); continue; } if (!_screenStateHandler.IsChatOpen(image)) { if (_screenStateHandler.IsExitable(image)) { _UIFirstLine = "RECOVERING: clickign exit"; UpdateUIFirstLine(); //Click exit _mouseMover.Click(3814, 2014); await Task.Delay(30); continue; } await _dataSender.AsyncSendDebugMessage("Help I'm stuck!"); await Task.Delay(5000); image.Dispose(); continue; } //Wait for scrollbar to be ready if (!scrollbarFound) { if (_chatParser.IsScrollbarPresent(image)) { scrollbarFound = true; _mouseMover.MoveTo(3259, 658); await Task.Delay(33); _mouseMover.Click(3259, 658); await Task.Delay(100); continue; } else { scrollDots++; if (scrollDots > 4) { scrollDots = 0; } await Task.Delay(100); continue; } } sw.Restart(); newSW.Restart(); _UIFirstLine = "Parsing chat"; UpdateUIFirstLine(); newSW.Restart(); var lines = _chatParser.ParseChatImage(image, true, true, 27); _UIMessages.AddRange(lines.Select(l => l.RawMessage)); _UIFirstLine = "Parsing chat: " + lines.Length + " new messages. Riven cache count: " + cachedRivens.Count; UpdateUIFirstLine(); UpdateUIMessages(); var parseTime = sw.Elapsed.TotalSeconds; sw.Restart(); string debugImageName = null; if (debugImageDectory != null) { debugImageName = Path.Combine(debugImageDectory, "debug_image_" + DateTime.Now.ToString("yyyy-dd-M--HH-mm-ss-fff") + ".png"); } var newMessags = 0; var shouldCopyImage = false; var badNameRegex = new Regex("[^-A-Za-z0-9._]"); //[00:00] f: . ChatMessageModel lastMessage = null; var hasher = MD5.Create(); sw.Restart(); var linesBad = false; var rivenParseTime = 0.0; var sendingTime = 0.0; var rivenSW = new Stopwatch(); var sendingSW = new Stopwatch(); foreach (var line in lines) { _UISecondLine = "Handling generic: " + line.RawMessage; UpdateUISecondLine(); var lineSw = new Stopwatch(); lineSw.Start(); if (linesBad) { lines.ToList().ForEach(l => _chatParser.InvalidCache(l.GetKey())); break; } if (line.LineType == LineParseResult.LineType.RedText) { _UISecondLine = "Handing redtext: " + line.RawMessage; UpdateUISecondLine(); await _dataSender.AsyncSendRedtext(line.RawMessage); } else if (line.LineType == LineParseResult.LineType.NewMessage && line is ChatMessageLineResult) { _UISecondLine = "Current msg: " + line.RawMessage; UpdateUISecondLine(); var chatMessageSw = new Stopwatch(); chatMessageSw.Start(); newSW.Restart(); var clr = line as ChatMessageLineResult; var message = MakeChatModel(line as LineParseResult.ChatMessageLineResult, badNameRegex); newMessags++; for (int i = 0; i < clr.ClickPoints.Count; i++) { var clickPointSw = new Stopwatch(); clickPointSw.Start(); rivenSW.Restart(); var clickpoint = clr.ClickPoints[i]; _UIThirdLine = "Parsing riven: " + clickpoint.RivenName + " " + clickpoint.X + "," + clickpoint.Y; UpdateUIThirdLine(); if (cachedRivenValues.ContainsKey(clr.Username + clickpoint.RivenName)) { var cachedRiven = cachedRivenValues[clr.Username + clickpoint.RivenName]; var copiedRiven = new Riven(); copiedRiven.Drain = cachedRiven.Drain; copiedRiven.ImageID = cachedRiven.ImageID; copiedRiven.MasteryRank = cachedRiven.MasteryRank; copiedRiven.MessagePlacementId = clickpoint.Index; copiedRiven.Modifiers = cachedRiven.Modifiers; copiedRiven.Name = cachedRiven.Name; copiedRiven.Polarity = cachedRiven.Polarity; copiedRiven.Rank = cachedRiven.Rank; copiedRiven.Rolls = cachedRiven.Rolls; message.Rivens.Add(copiedRiven); rivenParseTime += rivenSW.Elapsed.TotalSeconds; await _dataSender.AsyncSendDebugMessage("Found a riven from cache: " + clr.Username + " " + clickpoint.RivenName); _UISecondLine = "Riven: " + clickpoint.RivenName + " found in cache"; _UILastRiven = cachedRiven; UpdateUISecondLine(); //UpdateUIRiven(cachedRiven); continue; } var rivenImage = string.Empty; var originalBytes = Encoding.UTF8.GetBytes(clr.Username); var hashedBytes = hasher.ComputeHash(originalBytes); var usernameHash = new StringBuilder(); foreach (Byte hashed in hashedBytes) { usernameHash.AppendFormat("{0:x2}", hashed); } rivenImage = Path.Combine(Path.GetTempPath(), "wfchat", "rivens", usernameHash.ToString() + "_" + i + ".png"); b = _gameCapture.GetChatIcon(); if (_chatParser.IsChatFocused(b)) { _mouseMover.MoveTo(clickpoint.X, clickpoint.Y); await Task.Delay(30); _mouseMover.Click(clickpoint.X, clickpoint.Y); await Task.Delay(17); } else { _chatParser.InvalidCache(line.GetKey()); linesBad = true; rivenParseTime += rivenSW.Elapsed.TotalSeconds; break; } b.Dispose(); _mouseMover.MoveTo(0, 0); Bitmap crop = null; var foundRiven = false; for (int tries = 0; tries < 15; tries++) { b = _gameCapture.GetFullImage(); if (_screenStateHandler.GetScreenState(b) == ScreenState.RivenWindow) { foundRiven = true; crop = _rivenParser.CropToRiven(b); b.Dispose(); _mouseMover.Click(3816, 2013); await Task.Delay(17); _mouseMover.MoveTo(0, 0); await Task.Delay(17); break; } b.Dispose(); } if (!foundRiven || crop == null) { linesBad = true; _chatParser.InvalidCache(line.GetKey()); if (crop != null) { crop.Dispose(); } rivenParseTime += rivenSW.Elapsed.TotalSeconds; break; } var newC = _rivenCleaner.CleanRiven(crop); var riven = _rivenParser.ParseRivenTextFromImage(newC, clickpoint.RivenName); riven.Name = clickpoint.RivenName; riven.Polarity = _rivenParser.ParseRivenPolarityFromColorImage(crop); riven.Rank = _rivenParser.ParseRivenRankFromColorImage(crop); newC.Dispose(); //crop.Dispose(); if (riven == null) { //crop.Dispose(); _chatParser.InvalidCache(line.GetKey()); linesBad = true; rivenParseTime += rivenSW.Elapsed.TotalSeconds; break; } riven.MessagePlacementId = clickpoint.Index; if (riven.Drain > 0 && riven.MasteryRank > 0) { cachedRivens.Enqueue(clr.Username + clickpoint.RivenName); cachedRivenValues[clr.Username + clickpoint.RivenName] = riven; while (cachedRivens.Count > 5000) { var removed = cachedRivens.Dequeue(); cachedRivenValues.Remove(removed); } _UIFirstLine = "Parsing chat: " + lines.Length + " new messages. Riven cache count: " + cachedRivens.Count; UpdateUIFirstLine(); } message.Rivens.Add(riven); _UILastRiven = riven; crop.Save(riven.ImageID + ".png"); UpdateUIRiven(riven); File.Delete(rivenImage); #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed _dataSender.AsyncSendRivenImage(riven.ImageID, crop); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed //await _dataSender.AsyncSendRivenImage(riven.ImageID, rivenBase64); for (int tries = 0; tries < 15; tries++) { b = _gameCapture.GetFullImage(); var state = _screenStateHandler.GetScreenState(b); if (_screenStateHandler.IsChatOpen(b)) { b.Dispose(); break; } else if (state == ScreenState.RivenWindow) { _mouseMover.Click(3816, 2013); await Task.Delay(17); _mouseMover.MoveTo(0, 0); await Task.Delay(17); } b.Dispose(); } } if (linesBad) { lines.ToList().ForEach(l => _chatParser.InvalidCache(l.GetKey())); break; } if (message.DEBUGREASON != null) { message.DEBUGIMAGE = debugImageName; shouldCopyImage = true; } rivenParseTime += rivenSW.Elapsed.TotalSeconds; sendingSW.Restart(); await _dataSender.AsyncSendChatMessage(message); sendingTime += sendingSW.Elapsed.TotalSeconds; } } if (shouldCopyImage && debugImageName != null && debugImageName.Length > 0) { try { image.Save(debugImageName); } catch { } //File.Copy(image, debugImageName); } image.Dispose(); var transmitTime = sw.Elapsed.TotalSeconds; sw.Stop(); var debugMessage = $"Image capture: {imageTime:00.00} Parse time: {parseTime:00.00} TransmitTime: {transmitTime:0.000} New messages {newMessags} {newMessags / parseTime}/s"; await _dataSender.AsyncSendDebugMessage(debugMessage); _UIFirstLine = "Scrolling"; _UISecondLine = null; _UIThirdLine = null; UpdateUIFirstLine(); UpdateUISecondLine(); UpdateUIThirdLine(); //Scroll down to get 27 more messages _mouseMover.MoveTo(3250, 768); //Scroll down for new page of messages for (int i = 0; i < 27; i++) { _mouseMover.ScrollDown(); await Task.Delay(17); } for (int i = 0; i < 1; i++) { _mouseMover.ScrollUp();//Pause chat await Task.Delay(17); } _mouseMover.MoveTo(0, 0); await Task.Delay(100); } }
private static void GameEvents_GameStart() { if (Valid.All(x => Global.Player.ChampionName != x)) { return; } SummonerSpells.Init(); GameObjects.Init(); Global.Init(); GetRandom.Init(); switch (Global.Player.ChampionName) { case "Ezreal": Ezreal.Init(); break; case "Azir": Azir.Init(); break; case "Irelia": Irelia.Init(); break; case "Jax": Jax.Init(); break; case "Jinx": var jinx = new Jinx(); jinx.Init(); break; case "Kayn": Kayn.Init(); break; case "LeeSin": var lee = new LeeSin(); lee.Init(); break; case "Rengar": Rengar.Init(); break; case "Riven": Riven.Init(); break; case "Tristana": var tristana = new Tristana(); tristana.Init(); break; case "Yasuo": Yasuo.Init(); break; case "Zed": Zed.Init(); break; } }
public static void Initialize(Riven Me) { s_Champion = Me; #region Gapclosers GapCloseMethods[0] = new Action <Obj_AI_Hero>((t) => { if (t.Distance(ObjectManager.Player.ServerPosition) > Me.ConfigMenu.Item("MMINDIST").GetValue <Slider>().Value) { if (Utils.TickCount - s_lastGapCloseTick < 150) { return; } if (Me.Spells[E].IsReady()) { int eMode = 3; if (Me.Orbwalker.ActiveMode == SCommon.Orbwalking.Orbwalker.Mode.Combo) { eMode = Me.ConfigMenu.Item("CEMODE").GetValue <StringList>().SelectedIndex; } else if (Me.Orbwalker.ActiveMode == SCommon.Orbwalking.Orbwalker.Mode.Mixed) { eMode = Me.ConfigMenu.Item("HEMODE").GetValue <StringList>().SelectedIndex; } int comboMode = Me.ConfigMenu.Item(String.Format("CMETHOD{0}", t.ChampionName)).GetValue <StringList>().SelectedIndex; if (eMode == 0) { Me.Spells[E].Cast(t.ServerPosition); if (comboMode == 0) { if (Me.CheckR1(t)) { Me.Spells[R].Cast(); return; } } else if (comboMode == 1) { if (!ObjectManager.Player.HasBuff("RivenFengShuiEngine") && !Me.ConfigMenu.Item("CDISABLER").GetValue <KeyBind>().Active&& Me.Spells[R].IsReady()) { Me.Spells[R].Cast(); } } s_lastGapCloseTick = Utils.TickCount; } else if (eMode == 1) { Me.Spells[E].Cast(Game.CursorPos); if (comboMode == 0) { if (Me.CheckR1(t)) { Me.Spells[R].Cast(); return; } } else if (comboMode == 1) { if (!ObjectManager.Player.HasBuff("RivenFengShuiEngine") && !Me.ConfigMenu.Item("CDISABLER").GetValue <KeyBind>().Active&& Me.Spells[R].IsReady()) { Me.Spells[R].Cast(); } } s_lastGapCloseTick = Utils.TickCount; } } } }); GapCloseMethods[1] = new Action <Obj_AI_Hero>((t) => { if (t.Distance(ObjectManager.Player.ServerPosition) > Me.ConfigMenu.Item("MMINDIST").GetValue <Slider>().Value) { if (Utils.TickCount - s_lastGapCloseTick < 150) { return; } if (!Me.Spells[E].IsReady()) { if (Me.Spells[Q].IsReady()) { Me.Spells[Q].Cast(t.ServerPosition, true); s_lastGapCloseTick = Utils.TickCount; return; } } } if (t.Distance(ObjectManager.Player.ServerPosition) > ObjectManager.Player.AttackRange + 50) { if (!Me.ConfigMenu.Item("MKEEPQ").GetValue <bool>() && Animation.QStacks != 0 && Utils.TickCount - Animation.LastQTick >= 3500) { Me.Spells[Q].Cast(t.ServerPosition, true); } } }); GapCloseMethods[2] = new Action <Obj_AI_Hero>((t) => { if (Utils.TickCount - s_lastGapCloseTick < 150) { return; } s_lastGapCloseTick = Utils.TickCount; if (Target.IsTargetFlashed() && Me.ConfigMenu.Item("CUSEF").GetValue <KeyBind>().Active) { if (t.Distance(ObjectManager.Player.ServerPosition) > 300 && t.Distance(ObjectManager.Player.ServerPosition) < 500 && Me.Orbwalker.ActiveMode == SCommon.Orbwalking.Orbwalker.Mode.Combo) { int steps = (int)(t.Distance(ObjectManager.Player.ServerPosition) / 10); Vector3 direction = (t.ServerPosition - ObjectManager.Player.ServerPosition).Normalized(); for (int i = 0; i < steps - 1; i++) { if (NavMesh.GetCollisionFlags(ObjectManager.Player.ServerPosition + direction * 10 * i).HasFlag(CollisionFlags.Wall)) { return; } } ObjectManager.Player.Spellbook.CastSpell(Me.SummonerFlash, t.ServerPosition); } Target.SetFlashed(false); } }); #endregion #region Normal Combo MethodsOnUpdate[0] = (t) => { if (t != null) { //gapclose for (int i = 0; i < GapCloseMethods.Length; i++) { GapCloseMethods[i](t); } if (Me.CheckR1(t)) { if (Me.Spells[E].IsReady()) { Me.Spells[E].Cast(t.ServerPosition); } Me.Spells[R].Cast(); if (t.IsValidTarget(Me.Spells[W].Range)) { Me.Spells[W].Cast(); } } if (Me.CheckR2(t)) { Me.Spells[R].Cast(t.ServerPosition); if (Me.Spells[Q].IsReady()) { Me.Spells[Q].Cast(t.ServerPosition, true); if (!Me.IsDoingFastQ) { Me.FastQCombo(); } } } if (Me.Spells[W].IsReady() && t.Distance(ObjectManager.Player.ServerPosition) < Me.Spells[W].Range + t.BoundingRadius + (Animation.UltActive ? 10 : 0) && !Me.IsDoingFastQ) { if (ObjectManager.Player.CountEnemiesInRange(1000) == 1 && ObjectManager.Player.HealthPercent > 50) { if (Me.Spells[E].IsReady() && Me.Spells[Q].IsReady()) { return; } if (!Me.Spells[E].IsReady() && Me.Spells[Q].IsReady() && Utils.TickCount - Animation.LastETick < 1000) { return; } } if (Me.Spells[E].IsReady() && ObjectManager.Player.Distance(t.ServerPosition) > 125 && Me.ConfigMenu.Item("CALWAYSE").GetValue <bool>()) { Me.Spells[E].Cast(t.ServerPosition); } Me.CastCrescent(); Me.Spells[W].Cast(true); } } if (!Animation.CanAttack() && Animation.CanCastAnimation && !Me.Spells[W].IsReady() && !Me.CheckR1(t)) { if (Animation.QStacks != 0 && Me.CalculateAADamage(t, 2) + (Me.Spells[E].IsReady() && Me.Spells[W].IsReady(2000) ? Me.Spells[W].GetDamage(t) : 0) + (Me.Spells[E].IsReady() && ObjectManager.Player.HasBuff("RivenFengShuiEngine") && Me.Spells[R].IsReady() ? Me.CalculateDamageR2(t) : 0) > t.Health && ObjectManager.Player.HealthPercent > 20 && ObjectManager.Player.CountEnemiesInRange(1000) > 1) { return; } Me.FastQCombo(); } }; MethodsOnAnimation[0] = (t, animname) => { if (Me.Orbwalker.ActiveMode == SCommon.Orbwalking.Orbwalker.Mode.Combo || Me.Orbwalker.ActiveMode == SCommon.Orbwalking.Orbwalker.Mode.Mixed) { t = Target.Get(600, true); if (t != null) { if (animname == "Spell1c") { if (Me.Spells[W].IsReady() && t.IsValidTarget(Me.Spells[W].Range)) { Me.Spells[W].Cast(true); } } if (animname == "Spell3") //e w & e q etc { if (Me.CheckR1(t)) { Me.Spells[R].Cast(); return; } if (Me.Spells[W].IsReady() && t.Distance(ObjectManager.Player.ServerPosition) < Me.Spells[W].Range + t.BoundingRadius && !Me.IsDoingFastQ && Me.Spells[Q].IsReady()) { Me.Spells[W].Cast(true); return; } if (Me.Spells[Q].IsReady() && !Me.IsDoingFastQ && !Me.CheckR1(t) && t.Distance(ObjectManager.Player.ServerPosition) < Me.Spells[Q].Range) { if (ObjectManager.Player.IsDashing()) { Utility.DelayAction.Add(Utils.TickCount - ObjectManager.Player.GetDashInfo().EndTick, () => { Me.Spells[Q].Cast(t.ServerPosition, true); Me.FastQCombo(); }); return; } } Me.CastCrescent(); } else if (animname == "Spell4a") { if (Me.Spells[W].IsReady() && t.IsValidTarget(Me.Spells[W].Range - 10)) { Me.Spells[W].Cast(); return; } } else if (animname == "Spell4b") { Utility.DelayAction.Add(100, () => { if (Me.IsCrestcentReady) { Me.CastCrescent(); } if (Me.Spells[Q].IsReady()) { Me.Spells[Q].Cast(t.ServerPosition, true); if (!Me.IsDoingFastQ) { Me.FastQCombo(); } } }); } else if (animname == "Spell2") { if (Me.Spells[Q].IsReady() && !Me.IsDoingFastQ) { Me.Spells[Q].Cast(t.ServerPosition, true); Me.FastQCombo(); } } } } }; #endregion #region Shy Burst (E-R-Flash-W-AA-R2-Hydra-Q) MethodsOnUpdate[1] = (t) => { t = Target.Get(1000); if (t != null) { if (t.Health - Me.CalculateDamageR2(t) < 0 && ObjectManager.Player.HasBuff("RivenFengShuiEngine") && !Me.ConfigMenu.Item("CDISABLER").GetValue <KeyBind>().Active&& Me.Spells[R].IsReady() && t.Distance(ObjectManager.Player.ServerPosition) < 650) { Me.Spells[R].Cast(t.ServerPosition); } if (Me.Spells[E].IsReady() && ObjectManager.Player.ServerPosition.Distance(t.ServerPosition) <= 700 && !ObjectManager.Player.HasBuff("RivenFengShuiEngine")) { Me.Spells[E].Cast(t.ServerPosition); if (!Me.ConfigMenu.Item("CDISABLER").GetValue <KeyBind>().Active&& Me.Spells[R].IsReady()) { Me.Spells[R].Cast(); } return; } if (Me.Spells[W].IsReady() && t.IsValidTarget(Me.Spells[W].Range + t.BoundingRadius + 10)) { Me.CastCrescent(); Me.Spells[W].Cast(); return; } } }; MethodsOnAnimation[1] = (t, animname) => { switch (animname) { case "Spell3": //e r1 { if (!ObjectManager.Player.HasBuff("RivenFengShuiEngine") && !Me.ConfigMenu.Item("CDISABLER").GetValue <KeyBind>().Active&& Me.Spells[R].IsReady()) { Me.Spells[R].Cast(); } } break; case "Spell4a": //r flash { if (t.Distance(ObjectManager.Player.ServerPosition) > 300) { ObjectManager.Player.Spellbook.CastSpell(Me.SummonerFlash, t.ServerPosition); Me.CastCrescent(); } } break; case "Spell4b": { Utility.DelayAction.Add(100, () => { if (Me.IsCrestcentReady) { Me.CastCrescent(); } if (Me.Spells[Q].IsReady()) { Me.Spells[Q].Cast(t.ServerPosition, true); if (!Me.IsDoingFastQ) { Me.FastQCombo(); } } }); } break; case "Spell2": { if (Me.Spells[Q].IsReady()) { Me.Spells[Q].Cast(t.ServerPosition, true); } } break; } }; #endregion #region Flash Combo (Q1-Q2-E-R1-Flash-Q3-Hydra-W-R2) MethodsOnUpdate[2] = (t) => { if (!ObjectManager.Player.Spellbook.GetSpell(Me.SummonerFlash).IsReady() && !ObjectManager.Player.HasBuff("RivenFengShuiEngine")) { MethodsOnUpdate[0](t); return; } t = Target.Get(1000); if (Animation.QStacks == 2) { if (!Me.Spells[E].IsReady() && !ObjectManager.Player.HasBuff("RivenFengShuiEngine")) { return; } if (t != null) { if (Me.Spells[E].IsReady()) { Me.Spells[E].Cast(t.ServerPosition); return; } if (t.IsValidTarget(600)) { Me.CastCrescent(); if (Me.Spells[W].IsReady()) { if (t.IsValidTarget(Me.Spells[W].Range + t.BoundingRadius)) { Me.Spells[W].Cast(); } } else if (ObjectManager.Player.HasBuff("RivenFengShuiEngine") && !Me.ConfigMenu.Item("CDISABLER").GetValue <KeyBind>().Active&& Me.Spells[R].IsReady()) { Me.Spells[R].Cast(t.ServerPosition); } } } } else { if (Me.Spells[Q].IsReady()) { if (Utils.TickCount - Animation.LastQTick >= 1000) { Me.Spells[Q].Cast(Game.CursorPos, true); } } } }; MethodsOnAnimation[2] = (t, animname) => { { switch (animname) { case "Spell3": //e r1 { if (!ObjectManager.Player.HasBuff("RivenFengShuiEngine") && !Me.ConfigMenu.Item("CDISABLER").GetValue <KeyBind>().Active&& Me.Spells[R].IsReady()) { Me.Spells[R].Cast(); } } break; case "Spell4a": //r1 flash { if (t.Distance(ObjectManager.Player.ServerPosition) > 300 && Me.Orbwalker.ActiveMode == SCommon.Orbwalking.Orbwalker.Mode.Combo) { ObjectManager.Player.Spellbook.CastSpell(Me.SummonerFlash, t.ServerPosition); Me.Spells[Q].Cast(t.ServerPosition, true); } } break; case "Spell2": //w r2 { if (ObjectManager.Player.HasBuff("RivenFengShuiEngine") && !Me.ConfigMenu.Item("CDISABLER").GetValue <KeyBind>().Active&& Me.Spells[R].IsReady()) { Me.Spells[R].Cast(t.ServerPosition); } } break; } } }; #endregion }
public static void Initialize(Riven Me) { s_Champion = Me; #region Gapclosers GapCloseMethods[0] = new Action <Obj_AI_Hero>((t) => { if (t.Distance(ObjectManager.Player.ServerPosition) > Me.ConfigMenu.Item("MMINDIST").GetValue <Slider>().Value) { if (Me.Spells[E].IsReady()) { int eMode = 3; if (Me.Orbwalker.ActiveMode == SCommon.Orbwalking.Orbwalker.Mode.Combo) { eMode = Me.ConfigMenu.Item("CEMODE").GetValue <StringList>().SelectedIndex; } else if (Me.Orbwalker.ActiveMode == SCommon.Orbwalking.Orbwalker.Mode.Mixed) { eMode = Me.ConfigMenu.Item("HEMODE").GetValue <StringList>().SelectedIndex; } if (eMode == 0) { Me.Spells[E].Cast(t.ServerPosition); } else if (eMode == 1) { Me.Spells[E].Cast(Game.CursorPos); } } } }); GapCloseMethods[1] = new Action <Obj_AI_Hero>((t) => { if (t.Distance(ObjectManager.Player.ServerPosition) > Me.ConfigMenu.Item("MMINDIST").GetValue <Slider>().Value) { if (!Me.Spells[E].IsReady()) { if (Me.Spells[Q].IsReady()) { Me.Spells[Q].Cast(t.ServerPosition); } } } }); GapCloseMethods[2] = new Action <Obj_AI_Hero>((t) => { if (Target.IsTargetFlashed() && Me.ConfigMenu.Item("CUSEF").GetValue <KeyBind>().Active) { if (t.Distance(ObjectManager.Player.ServerPosition) > 300 && t.Distance(ObjectManager.Player.ServerPosition) < 500 && Me.Orbwalker.ActiveMode == SCommon.Orbwalking.Orbwalker.Mode.Combo) { int steps = (int)(t.Distance(ObjectManager.Player.ServerPosition) / 10); Vector3 direction = (t.ServerPosition - ObjectManager.Player.ServerPosition).Normalized(); for (int i = 0; i < steps - 1; i++) { if (NavMesh.GetCollisionFlags(ObjectManager.Player.ServerPosition + direction * 10 * i).HasFlag(CollisionFlags.Wall)) { return; } } ObjectManager.Player.Spellbook.CastSpell(Me.SummonerFlash, t.ServerPosition); } Target.SetFlashed(false); } }); #endregion #region Normal Combo MethodsOnUpdate[0] = (t) => { if (t != null) { //gapclose for (int i = 0; i < GapCloseMethods.Length; i++) { GapCloseMethods[i](t); } if (Me.CheckR1(t)) { if (Me.Spells[E].IsReady()) { Me.Spells[E].Cast(t.ServerPosition); } Me.Spells[R].Cast(); } if (Me.CheckR2(t)) { Me.Spells[R].Cast(t.ServerPosition); } if (Me.Spells[W].IsReady() && t.Distance(ObjectManager.Player.ServerPosition) < Me.Spells[W].Range && !Me.IsDoingFastQ) { Me.CastCrescent(); Me.Spells[W].Cast(true); } } if (!Animation.CanAttack() && Animation.CanCastAnimation && !Me.Spells[W].IsReady() && !Me.CheckR1(t)) { Me.FastQCombo(); } }; MethodsOnAnimation[0] = (t, animname) => { if (Me.Orbwalker.ActiveMode == SCommon.Orbwalking.Orbwalker.Mode.Combo || Me.Orbwalker.ActiveMode == SCommon.Orbwalking.Orbwalker.Mode.Mixed) { t = Target.Get(600, true); if (t != null) { if (animname == "Spell3") //e w & e q etc { if (Me.CheckR1(t)) { Me.Spells[R].Cast(); return; } if (Me.Spells[W].IsReady() && t.Distance(ObjectManager.Player.ServerPosition) < Me.Spells[W].Range && !Me.IsDoingFastQ) { Me.Spells[W].Cast(); return; } if (Me.Spells[Q].IsReady() && !Me.IsDoingFastQ && !Me.CheckR1(t) && t.Distance(ObjectManager.Player.ServerPosition) < Me.Spells[Q].Range) { Me.Spells[Q].Cast(t.ServerPosition + (t.ServerPosition - ObjectManager.Player.ServerPosition).Normalized() * 40); Me.FastQCombo(); return; } } else if (animname == "Spell4a") { if (Me.Spells[W].IsReady() && t.Distance(ObjectManager.Player.ServerPosition) < Me.Spells[W].Range) { Me.Spells[W].Cast(); return; } } } //r2 target t = Target.Get(900); if (t != null && Me.CheckR2(t)) { if (animname == "Spell3") //q3 r2 { Utility.DelayAction.Add(393 - Game.Ping, () => Me.Spells[R].Cast(t.ServerPosition)); } } } }; #endregion #region Shy Burst (E-R-Flash-W-AA-R2-Hydra-Q) MethodsOnUpdate[1] = (t) => { if (!ObjectManager.Player.Spellbook.GetSpell(Me.SummonerFlash).IsReady() && !ObjectManager.Player.HasBuff("RivenFengShuiEngine")) { MethodsOnUpdate[0](t); return; } t = Target.Get(900, true); if (t != null) { if (Me.Spells[E].IsReady() && ObjectManager.Player.ServerPosition.Distance(t.ServerPosition) <= Me.Spells[E].Range + 400 + Me.Spells[W].Range / 2f && !ObjectManager.Player.HasBuff("RivenFengShuiEngine")) { Me.Spells[E].Cast(t.ServerPosition); if (!Me.ConfigMenu.Item("CDISABLER").GetValue <bool>() && Me.Spells[R].IsReady()) { Me.Spells[R].Cast(); } return; } if (Me.Spells[W].IsReady() && t.IsValidTarget(Me.Spells[W].Range)) { Me.Spells[W].Cast(); return; } if (ObjectManager.Player.HasBuff("RivenFengShuiEngine")) { if ((t.Health - Me.CalculateDamageR2(t) <= 0) && !Me.ConfigMenu.Item("CDISABLER").GetValue <bool>()) { if (Me.Spells[R].IsReady()) //r2 { Me.Spells[R].Cast(t.ServerPosition); } } else { if (!Me.Spells[W].IsReady()) { Me.FastQCombo(); } } } } }; MethodsOnAnimation[1] = (t, animname) => { if (!ObjectManager.Player.Spellbook.GetSpell(Me.SummonerFlash).IsReady() && !ObjectManager.Player.HasBuff("RivenFengShuiEngine")) { MethodsOnAnimation[0](t, animname); return; } switch (animname) { case "Spell2": //w aa Me.Orbwalker.ResetAATimer(); break; case "Spell3": //e r1 { if (!ObjectManager.Player.HasBuff("RivenFengShuiEngine") && !Me.ConfigMenu.Item("CDISABLER").GetValue <bool>() && Me.Spells[R].IsReady()) { Me.Spells[R].Cast(); } } break; case "Spell4a": //r flash { if (t.Distance(ObjectManager.Player.ServerPosition) > 300) { ObjectManager.Player.Spellbook.CastSpell(Me.SummonerFlash, t.ServerPosition); } } break; } }; #endregion #region Flash Combo (Q1-Q2-E-R1-Flash-Q3-Hydra-W-R2) MethodsOnUpdate[2] = (t) => { if (!ObjectManager.Player.Spellbook.GetSpell(Me.SummonerFlash).IsReady() && !ObjectManager.Player.HasBuff("RivenFengShuiEngine")) { MethodsOnUpdate[0](t); return; } t = Target.Get(1000); if (Animation.QStacks == 2) { if (!Me.Spells[E].IsReady() && !ObjectManager.Player.HasBuff("RivenFengShuiEngine")) { return; } if (t != null) { if (Me.Spells[E].IsReady()) { Me.Spells[E].Cast(t.ServerPosition); return; } if (t.IsValidTarget(600)) { Me.CastCrescent(); if (Me.Spells[W].IsReady()) { if (t.IsValidTarget(Me.Spells[W].Range)) { Me.Spells[W].Cast(); } } else if (ObjectManager.Player.HasBuff("RivenFengShuiEngine") && !Me.ConfigMenu.Item("CDISABLER").GetValue <bool>() && Me.Spells[R].IsReady()) { Me.Spells[R].Cast(t.ServerPosition); } } } } else { if (Me.Spells[Q].IsReady()) { if (Utils.TickCount - Animation.LastQTick >= 1000) { Me.Spells[Q].Cast(Game.CursorPos); } } } }; MethodsOnAnimation[2] = (t, animname) => { { switch (animname) { case "Spell3": //e r1 { if (!ObjectManager.Player.HasBuff("RivenFengShuiEngine") && !Me.ConfigMenu.Item("CDISABLER").GetValue <bool>() && Me.Spells[R].IsReady()) { Me.Spells[R].Cast(); } } break; case "Spell4a": //r1 flash { if (t.Distance(ObjectManager.Player.ServerPosition) > 300 && Me.Orbwalker.ActiveMode == SCommon.Orbwalking.Orbwalker.Mode.Combo) { ObjectManager.Player.Spellbook.CastSpell(Me.SummonerFlash, t.ServerPosition); Me.Spells[Q].Cast(t.ServerPosition); } } break; case "Spell2": //w r2 { if (ObjectManager.Player.HasBuff("RivenFengShuiEngine") && !Me.ConfigMenu.Item("CDISABLER").GetValue <bool>() && Me.Spells[R].IsReady()) { Me.Spells[R].Cast(t.ServerPosition); } } break; } } }; #endregion }
private static void UpdateUI() { var _UIMajorStep = "Test major step"; var _UIMinorStep = "Test minor step"; var _UIMessages = new List <String>(new string[] { "Test message 1", "Test message 2", "Test message 3" }); var _UILastRiven = new Riven() { Name = "Test riven name", Drain = 50, MasteryRank = 25, Polarity = Polarity.Vazarin, Rank = 5, Rolls = 10 }; Console.SetWindowSize(1, 1); Console.SetBufferSize(147, 9); Console.SetWindowSize(147, 9); var maxWidth = Console.BufferWidth / 2; Console.CursorVisible = false; var background = " ".Pastel("#162027").PastelBg("#162027"); for (int y = 0; y < Console.WindowHeight; y++) { for (int x = 0; x < Console.BufferWidth; x++) { Console.SetCursorPosition(x, y); Console.Write(background); } } Console.Clear(); //Draw left side if (_UIMajorStep != null && _UIMajorStep.Length > 0) { Console.SetCursorPosition(0, 0); Console.Write(ColorString(_UIMajorStep.Substring(0, Math.Min(_UIMajorStep.Length, maxWidth)))); } if (_UIMinorStep != null && _UIMinorStep.Length > 0) { Console.SetCursorPosition(0, 1); Console.Write(ColorString(_UIMinorStep.Substring(0, Math.Min(_UIMinorStep.Length, maxWidth)))); } var line = 3; var messages = _UIMessages.Count > 3 ? _UIMessages.Skip(_UIMessages.Count - 3).ToList() : _UIMessages; foreach (var item in messages) { Console.SetCursorPosition(0, line); Console.WriteLine(ColorString(item.Substring(0, Math.Min(item.Length, maxWidth)))); line++; } //Draw right side if (_UILastRiven != null) { if (_UILastRiven.Name != null && _UILastRiven.Name.Length > 0) { Console.SetCursorPosition(maxWidth + 2, 0); Console.Write(ColorString(_UILastRiven.Name.Substring(0, Math.Min(_UILastRiven.Name.Length, maxWidth)))); } Console.SetCursorPosition(maxWidth + 2, 1); var input = "Polarity: " + _UILastRiven.Polarity; Console.Write(SafeColorString(maxWidth, input)); input = "Rank: " + _UILastRiven.Rank; Console.SetCursorPosition(maxWidth + 2, 2); Console.Write(SafeColorString(maxWidth, input)); input = "Mastery rank: " + _UILastRiven.MasteryRank; Console.SetCursorPosition(maxWidth + 2, 3); Console.Write(SafeColorString(maxWidth, input)); input = "Rolls: " + _UILastRiven.Rolls; Console.SetCursorPosition(maxWidth + 2, 4); Console.Write(SafeColorString(maxWidth, input)); line = 5; foreach (var modi in _UILastRiven.Modifiers) { if (line >= Console.WindowHeight) { return; } Console.SetCursorPosition(maxWidth + 2, line); Console.Write(SafeColorString(maxWidth, modi.ToString())); line++; } } }