Skip to content

Commit

Permalink
Merge pull request #226 from Xian55/feature/frontend/header-comp
Browse files Browse the repository at this point in the history
Frontend: BotHeader component shows more info about the status of the initial obtaining process.
  • Loading branch information
Xian55 authored Jan 15, 2022
2 parents a1c632f + 15501b2 commit 10b1ff6
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 11 deletions.
20 changes: 10 additions & 10 deletions BlazorServer/Pages/BotHeader.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,33 @@
<div class="card-header">
Player <ToggleButton />
<span class="float-right badge @CombatBadge()">@Core.GOAP.GoapKeyDescription.ToString(Core.GOAP.GoapKey.incombat, PlayerInCombat)</span>
<span class="float-right">@playerReader.Race @playerReader.Class | </span>
</div>
<div class="card-body" style="padding-bottom: 0">
<table class="table table-bordered">
<tr>
<th>Level @playerReader.Level.Value (XP: @((int)playerReader.PlayerXpPercentage)%)</th>
<th>Level @playerReader.Level.Value<br>(XP: @((int)playerReader.PlayerXpPercentage)%)</th>
<th>Health / Resource:</th>
<th>Bag Items:</th>
<th>Health:</th>
<th>Mana / Rage / Energy:</th>
<th>Actionbar / Spell / Talent:</th>
<th>Target:</th>
<th>Actionbar:</th>
</tr>
<tr>
<td>
Time to level: @levelTracker.TimeToLevel<br />
at @levelTracker.PredictedLevelUpTime.ToString("HH:mm:ss")
</td>
<td>@playerReader.HealthCurrent (@playerReader.HealthPercent %)<br />@playerReader.PTCurrent (@playerReader.PTPercentage %)</td>

<td>@addonReader.BagReader.BagItems.Count / @addonReader.BagReader.SlotCount</td>
<td>@playerReader.HealthPercent %</td>
<td>@playerReader.PTCurrent (@playerReader.PTPercentage %) </td>
<td>@addonReader.ActionBarCostReader.Count / @addonReader.SpellBookReader.Count / @addonReader.TalentReader.Count</td>
<td>
@if (!string.IsNullOrEmpty(addonReader.TargetName))
@if (addonReader.PlayerReader.Bits.HasTarget)
{
<a href="https://tbc.wowhead.com/[email protected]" target="_blank">
<div>
@addonReader.TargetName<br/>
(@playerReader.TargetLevel) @((int)playerReader.TargetHealthPercentage) %<br/>
@addonReader.TargetName<br />
(@playerReader.TargetLevel) @((int)playerReader.TargetHealthPercentage) %<br />
GUID: @playerReader.TargetGuid

@if (!playerReader.Bits.TargetIsNormal)
Expand All @@ -55,7 +56,6 @@
<div>Kills: @levelTracker.MobsKilled</div>
}
</td>
<td>@addonReader.ActionBarCostReader.Count</td>
</tr>
</table>

Expand Down
3 changes: 3 additions & 0 deletions Core/Addon/ConfigAddonReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ public class ConfigAddonReader : IAddonReader
public LevelTracker LevelTracker { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public ActionBarCostReader ActionBarCostReader { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }

public SpellBookReader SpellBookReader { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public TalentReader TalentReader { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }

public WorldMapAreaDB WorldMapAreaDb { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }

public double AvgUpdateLatency => throw new NotImplementedException();
Expand Down
4 changes: 4 additions & 0 deletions Core/Addon/IAddonReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ public interface IAddonReader

ActionBarCostReader ActionBarCostReader { get; }

SpellBookReader SpellBookReader { get; }

TalentReader TalentReader { get; }

LevelTracker LevelTracker { get; }

WorldMapAreaDB WorldMapAreaDb { get; }
Expand Down
2 changes: 2 additions & 0 deletions Core/Addon/SpellBookReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class SpellBookReader
private readonly ISquareReader reader;
public SpellDB SpellDB { private set; get; }

public int Count => Spells.Count;

public Dictionary<int, Spell> Spells { get; private set; } = new Dictionary<int, Spell>();

public SpellBookReader(ISquareReader reader, int cSpellId, SpellDB spellDB)
Expand Down
2 changes: 1 addition & 1 deletion Core/Bag/BagReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void Read()

if (metaChanged || inventoryChanged || (DateTime.Now - this.lastEvent).TotalSeconds > 11)
{
DataChanged?.Invoke(this, new EventArgs());
DataChanged?.Invoke(this, EventArgs.Empty);
lastEvent = DateTime.Now;
}
}
Expand Down
2 changes: 2 additions & 0 deletions Core/Talents/TalentReader.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using Core.Talents;
using Core.Database;
using System.Linq;

namespace Core
{
Expand All @@ -11,6 +12,7 @@ public class TalentReader
private readonly ISquareReader reader;
private readonly PlayerReader playerReader;
private readonly TalentDB talentDB;
public int Count => Talents.Sum(x => x.Value.CurrentRank);

public Dictionary<int, Talent> Talents { get; private set; } = new Dictionary<int, Talent>();

Expand Down

0 comments on commit 10b1ff6

Please sign in to comment.