private void UpdateBotInfo(int maxSecondary, int secondary, Brush primaryBrush, Brush secondaryBrush) { labelPlayerName.Content = AmeisenBot.Bot.Db.GetUnitName(AmeisenBot.Bot.Player, out string name) ? name : "unknown"; labelMapName.Content = AmeisenBot.Bot.Objects.MapId.ToString(); labelZoneName.Content = AmeisenBot.Bot.Objects.ZoneName; labelZoneSubName.Content = AmeisenBot.Bot.Objects.ZoneSubName; labelCurrentLevel.Content = $"{AmeisenBot.Bot.Player.Level} (iLvl. {Math.Round(AmeisenBot.Bot.Character.Equipment.AverageItemLevel)})"; labelCurrentRace.Content = $"{AmeisenBot.Bot.Player.Race} {AmeisenBot.Bot.Player.Gender}"; labelCurrentClass.Content = AmeisenBot.Bot.Player.Class; progressbarExp.Maximum = AmeisenBot.Bot.Player.NextLevelXp; progressbarExp.Value = AmeisenBot.Bot.Player.Xp; labelCurrentExp.Content = $"{Math.Round(AmeisenBot.Bot.Player.XpPercentage)}%"; progressbarHealth.Maximum = AmeisenBot.Bot.Player.MaxHealth; progressbarHealth.Value = AmeisenBot.Bot.Player.Health; labelCurrentHealth.Content = BotUtils.BigValueToString(AmeisenBot.Bot.Player.Health); labelCurrentCombatclass.Content = AmeisenBot.Bot.CombatClass == null ? $"No CombatClass" : AmeisenBot.Bot.CombatClass.ToString(); progressbarSecondary.Maximum = maxSecondary; progressbarSecondary.Value = secondary; labelCurrentSecondary.Content = BotUtils.BigValueToString(secondary); progressbarHealth.Foreground = primaryBrush; progressbarSecondary.Foreground = secondaryBrush; labelCurrentClass.Foreground = primaryBrush; }
public void BigValueToStringTest() { Assert.AreEqual("1", BotUtils.BigValueToString(1)); Assert.AreEqual("10", BotUtils.BigValueToString(10)); Assert.AreEqual("100", BotUtils.BigValueToString(100)); Assert.AreEqual("1000", BotUtils.BigValueToString(1000)); Assert.AreEqual("10000", BotUtils.BigValueToString(10000)); Assert.AreEqual("100K", BotUtils.BigValueToString(100000)); Assert.AreEqual("1000K", BotUtils.BigValueToString(1000000)); Assert.AreEqual("10000K", BotUtils.BigValueToString(10000000)); Assert.AreEqual("100M", BotUtils.BigValueToString(100000000)); Assert.AreEqual("1000M", BotUtils.BigValueToString(1000000000)); }
private void UpdateBotInfo(int maxSecondary, int secondary, Brush primaryBrush, Brush secondaryBrush) { // generic stuff labelPlayerName.Content = AmeisenBot.WowInterface.ObjectManager.Player.Name; labelGamestate.Content = AmeisenBot.WowInterface.ObjectManager.GameState; labelMapName.Content = AmeisenBot.WowInterface.ObjectManager.MapId.ToString(); labelZoneName.Content = AmeisenBot.WowInterface.ObjectManager.ZoneName; labelZoneSubName.Content = AmeisenBot.WowInterface.ObjectManager.ZoneSubName; labelCurrentLevel.Content = AmeisenBot.WowInterface.ObjectManager.Player.Level; labelCurrentRace.Content = $"{AmeisenBot.WowInterface.ObjectManager.Player.Race} {AmeisenBot.WowInterface.ObjectManager.Player.Gender}"; labelCurrentClass.Content = AmeisenBot.WowInterface.ObjectManager.Player.Class; progressbarExp.Maximum = AmeisenBot.WowInterface.ObjectManager.Player.NextLevelXp; progressbarExp.Value = AmeisenBot.WowInterface.ObjectManager.Player.Xp; labelCurrentExp.Content = $"{Math.Round(AmeisenBot.WowInterface.ObjectManager.Player.XpPercentage)}%"; progressbarHealth.Maximum = AmeisenBot.WowInterface.ObjectManager.Player.MaxHealth; progressbarHealth.Value = AmeisenBot.WowInterface.ObjectManager.Player.Health; labelCurrentHealth.Content = BotUtils.BigValueToString(AmeisenBot.WowInterface.ObjectManager.Player.Health); labelCurrentCombatclass.Content = AmeisenBot.WowInterface.CombatClass == null ? $"No CombatClass" : AmeisenBot.WowInterface.CombatClass.ToString(); // class specific stuff progressbarSecondary.Maximum = maxSecondary; progressbarSecondary.Value = secondary; labelCurrentSecondary.Content = BotUtils.BigValueToString(secondary); if (progressbarHealth.Foreground != primaryBrush) { progressbarHealth.Foreground = primaryBrush; } if (progressbarSecondary.Foreground != secondaryBrush) { progressbarSecondary.Foreground = secondaryBrush; } if (labelCurrentClass.Foreground != primaryBrush) { labelCurrentClass.Foreground = primaryBrush; } }
private void UpdatePlayerStats(WowPlayer player, WowUnit target) { labelBothealth.Content = $"Health: {BotUtils.BigValueToString(player.Health)}/{BotUtils.BigValueToString(player.MaxHealth)}"; if (player.MaxHealth > 0) { progressbarBothealth.Value = (player.Health / player.MaxHealth) * 100; } labelBotenergy.Content = $"Energy: {BotUtils.BigValueToString(player.Energy)}/{BotUtils.BigValueToString(player.MaxEnergy)}"; if (player.MaxEnergy > 0) { progressbarBotenergy.Value = (player.Energy / player.MaxEnergy) * 100; } labelBotexp.Content = $"Exp: {BotUtils.BigValueToString(player.Exp)}/{BotUtils.BigValueToString(player.MaxExp)}"; if (player.MaxExp > 0) { progressbarBotexp.Value = (player.Exp / player.MaxExp) * 100; } labelBotlevel.Content = $"lvl. {player.Level}"; labelBotraceclass.Content = $"<{player.Race.ToString()}, {player.Class.ToString()}>"; if (target != null) { labelBotdebug.Content = $"0x{target.BaseAddress.ToString("X", CultureInfo.InvariantCulture.NumberFormat)}"; } BitmapImage botBitmap = SearchForBotPicture(); if (botBitmap != null) { botImage.Source = botBitmap; } SetProgressbarToClassColor(player); }
private void UpdateBotInfo(int maxSecondary, int secondary, Brush primaryBrush, Brush secondaryBrush) { // Generic labels // ------------- > labelPlayerName.Content = AmeisenBot.WowInterface.ObjectManager.Player.Name; labelMapName.Content = AmeisenBot.WowInterface.ObjectManager.MapId.ToString(); labelZoneName.Content = AmeisenBot.WowInterface.ObjectManager.ZoneName; labelZoneSubName.Content = AmeisenBot.WowInterface.ObjectManager.ZoneSubName; labelCurrentLevel.Content = $"{AmeisenBot.WowInterface.ObjectManager.Player.Level} (iLvl. {Math.Round(AmeisenBot.WowInterface.CharacterManager.Equipment.AverageItemLevel)})"; labelCurrentRace.Content = $"{AmeisenBot.WowInterface.ObjectManager.Player.Race} {AmeisenBot.WowInterface.ObjectManager.Player.Gender}"; labelCurrentClass.Content = AmeisenBot.WowInterface.ObjectManager.Player.Class; progressbarExp.Maximum = AmeisenBot.WowInterface.ObjectManager.Player.NextLevelXp; progressbarExp.Value = AmeisenBot.WowInterface.ObjectManager.Player.Xp; labelCurrentExp.Content = $"{Math.Round(AmeisenBot.WowInterface.ObjectManager.Player.XpPercentage)}%"; progressbarHealth.Maximum = AmeisenBot.WowInterface.ObjectManager.Player.MaxHealth; progressbarHealth.Value = AmeisenBot.WowInterface.ObjectManager.Player.Health; labelCurrentHealth.Content = BotUtils.BigValueToString(AmeisenBot.WowInterface.ObjectManager.Player.Health); labelCurrentCombatclass.Content = AmeisenBot.WowInterface.CombatClass == null ? $"No CombatClass" : AmeisenBot.WowInterface.CombatClass.ToString(); // Class specific labels // --------------------- > progressbarSecondary.Maximum = maxSecondary; progressbarSecondary.Value = secondary; labelCurrentSecondary.Content = BotUtils.BigValueToString(secondary); // Colors // ------ > progressbarHealth.Foreground = primaryBrush; progressbarSecondary.Foreground = secondaryBrush; labelCurrentClass.Foreground = primaryBrush; }
private void OnObjectUpdateComplete(List <WowObject> wowObjects) { Dispatcher.InvokeAsync(() => { labelPlayerName.Content = AmeisenBot.ObjectManager.Player.Name; labelCurrentLevel.Content = $"lvl. {AmeisenBot.ObjectManager.Player.Level}"; labelCurrentRace.Content = $"{AmeisenBot.ObjectManager.Player.Gender} {AmeisenBot.ObjectManager.Player.Race}"; labelCurrentClass.Content = $"{AmeisenBot.ObjectManager.Player.Class} [{AmeisenBot.ObjectManager.Player.PowerType}]"; if (AmeisenBot.CombatClass == null) { labelCurrentCombatclass.Content = $"No CombatClass"; } else { labelCurrentCombatclass.Content = $"{AmeisenBot.CombatClass.GetType().Name}"; } progressbarExp.Maximum = AmeisenBot.ObjectManager.Player.MaxExp; progressbarExp.Value = AmeisenBot.ObjectManager.Player.Exp; labelCurrentHealth.Content = $"{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.Exp)}/{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.MaxExp)}"; progressbarHealth.Maximum = AmeisenBot.ObjectManager.Player.MaxHealth; progressbarHealth.Value = AmeisenBot.ObjectManager.Player.Health; labelCurrentHealth.Content = $"{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.Health)}/{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.MaxHealth)}"; if (AmeisenBot.ObjectManager.Target != null) { labelBaseAddress.Content = $"BaseAddress: {AmeisenBot.ObjectManager.Target.BaseAddress.ToString("X")}"; labelDescriptor.Content = $"Descriptor: {AmeisenBot.ObjectManager.Target.DescriptorAddress.ToString("X")}"; labelNpcFlags.Content = $"NpcFlags: {AmeisenBot.ObjectManager.Target.NpcFlags.Data.ToString("X")}"; labelisNpc.Content = $"isNpc: {AmeisenBot.ObjectManager.Target.IsNoneNpc}"; labelisVendor.Content = $"isVendor: {AmeisenBot.ObjectManager.Target.IsVendor}"; labelisRepair.Content = $"isRepair: {AmeisenBot.ObjectManager.Target.IsRepairVendor}"; } switch (AmeisenBot.ObjectManager.Player.Class) { case WowClass.DeathKnight: progressbarSecondary.Maximum = AmeisenBot.ObjectManager.Player.MaxRuneenergy; progressbarSecondary.Value = AmeisenBot.ObjectManager.Player.Runeenergy; labelCurrentSecondary.Content = $"{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.Runeenergy)}/{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.MaxRuneenergy)}"; progressbarHealth.Foreground = dkPrimaryBrush; progressbarSecondary.Foreground = dkSecondaryBrush; break; case WowClass.Druid: progressbarSecondary.Maximum = AmeisenBot.ObjectManager.Player.MaxMana; progressbarSecondary.Value = AmeisenBot.ObjectManager.Player.Mana; labelCurrentSecondary.Content = $"{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.Mana)}/{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.MaxMana)}"; progressbarHealth.Foreground = druidPrimaryBrush; progressbarSecondary.Foreground = druidSecondaryBrush; break; case WowClass.Hunter: progressbarSecondary.Maximum = AmeisenBot.ObjectManager.Player.MaxMana; progressbarSecondary.Value = AmeisenBot.ObjectManager.Player.Mana; labelCurrentSecondary.Content = $"{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.Mana)}/{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.MaxMana)}"; progressbarHealth.Foreground = hunterPrimaryBrush; progressbarSecondary.Foreground = hunterSecondaryBrush; break; case WowClass.Mage: progressbarSecondary.Maximum = AmeisenBot.ObjectManager.Player.MaxMana; progressbarSecondary.Value = AmeisenBot.ObjectManager.Player.Mana; labelCurrentSecondary.Content = $"{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.Mana)}/{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.MaxMana)}"; progressbarHealth.Foreground = magePrimaryBrush; progressbarSecondary.Foreground = mageSecondaryBrush; break; case WowClass.Paladin: progressbarSecondary.Maximum = AmeisenBot.ObjectManager.Player.MaxMana; progressbarSecondary.Value = AmeisenBot.ObjectManager.Player.Mana; labelCurrentSecondary.Content = $"{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.Mana)}/{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.MaxMana)}"; progressbarHealth.Foreground = paladinPrimaryBrush; progressbarSecondary.Foreground = paladinSecondaryBrush; break; case WowClass.Priest: progressbarSecondary.Maximum = AmeisenBot.ObjectManager.Player.MaxMana; progressbarSecondary.Value = AmeisenBot.ObjectManager.Player.Mana; labelCurrentSecondary.Content = $"{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.Mana)}/{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.MaxMana)}"; progressbarHealth.Foreground = priestPrimaryBrush; progressbarSecondary.Foreground = priestSecondaryBrush; break; case WowClass.Rogue: progressbarSecondary.Maximum = AmeisenBot.ObjectManager.Player.MaxEnergy; progressbarSecondary.Value = AmeisenBot.ObjectManager.Player.Energy; labelCurrentSecondary.Content = $"{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.Energy)}/{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.MaxEnergy)}"; progressbarHealth.Foreground = roguePrimaryBrush; progressbarSecondary.Foreground = rogueSecondaryBrush; break; case WowClass.Shaman: progressbarSecondary.Maximum = AmeisenBot.ObjectManager.Player.MaxMana; progressbarSecondary.Value = AmeisenBot.ObjectManager.Player.Mana; labelCurrentSecondary.Content = $"{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.Mana)}/{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.MaxMana)}"; progressbarHealth.Foreground = shamanPrimaryBrush; progressbarSecondary.Foreground = shamanSecondaryBrush; break; case WowClass.Warlock: progressbarSecondary.Maximum = AmeisenBot.ObjectManager.Player.MaxMana; progressbarSecondary.Value = AmeisenBot.ObjectManager.Player.Mana; labelCurrentSecondary.Content = $"{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.Mana)}/{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.MaxMana)}"; progressbarHealth.Foreground = warlockPrimaryBrush; progressbarSecondary.Foreground = warlockSecondaryBrush; break; case WowClass.Warrior: progressbarSecondary.Maximum = AmeisenBot.ObjectManager.Player.MaxRage; progressbarSecondary.Value = AmeisenBot.ObjectManager.Player.Rage; labelCurrentSecondary.Content = $"{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.Rage)}/{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.MaxRage)}"; progressbarHealth.Foreground = warriorPrimaryBrush; progressbarSecondary.Foreground = warriorSecondaryBrush; break; default: progressbarSecondary.Maximum = AmeisenBot.ObjectManager.Player.MaxMana; progressbarSecondary.Value = AmeisenBot.ObjectManager.Player.Mana; labelCurrentSecondary.Content = $"{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.Mana)}/{BotUtils.BigValueToString(AmeisenBot.ObjectManager.Player.MaxMana)}"; break; } if (LastStateMachineTick + TimeSpan.FromSeconds(1) < DateTime.Now) { double executionMs = AmeisenBot.CurrentExecutionMs; if (double.IsNaN(executionMs) || double.IsInfinity(executionMs)) { executionMs = 0; } labelCurrentTickTime.Content = executionMs; if (executionMs <= Config.StateMachineTickMs) { labelCurrentTickTime.Foreground = currentTickTimeGoodBrush; } else { labelCurrentTickTime.Foreground = currentTickTimeBadBrush; } LastStateMachineTick = DateTime.Now; } labelCurrentObjectCount.Content = AmeisenBot.ObjectManager.WowObjects.Count; }); }