public void Execute() { // we dont want to do anything if we are casting something... if (ObjectManager.Player.CurrentlyCastingSpellId > 0 || ObjectManager.Player.CurrentlyChannelingSpellId > 0) { return; } if ((DateTime.Now - LastBuffCheck > TimeSpan.FromSeconds(buffCheckTime) && HandleBuffing()) || (DateTime.Now - LastDebuffCheck > TimeSpan.FromSeconds(debuffCheckTime) && HandleDebuffing()) || ObjectManager.Player.ManaPercentage < 20 && ObjectManager.Player.HealthPercentage > 60 && CastSpellIfPossible(lifeTapSpell) || (ObjectManager.Player.HealthPercentage < 80 && CastSpellIfPossible(deathCoilSpell, true)) || (ObjectManager.Player.HealthPercentage < 50 && CastSpellIfPossible(drainLifeSpell, true)) || (DateTime.Now - LastDamageBuffCheck > TimeSpan.FromSeconds(damageBuffCheckTime) && HandleDamageBuffing()) || CastSpellIfPossible(metamorphosisSpell) || CastSpellIfPossible(demonicEmpowermentSpell)) { return; } WowUnit target = ObjectManager.WowObjects.OfType <WowUnit>().FirstOrDefault(e => e.Guid == ObjectManager.TargetGuid); if (target != null) { if (target.GetType() == typeof(WowPlayer)) { if ((ObjectManager.Player.Position.GetDistance(target.Position) < 6 && CastSpellIfPossible(howlOfTerrorSpell, true)) || (ObjectManager.Player.Position.GetDistance(target.Position) < 12 && CastSpellIfPossible(fearSpell, true))) { return; } } if ((ObjectManager.Player.CurrentlyCastingSpellId == 0 && ObjectManager.Player.CurrentlyCastingSpellId == 0 && CharacterManager.Inventory.Items.Count(e => e.Name.Equals("Soul Shard", StringComparison.OrdinalIgnoreCase)) < 5 && target.HealthPercentage < 8 && CastSpellIfPossible(drainSoulSpell, true))) { return; } } if (CastSpellIfPossible(incinerateSpell, true)) { return; } }
private void RenderUnits(int halfWidth, int halfHeight, Graphics graphics, double scale, Vector3 playerPosition, double playerRotation) { List <WowUnit> wowUnits = AmeisenBot.WowInterface.ObjectManager.WowObjects .OfType <WowUnit>() .ToList(); for (int i = 0; i < wowUnits.Count; ++i) { WowUnit unit = wowUnits[i]; Brush selectedBrush = unit.IsDead ? DeadBrush : (AmeisenBot.WowInterface.HookManager.WowGetUnitReaction(AmeisenBot.WowInterface.ObjectManager.Player, unit)) switch { WowUnitReaction.HostileGuard => EnemyBrush, WowUnitReaction.Hostile => EnemyBrush, WowUnitReaction.Neutral => NeutralBrush, WowUnitReaction.Friendly => FriendBrush, _ => DefaultEntityBrush, }; Point positionOnMap = GetRelativePosition(playerPosition, unit.Position, playerRotation, halfWidth, halfHeight, scale); if (unit.GetType() == typeof(WowPlayer)) { if (AmeisenBot.Config.MapRenderPlayers) { string playerName = AmeisenBot.Config.MapRenderPlayerNames ? unit.Name : string.Empty; string playerExtra = AmeisenBot.Config.MapRenderPlayerExtra ? $"<{unit.Level} {unit.Race} {unit.Class}>" : string.Empty; RenderUnit(positionOnMap.X, positionOnMap.Y, playerName, playerExtra, selectedBrush, WowColorsDrawing.GetClassPrimaryBrush(unit.Class), TextFont, SubTextFont, SubTextBrush, graphics, 7); } } else { if (AmeisenBot.Config.MapRenderUnits) { string unitName = AmeisenBot.Config.MapRenderUnitNames ? unit.Name : string.Empty; string unitExtra = AmeisenBot.Config.MapRenderPlayerExtra ? $"<{unit.Level}>" : string.Empty; RenderUnit(positionOnMap.X, positionOnMap.Y, unitName, unitExtra, selectedBrush, TextBrush, TextFont, SubTextFont, SubTextBrush, graphics); } } } }