private void DrawInGameBeasts()
{
foreach (var trackedBeast in _trackedBeasts
.Select(x => new
{
Positioned = x.Value.GetComponent<Positioned>(),
Beast = BeastsDatabase.AllBeasts.FirstOrDefault(b => x.Value.Metadata == b.Path),
Buffs = x.Value.Buffs
})
.Where(x => x.Positioned != null && x.Beast != null && Settings.Beasts.Any(s => s.Path == x.Beast.Path)))
{
if(trackedBeast.Buffs.Find(b => b.Name == "capture_monster_trapped") != null)
{
continue;
}
var beast = trackedBeast.Beast;
var pos = GameController.IngameState.Data.ToWorldWithTerrainHeight(trackedBeast.Positioned.GridPosition);
Graphics.DrawText(beast.DisplayName, GameController.IngameState.Camera.WorldToScreen(pos), Color.White,
FontAlign.Center);
DrawFilledCircleInWorldPosition(pos, 50, GetSpecialBeastColor(beast.DisplayName));
}
}
private void DrawBeastsWindow()
{
ImGui.SetNextWindowSize(new Vector2(0, 0));
ImGui.SetNextWindowBgAlpha(0.6f);
ImGui.Begin("Beasts Window", ImGuiWindowFlags.NoDecoration);
if (ImGui.BeginTable("Beasts Table", 2,
ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV))
{
ImGui.TableSetupColumn("Price", ImGuiTableColumnFlags.WidthFixed, 48);
ImGui.TableSetupColumn("Beast");
foreach (var (beast,beastMetadata) in _trackedBeasts
.Select(trackedBeast => trackedBeast.Value)
.Select(beast => (beast, metadata: Settings.Beasts.Find(b => b.Path == beast.Metadata)))
.Where(b => b.metadata != null))
{
if (beast?.Buffs?.Find(b => b.Name == "capture_monster_trapped") != null)
{
continue;
}
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.Text(Settings.BeastPrices.TryGetValue(beastMetadata.DisplayName, out var price)
? $"{price.ToString(CultureInfo.InvariantCulture)}c"
: "0c");
ImGui.TableNextColumn();
ImGui.Text(beastMetadata.DisplayName);
foreach (var craft in beastMetadata.Crafts)
{
ImGui.Text(craft);
}
}
ImGui.EndTable();
}
ImGui.End();
}
Suggesting from temp333 on ownedcore to better handle clearing found beasts from overlay.
beasts.render.cs