// Token: 0x060003C1 RID: 961 RVA: 0x0001D724 File Offset: 0x0001B924 private void OnDraw(IRenderer renderer) { try { Rectangle9 rec = this.panel; foreach (Notification notification in this.notifications) { notification.Draw(renderer, rec); rec += new Vector2(0f, -(rec.Height + 20f)); } } catch (InvalidOperationException) { } catch (Exception exception) { Logger.Error(exception, null); } }
public void Draw(Rectangle9 position, float textSize) { try { RendererManager.DrawTexture(this.texture, position); RendererManager.DrawRectangle(position - 1, Color.Black); RendererManager.DrawTexture("o9k.ability_cd_bg", position); RendererManager.DrawText( Math.Ceiling(this.RemainingCooldown).ToString("N0"), position, Color.White, FontFlags.Center | FontFlags.VerticalCenter, textSize); } catch (Exception e) { Logger.Error(e); } }
// Token: 0x060001E4 RID: 484 RVA: 0x0000F414 File Offset: 0x0000D614 private void OnDraw(IRenderer renderer1) { try { float rawGameTime = Game.RawGameTime; foreach (Teleport item in this.teleports.ToList <Teleport>()) { if (rawGameTime > item.DisplayUntil) { this.teleports.Remove(item); if (this.teleports.Count == 0) { this.renderer.Draw -= this.OnDraw; } } else { if (this.showOnMinimap) { Rectangle9 rec = this.minimap.WorldToMinimap(item.Position, 20f * O9K.Core.Helpers.Hud.Info.ScreenRatio); this.renderer.DrawCircle(rec.Center, 10f * O9K.Core.Helpers.Hud.Info.ScreenRatio, item.Color, 3f); this.renderer.DrawTexture(item.MinimapTexture, rec, 0f, 1f); } if (this.showOnMap) { Rectangle9 rec2 = this.minimap.WorldToScreen(item.Position, 40f * O9K.Core.Helpers.Hud.Info.ScreenRatio); if (!rec2.IsZero) { this.renderer.DrawCircle(rec2.Center, 21f * O9K.Core.Helpers.Hud.Info.ScreenRatio, item.Color, 4f); this.renderer.DrawTexture(item.MapTexture, rec2, 0f, 1f); } } } } } catch (InvalidOperationException) { } catch (Exception exception) { Logger.Error(exception, null); } }
private void OnDraw(IRenderer renderer) { try { if (this.modifier?.IsValid != true) { this.Context.Renderer.Draw -= this.OnDraw; return; } if (this.unit?.IsVisible != true) { return; } var position = Drawing.WorldToScreen(this.unit.Position); if (position.IsZero) { return; } var ratio = Hud.Info.ScreenRatio; var remainingTime = this.endTime - Game.RawGameTime; var time = Math.Ceiling(remainingTime).ToString("N0"); var pct = (int)(100 - ((remainingTime / this.duration) * 100)); var rec = new Rectangle9(position, new Vector2(30 * ratio)); var outlinePosition = rec * 1.17f; renderer.DrawTexture(nameof(AbilityId.abyssal_underlord_dark_rift) + "_rounded", rec); renderer.DrawTexture("o9k.modifier_bg", rec); renderer.DrawTexture("o9k.outline_green", outlinePosition); renderer.DrawTexture("o9k.outline_black" + pct, outlinePosition); renderer.DrawText(rec, time, Color.White, RendererFontFlags.Center | RendererFontFlags.VerticalCenter, 22 * ratio); } catch (Exception e) { Logger.Error(e); } }
// Token: 0x060001D2 RID: 466 RVA: 0x0000EF5C File Offset: 0x0000D15C private void OnDraw(IRenderer renderer) { try { foreach (KeyValuePair <Vector3, Sleeper> keyValuePair in this.attacks.ToList <KeyValuePair <Vector3, Sleeper> >()) { if (!keyValuePair.Value.IsSleeping) { this.attacks.Remove(keyValuePair.Key); if (this.attacks.Count == 0) { this.context.Renderer.Draw -= this.OnDraw; } } else { if (this.showOnMinimap) { Rectangle9 rec = this.minimap.WorldToMinimap(keyValuePair.Key, 20f * O9K.Core.Helpers.Hud.Info.ScreenRatio); renderer.DrawTexture("attack", rec, 0f, 1f); } if (this.showOnMap) { Rectangle9 rec2 = this.minimap.WorldToScreen(keyValuePair.Key, 40f * O9K.Core.Helpers.Hud.Info.ScreenRatio); if (!rec2.IsZero) { renderer.DrawTexture("attack", rec2, 0f, 1f); } } } } } catch (InvalidOperationException) { } catch (Exception exception) { Logger.Error(exception, null); } }
// Token: 0x06000221 RID: 545 RVA: 0x00011268 File Offset: 0x0000F468 private void OnDraw(O9K.Core.Managers.Renderer.IRenderer renderer) { try { foreach (KeyValuePair <Vector3, float> keyValuePair in this.stacks) { if (keyValuePair.Value > 1f) { float num = 16f * O9K.Core.Helpers.Hud.Info.ScreenRatio; Rectangle9 rec = this.minimap.WorldToMinimap(keyValuePair.Key, num); renderer.DrawText(rec + new Size2F(num, 0f), keyValuePair.Value.ToString(), System.Drawing.Color.Orange, RendererFontFlags.Left, num, "Calibri"); } } } catch (InvalidOperationException) { } catch (Exception exception) { Logger.Error(exception, null); } }
// Token: 0x06000103 RID: 259 RVA: 0x0000A430 File Offset: 0x00008630 private void OnDrawPosition(IRenderer renderer) { try { if (this.showOnMinimap) { Rectangle9 rec = this.minimap.WorldToMinimap(this.scanPosition, 25f * O9K.Core.Helpers.Hud.Info.ScreenRatio); renderer.DrawTexture("scan", rec, 0f, 1f); } if (this.showOnMap) { Rectangle9 rec2 = this.minimap.WorldToScreen(this.scanPosition, 35f * O9K.Core.Helpers.Hud.Info.ScreenRatio); if (!rec2.IsZero) { renderer.DrawTexture("scan", rec2, 0f, 1f); } } } catch (Exception exception) { Logger.Error(exception, null); } }
// Token: 0x060001EB RID: 491 RVA: 0x0000F794 File Offset: 0x0000D994 private void OnDraw(IRenderer renderer) { try { foreach (Unit9 unit in this.units) { if (unit.IsValid) { Vector3 position = unit.Position; if (this.showOnMinimap) { Rectangle9 rec = this.minimap.WorldToMinimap(position, 20f * O9K.Core.Helpers.Hud.Info.ScreenRatio); if (rec.IsZero) { continue; } renderer.DrawTexture("courier", rec, 0f, 1f); } if (this.showOnMap && !unit.IsVisible) { Rectangle9 rec2 = this.minimap.WorldToScreen(position, 40f * O9K.Core.Helpers.Hud.Info.ScreenRatio); if (!rec2.IsZero) { renderer.DrawTexture("courier", rec2, 0f, 1f); } } } } } catch (InvalidOperationException) { } catch (Exception exception) { Logger.Error(exception, null); } }
// Token: 0x0600020C RID: 524 RVA: 0x0000FF98 File Offset: 0x0000E198 private void OnDraw(O9K.Core.Managers.Renderer.IRenderer renderer) { try { foreach (CreepWave creepWave in this.creepWaves) { if (creepWave.IsSpawned && !creepWave.IsVisible) { Vector3 predictedPosition = creepWave.PredictedPosition; string text = creepWave.Creeps.Count.ToString(); if (this.showOnMinimap) { float num = 19f * O9K.Core.Helpers.Hud.Info.ScreenRatio; Rectangle9 rec = this.minimap.WorldToMinimap(predictedPosition, num); renderer.DrawText(rec + new Size2F(num, 0f), text, System.Drawing.Color.OrangeRed, RendererFontFlags.Left, num, "Calibri"); } if (this.showOnMap) { float num2 = 32f * O9K.Core.Helpers.Hud.Info.ScreenRatio; Rectangle9 rec2 = this.minimap.WorldToScreen(predictedPosition, num2); if (!rec2.IsZero) { renderer.DrawText(rec2 + new Size2F(num2, 0f), text, System.Drawing.Color.OrangeRed, RendererFontFlags.Left, num2, "Calibri"); } } } } } catch (InvalidOperationException) { } catch (Exception exception) { Logger.Error(exception, null); } }
private void InputManagerOnMouseKeyUp(object sender, MouseEventArgs e) { try { if (e.MouseKey != MouseKey.Left || this.clickSleeper.IsSleeping) { return; } var cd = Game.RawGameTime - this.roshanKillTime; if (cd > GameData.RoshanMaxRespawnTime) { return; } var position = new Rectangle9( new Vector2(this.textPosition.Value.X - this.textSize.Value, this.textPosition.Value.Y), new Vector2(this.textSize.Value * 2)); if (!position.Contains(e.ScreenPosition)) { return; } var time = (GameData.RoshanMaxRespawnTime - cd) + Game.GameTime; var start = TimeSpan.FromSeconds(time - (GameData.RoshanMaxRespawnTime - GameData.RoshanMinRespawnTime)).ToString("mss"); var end = TimeSpan.FromSeconds(time).ToString("mss"); Game.ExecuteCommand("say_team \"" + start + " " + end + " rosh\""); this.clickSleeper.Sleep(30); } catch (Exception ex) { Logger.Error(ex); } }
private void OnDraw() { try { foreach (var unit in this.units) { if (!unit.IsValid(this.showAlly)) { continue; } var hpPosition = unit.HealthBarPosition; if (hpPosition.IsZero) { continue; } var start = new Rectangle9(hpPosition.X, hpPosition.Y + 55, this.size, this.size) + this.position; foreach (var modifier in unit.Modifiers.ToArray()) { if (modifier.IsAbilityTextureName) { RendererManager.DrawTexture(modifier.TextureName, start, TextureType.RoundAbility); } else { RendererManager.DrawTexture(modifier.TextureName, start); } if (!modifier.IgnoreTime) { var remainingTime = modifier.RemainingTime; if (this.showTime) { var timePosition = start * 1.5f; RendererManager.DrawTexture("o9k.modifier_bg", timePosition); RendererManager.DrawText( remainingTime < 10 ? remainingTime.ToString("N1") : remainingTime.ToString("N0"), timePosition, Color.White, FontFlags.Center | FontFlags.VerticalCenter, this.textSize); } var pct = (int)(100 - ((remainingTime / modifier.Duration) * 100)); var outlinePosition = start * 1.17f; RendererManager.DrawTexture(modifier.IsDebuff ? "o9k.outline_red" : "o9k.outline_green", outlinePosition); RendererManager.DrawTexture("o9k.outline_black" + pct, outlinePosition); } else { RendererManager.DrawTexture(modifier.IsDebuff ? "o9k.outline_red" : "o9k.outline_green", start * 1.17f); } start += new Vector2(0, this.size + 5); } } } catch (InvalidOperationException) { // ignore } catch (Exception e) { Logger.Error(e); } }
public bool DrawUltimate(RectangleF position, Rectangle9 cdPosition, bool cdTime) { if (this.ultimate?.IsValid != true) { return(false); } var cooldown = this.ultimate.RemainingCooldown; if (cooldown > 0) { RendererManager.DrawTexture("o9k.ult_cd", position); if (!cdPosition.IsZero) { if (!this.hero.IsAlive) { return(false); } var pct = (int)(100 - ((cooldown / this.ultimate.Cooldown) * 100)); var outlinePosition = cdPosition * 1.1f; RendererManager.DrawTexture(this.ultimate.Name, cdPosition, TextureType.RoundAbility); RendererManager.DrawTexture("o9k.outline_black100", outlinePosition); RendererManager.DrawTexture("o9k.outline_green_pct" + pct, outlinePosition); if (cdTime) { RendererManager.DrawTexture("o9k.top_ult_cd_bg", cdPosition); RendererManager.DrawText( cooldown.ToString("N0"), cdPosition, Color.White, FontFlags.Center | FontFlags.VerticalCenter, 20 * Hud.Info.ScreenRatio); } return(true); } } else if (this.ultimate.ManaCost > this.hero.Mana) { RendererManager.DrawTexture("o9k.ult_mp", position); if (!cdPosition.IsZero) { if (!this.hero.IsAlive) { return(false); } var pct = (int)((this.hero.Mana / this.ultimate.ManaCost) * 100); var outlinePosition = cdPosition * 1.1f; RendererManager.DrawTexture(this.ultimate.Id, cdPosition, AbilityTextureType.Round); RendererManager.DrawTexture("o9k.outline_black100", outlinePosition); RendererManager.DrawTexture("o9k.outline_blue_pct" + pct, outlinePosition); if (cdTime) { var mpCd = Math.Ceiling((this.ultimate.ManaCost - this.hero.Mana) / this.hero.ManaRegeneration).ToString("N0"); RendererManager.DrawTexture("o9k.top_ult_cd_bg", cdPosition); RendererManager.DrawText(mpCd, cdPosition, Color.White, FontFlags.Center | FontFlags.VerticalCenter, 20); } return(true); } } else if (this.ultimate.IsUsable && this.ultimate.Level > 0) { RendererManager.DrawTexture("o9k.ult_rdy", position); } return(false); }
public void Draw(Rectangle9 position, float cooldownSize) { try { RendererManager.DrawTexture(this.Ability.TextureName, position, TextureType.Ability); if (this.Ability.IsCasting || this.Ability.IsChanneling) { RendererManager.DrawRectangle(position - 3f, Color.LightGreen, 3); } else { RendererManager.DrawRectangle(position - 1, Color.Black); } if (this.displayLevel) { var level = this.Ability.Level; if (level == 0) { RendererManager.DrawTexture("o9k.ability_0lvl_bg", position); return; } var levelText = level.ToString("N0"); var levelSize = RendererManager.MeasureText(levelText, position.Width * 0.45f); var levelPosition = position.SinkToBottomLeft(levelSize.X, levelSize.Y * 0.8f); RendererManager.DrawTexture("o9k.ability_lvl_bg", levelPosition); RendererManager.DrawText(levelText, levelPosition, Color.White, FontFlags.VerticalCenter, position.Width * 0.45f); } if (this.Ability.IsDisplayingCharges) { var chargesText = this.Ability.Charges.ToString("N0"); var chargesPosition = position.SinkToBottomRight(position.Width * 0.5f, position.Height * 0.5f); RendererManager.DrawTexture("o9k.charge_bg", chargesPosition); RendererManager.DrawTexture("o9k.outline_green", chargesPosition * 1.07f); RendererManager.DrawText(chargesText, chargesPosition, Color.White, FontFlags.Center, position.Width * 0.45f); } if (this.Ability.IsChanneling) { return; } var cooldown = this.Ability.RemainingCooldown; if (cooldown > 0) { RendererManager.DrawTexture("o9k.ability_cd_bg", position); RendererManager.DrawText( Math.Ceiling(cooldown).ToString("N0"), position, Color.White, FontFlags.Center | FontFlags.VerticalCenter, cooldownSize); } else if (this.Ability.ManaCost > this.Ability.Owner.Mana) { RendererManager.DrawTexture("o9k.ability_mana_bg", position); RendererManager.DrawText( Math.Ceiling((this.Ability.ManaCost - this.Ability.Owner.Mana) / this.Ability.Owner.ManaRegeneration) .ToString("N0"), position, Color.White, FontFlags.Center | FontFlags.VerticalCenter, cooldownSize); } else if (!this.Ability.IsUsable) { RendererManager.DrawTexture("o9k.ability_0lvl_bg", position); } } catch (Exception e) { Logger.Error(e); } }
// Token: 0x060000E5 RID: 229 RVA: 0x000093EC File Offset: 0x000075EC public bool DrawUltimate(O9K.Core.Managers.Renderer.IRenderer renderer, RectangleF position, Rectangle9 cdPosition, bool cdTime) { Ability9 ability = this.ultimate; if (ability == null || !ability.IsValid) { return(false); } float remainingCooldown = this.ultimate.RemainingCooldown; if (remainingCooldown > 0f) { renderer.DrawTexture("ult_cd", position, 0f, 1f); if (!cdPosition.IsZero) { if (!this.hero.IsAlive) { return(false); } int num = (int)(100f - remainingCooldown / this.ultimate.Cooldown * 100f); Rectangle9 rec = cdPosition * 1.1f; renderer.DrawTexture(this.ultimate.Name + "_rounded", cdPosition, 0f, 1f); renderer.DrawTexture("outline_black100", rec, 0f, 1f); renderer.DrawTexture("outline_green_pct" + num, rec, 0f, 1f); if (cdTime) { renderer.DrawTexture("top_ult_cd_bg", cdPosition, 0f, 1f); renderer.DrawText(cdPosition, remainingCooldown.ToString("N0"), System.Drawing.Color.White, RendererFontFlags.Center | RendererFontFlags.VerticalCenter, 20f * O9K.Core.Helpers.Hud.Info.ScreenRatio, "Calibri"); } return(true); } } else if (this.ultimate.ManaCost > this.hero.Mana) { renderer.DrawTexture("ult_mp", position, 0f, 1f); if (!cdPosition.IsZero) { if (!this.hero.IsAlive) { return(false); } int num2 = (int)(this.hero.Mana / this.ultimate.ManaCost * 100f); Rectangle9 rec2 = cdPosition * 1.1f; renderer.DrawTexture(this.ultimate.Name + "_rounded", cdPosition, 0f, 1f); renderer.DrawTexture("outline_black100", rec2, 0f, 1f); renderer.DrawTexture("outline_blue_pct" + num2, rec2, 0f, 1f); if (cdTime) { string text = Math.Ceiling((double)((this.ultimate.ManaCost - this.hero.Mana) / this.hero.ManaRegeneration)).ToString("N0"); renderer.DrawTexture("top_ult_cd_bg", cdPosition, 0f, 1f); renderer.DrawText(cdPosition, text, System.Drawing.Color.White, RendererFontFlags.Center | RendererFontFlags.VerticalCenter, 20f, "Calibri"); } return(true); } } else if (this.ultimate.IsUsable && this.ultimate.Level > 0u) { renderer.DrawTexture("ult_rdy", position, 0f, 1f); } return(false); }
public void DrawManaBar( Rectangle9 hpBar, int mpPositionY, int mpSizeY, bool showMpRestore, bool showMpAmount, int manaTextSize) { try { var mana = this.unit.Mana; var maxMana = this.unit.MaximumMana; var mpBar = new RectangleF( hpBar.BottomLeft.X, hpBar.BottomLeft.Y + mpPositionY, hpBar.Size.Width * (mana / maxMana), hpBar.Size.Height + mpSizeY); var borderBar = new RectangleF( mpBar.X - this.borderSize, mpBar.Y - this.borderSize, hpBar.Width + (this.borderSize * 2), mpBar.Height + (this.borderSize * 2)); RendererManager.DrawFilledRectangle(borderBar, this.borderColor); RendererManager.DrawFilledRectangle(mpBar, this.manaColor); if (showMpRestore) { var restore = 0f; foreach (var ability in this.manaRestore) { if (!ability.IsValid || !ability.CanBeCasted(false)) { continue; } if (ability is EnchantedMango mango) { restore += ability.GetManaRestore(this.unit) * mango.Charges; } else { restore += ability.GetManaRestore(this.unit); } } restore = Math.Min(restore, maxMana - mana); if (restore > 0) { var restoreBar = new RectangleF( mpBar.TopRight.X, mpBar.TopRight.Y, hpBar.Width * (restore / maxMana), mpBar.Height); RendererManager.DrawFilledRectangle(restoreBar, this.manaRestoreColor); } } if (showMpAmount) { RendererManager.DrawText( mana.ToString("N0"), borderBar, Color.White, FontFlags.Center | FontFlags.VerticalCenter, manaTextSize); } } catch (InvalidOperationException) { //ignore } catch (Exception e) { Logger.Error(e); } }
public Rectangle9(Rectangle9 ob) : base(ob) { }
// Token: 0x0600011E RID: 286 RVA: 0x0000AFB4 File Offset: 0x000091B4 private void OnDraw(O9K.Core.Managers.Renderer.IRenderer renderer) { try { Vector2 vector = this.position.Value; foreach (Unit9 unit in this.units) { if (unit.IsValid) { renderer.DrawTexture(unit.Name, vector, this.heroSize, 0f, 1f); Rectangle9 rec = new Rectangle9(vector.X + this.heroSize.X + 1f, vector.Y, this.itemSize.X, this.itemSize.Y); for (int i = 0; i < 6; i++) { renderer.DrawTexture("inventory_item_bg", rec + new Vector2((this.itemSize.X + 1f) * (float)i, 0f), 0f, 1f); } foreach (Ability9 ability in from x in unit.Abilities orderby x.Id == AbilityId.item_tpscroll select x) { if (ability.Id == AbilityId.item_tpscroll) { Rectangle9 rec2 = new Rectangle9(vector + new Vector2(this.heroSize.X * 0.7f, this.heroSize.Y * 0.35f), this.itemSize.X * 0.55f, this.itemSize.X * 0.55f); renderer.DrawTexture("outline", rec2 + 1f, 0f, 1f); renderer.DrawTexture(ability.Name + "_rounded", rec2, 0f, 1f); if (this.showCooldown) { float remainingCooldown = ability.RemainingCooldown; if (remainingCooldown > 0f) { renderer.DrawTexture("inventory_tp_cd_bg", rec2, 0f, 1f); renderer.DrawText(rec2, Math.Ceiling((double)remainingCooldown).ToString("N0"), System.Drawing.Color.White, RendererFontFlags.Center | RendererFontFlags.VerticalCenter, this.size * 0.35f, "Calibri"); } } } else if (ability.IsItem && ability.IsUsable) { Rectangle9 rec3 = rec - 4f; renderer.DrawTexture(ability.Name, rec3, 0f, 1f); if (this.showCharges && ability.IsDisplayingCharges) { string text = ability.BaseItem.CurrentCharges.ToString("N0"); Vector2 vector2 = renderer.MeasureText(text, this.size * 0.35f, "Calibri"); Rectangle9 rec4 = rec3.SinkToBottomRight(vector2.X * 1.1f, vector2.Y * 0.8f); renderer.DrawFilledRectangle(rec4, System.Drawing.Color.Black); renderer.DrawText(rec4, text, System.Drawing.Color.White, RendererFontFlags.Left, this.size * 0.35f, "Calibri"); } if (this.showCooldown) { float remainingCooldown2 = ability.RemainingCooldown; if (remainingCooldown2 > 0f) { renderer.DrawTexture("inventory_item_cd_bg", rec3, 0f, 1f); renderer.DrawText(rec3, Math.Ceiling((double)remainingCooldown2).ToString("N0"), System.Drawing.Color.White, RendererFontFlags.Center | RendererFontFlags.VerticalCenter, this.size * 0.7f, "Calibri"); } } rec += new Vector2(this.itemSize.X + 1f, 0f); } } vector += new Vector2(0f, (float)(this.size + 1)); } } } catch (InvalidOperationException) { } catch (Exception exception) { Logger.Error(exception, null); } }
private void OnDraw() { try { foreach (var unitPair in this.unitDamage) { var unit = unitPair.Key; if (!unit.IsValid) { continue; } var hpBarPosition = unit.Unit.HealthBarPosition; if (hpBarPosition.IsZero) { continue; } var damage = unitPair.Value; var hpBarSize = unit.Unit.HealthBarSize; var attackDamage = damage.AutoAttackDamage; var health = unit.Unit.Health; if (this.menu.AttacksEnabled) { var attackDamagePct = attackDamage / unit.Unit.MaximumHealth; Color color; if (attackDamage > health) { color = unit.IsAlly ? Color.LawnGreen : Color.OrangeRed; } else { color = unit.IsAlly ? Color.DarkGreen : Color.DarkRed; } var bar = new Rectangle9( hpBarPosition + new Vector2(this.menu.AttacksX, this.menu.AttacksY), hpBarSize + new Vector2(this.menu.AttacksSizeX, this.menu.AttacksSizeY)); bar.Width *= Math.Min(attackDamagePct, unit.Unit.HealthPercentageBase); RendererManager.DrawFilledRectangle(bar, color); } if (this.menu.AbilitiesEnabled) { var fullDamage = damage.AbilityDamage.Sum(x => x.Value); if (fullDamage + attackDamage < health) { continue; } if (fullDamage > health) { var totalDamage = 0; var drawAbilities = new List <string>(); foreach (var damagePair in damage.AbilityDamage) { totalDamage += damagePair.Value; drawAbilities.Add(damagePair.Key.Name); if (totalDamage > health) { break; } } var count = drawAbilities.Count; if (count > 0) { var barSize = new Vector2(this.menu.AbilitiesSize * count, this.menu.AbilitiesSize); var startPosition = hpBarPosition + new Vector2((hpBarSize.X / 2f) - (barSize.X / 2f), -35) + new Vector2(this.menu.AbilitiesX, this.menu.AbilitiesY); RendererManager.DrawRectangle( new RectangleF(startPosition.X, startPosition.Y, barSize.X, barSize.Y), Color.Green, 5); foreach (var ability in drawAbilities) { RendererManager.DrawTexture(ability, new RectangleF(startPosition.X, startPosition.Y, barSize.Y, barSize.Y), TextureType.Ability); startPosition += new Vector2(barSize.Y, 0); } } } else { var count = damage.AbilityDamage.Count; if (count > 0) { var barSize = new Vector2(this.menu.AbilitiesSize * count, this.menu.AbilitiesSize); var startPosition = hpBarPosition + new Vector2((hpBarSize.X / 2f) - (barSize.X / 2f), -35) + new Vector2(this.menu.AbilitiesX, this.menu.AbilitiesY); RendererManager.DrawRectangle( new RectangleF(startPosition.X, startPosition.Y, barSize.X, barSize.Y), Color.Orange, 5); foreach (var ability in damage.AbilityDamage.Select(x => x.Key)) { RendererManager.DrawTexture(ability.Name, new RectangleF(startPosition.X, startPosition.Y, barSize.Y, barSize.Y)); startPosition += new Vector2(barSize.Y, 0); } } } } } } catch (InvalidOperationException) { // ignore } catch (Exception e) { Logger.Error(e); } }
private void InputOnMouseKeyDown(MouseEventArgs e) { try { if (e.MouseKey != MouseKey.Left) { return; } var startPosition = this.position.Value; var itemPanel = new Rectangle9( startPosition, new Vector2(this.heroSize.X + ((this.itemSize.X + 1) * 7), this.heroSize.Y * this.units.Count)); if (!itemPanel.Contains(e.Position)) { return; } foreach (var unit in this.units) { if (!unit.IsValid) { continue; } var borderPosition = new Rectangle9( startPosition.X + this.heroSize.X + 1, startPosition.Y, this.itemSize.X, this.itemSize.Y); foreach (var ability in unit.Abilities.OrderBy(x => x.Id == AbilityId.item_tpscroll)) { if (ability.Id == AbilityId.item_tpscroll) { continue; } if (!ability.IsItem || !ability.IsUsable) { continue; } var itemPosition = borderPosition - 4; if (itemPosition.Contains(e.Position)) { ability.BaseAbility.Announce(); return; } borderPosition += new Vector2(this.itemSize.X + 1, 0); } startPosition += new Vector2(0, this.size + 1); } } catch (Exception ex) { Logger.Error(ex); } }
public void DrawHealthBar( Rectangle9 hpBar, int hpPositionY, int hpSizeY, bool showHpRestore, bool showHpAmount, int hpTextSize) { try { var hp = this.unit.Health; if (showHpRestore) { var maxHp = this.unit.MaximumHealth; var restore = 0f; var faerieAdded = false; foreach (var ability in this.healthRestore) { if (!ability.IsValid || !ability.CanBeCasted(false)) { continue; } if (ability.Id == AbilityId.item_faerie_fire) { // dont stack faerie hp restore cuz they have cooldown if (faerieAdded) { continue; } faerieAdded = true; } restore += ability.GetHealthRestore(this.unit); } restore = Math.Min(restore, maxHp - hp); if (restore > 0) { var restoreBar = new RectangleF( hpBar.TopLeft.X + ((hpBar.Width * (hp / maxHp)) + 1), hpBar.TopLeft.Y + hpPositionY, hpBar.Width * (restore / maxHp), hpBar.Height + hpSizeY); //var borderBar = new RectangleF( // restoreBar.X - this.borderSize, // restoreBar.Y - this.borderSize, // restoreBar.Width + this.borderSize * 2, // restoreBar.Height + this.borderSize * 2); //renderer.DrawFilledRectangle(borderBar, this.borderColor); RendererManager.DrawFilledRectangle(restoreBar, this.healthRestoreColor); } } if (showHpAmount) { RendererManager.DrawText( hp.ToString("N0"), new RectangleF(hpBar.X - (hpBar.Width / 2), hpBar.Y - (hpBar.Height / 2), hpBar.Width * 2, hpBar.Height * 2), Color.White, FontFlags.Center | FontFlags.VerticalCenter, hpTextSize); } } catch (InvalidOperationException) { //ignore } catch (Exception e) { Logger.Error(e); } }
private void OnDraw() { try { var heroPosition = this.position.Value; foreach (var unit in this.units) { if (!unit.IsValid) { continue; } RendererManager.DrawTexture(unit.TextureName, new RectangleF(heroPosition.X, heroPosition.Y, this.heroSize.X, this.heroSize.Y), TextureType.Unit); var borderPosition = new Rectangle9( heroPosition.X + this.heroSize.X + 1, heroPosition.Y, this.itemSize.X, this.itemSize.Y); for (var i = 0; i < 7; i++) { RendererManager.DrawTexture("o9k.inventory_item_bg", borderPosition + new Vector2((this.itemSize.X + 1) * i, 0)); } foreach (var ability in unit.Abilities.OrderBy(x => x.Id == AbilityId.item_tpscroll)) { if (ability.Id == AbilityId.item_tpscroll) { var tpPosition = new Rectangle9( heroPosition + new Vector2(this.heroSize.X * 0.65f, this.heroSize.Y * 0.4f), this.itemSize.X * 0.6f, this.itemSize.X * 0.6f); RendererManager.DrawTexture("o9k.outline", tpPosition + 1); RendererManager.DrawTexture(ability.TextureName, tpPosition, TextureType.RoundAbility); if (this.showCooldown) { var cooldown = ability.RemainingCooldown; if (cooldown > 0) { RendererManager.DrawTexture("o9k.inventory_tp_cd_bg", tpPosition); RendererManager.DrawText( Math.Ceiling(cooldown).ToString("N0"), tpPosition, Color.White, FontFlags.Center | FontFlags.VerticalCenter, this.size * 0.35f); } } continue; } if (!ability.IsItem || !ability.IsUsable) { continue; } var itemPosition = borderPosition - 4; RendererManager.DrawTexture(ability.TextureName, itemPosition, TextureType.Ability); if (this.showCharges && ability.IsDisplayingCharges) { var chargesText = ability.BaseItem.CurrentCharges.ToString("N0"); var chargesSize = RendererManager.MeasureText(chargesText, this.size * 0.35f); var chargesPosition = itemPosition.SinkToBottomRight(chargesSize.X * 1.1f, chargesSize.Y * 0.8f); RendererManager.DrawFilledRectangle(chargesPosition, Color.Black); RendererManager.DrawText(chargesText, chargesPosition, Color.White, FontFlags.Left, this.size * 0.35f); } if (this.showCooldown) { var cooldown = ability.RemainingCooldown; if (cooldown > 0) { RendererManager.DrawTexture("o9k.inventory_item_cd_bg", itemPosition); RendererManager.DrawText( Math.Ceiling(cooldown).ToString("N0"), itemPosition, Color.White, FontFlags.Center | FontFlags.VerticalCenter, this.size * 0.7f); } } borderPosition += new Vector2(this.itemSize.X + 1, 0); } heroPosition += new Vector2(0, this.size + 1); } } catch (InvalidOperationException) { //ignore } catch (Exception e) { Logger.Error(e); } }