Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Assets/Filters/Dead.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Filters/HealthFull.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Filters/HealthLow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Filters/Shimmer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/GUI/BringHere.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/GUI/Frozen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/GUI/GoTo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/GUI/Grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/GUI/List.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/GUI/ShimmerBackground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/GUI/Sort.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Misc/Shimmer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Stats/Ammo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Stats/BiomeBackground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Stats/BossDamage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Stats/Coin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Stats/Defense.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Stats/Distance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Stats/Heart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Stats/HeldItem.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Stats/InventoryCount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Stats/Mana.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Stats/MinionCount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Stats/NearbyEnemies.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Stats/Ping.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Stats/PlayerFull.png
Binary file added Assets/Stats/PlayerHead.png
Binary file added Assets/Stats/Position.png
Binary file added Assets/Stats/PvE.png
Binary file added Assets/Stats/PvP.png
Binary file added Assets/Stats/Stopwatch.png
Binary file added Assets/Stats/TeamWhite.png
Binary file added Assets/Stats/Time.png
Binary file added Assets/Stats/WhiteBackground.png
29 changes: 29 additions & 0 deletions Content/Filters/PlayerManagerFilters/BackgroundOptionFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using DragonLens.Content.Tools.Multiplayer;
using DragonLens.Helpers;
using ReLogic.Content;

namespace DragonLens.Content.Filters.PlayerManagerFilters
{
internal sealed class BackgroundOptionFilter : Filter
{
private readonly PlayerManagerBrowser browser;
private readonly string key;

public BackgroundOptionFilter(PlayerManagerBrowser browser, string key, Asset<Texture2D> texture)
: base(texture, LocalizationHelper.GetToolText($"PlayerManager.Filters.{key}"), _ => false)
{
this.browser = browser;
this.key = key;
isModFilter = true;
}

public override string Description => LocalizationHelper.GetToolText($"PlayerManager.Filters.{key}.Toggle");
public bool Enabled => browser.Settings.IsBackgroundMode(key);

public void Toggle()
{
bool enabled = browser.Settings.IsBackgroundMode(key);
browser.Settings.SetBackgroundMode(key, !enabled);
}
}
}
62 changes: 62 additions & 0 deletions Content/Filters/PlayerManagerFilters/BiomeFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using DragonLens.Content.Tools.Multiplayer;
using DragonLens.Helpers;
using System;
using Terraria.GameContent.Bestiary;
using Terraria.Localization;

namespace DragonLens.Content.Filters.PlayerManagerFilters
{
internal sealed class BiomeFilter : Filter
{
private readonly SpawnConditionBestiaryInfoElement biome;
private readonly Func<Player, bool> matchesPlayer;
private readonly string customName;
private readonly Asset<Texture2D> customTexture;

public BiomeFilter(SpawnConditionBestiaryInfoElement biome)
: base(null, "", n => n is not PlayerManagerItem item || !BiomeHelper.MatchesBiome(item.player, biome))
{
this.biome = biome;
}

public BiomeFilter(string name, Asset<Texture2D> texture, Func<Player, bool> matchesPlayer)
: base(null, "", n => n is not PlayerManagerItem item || !matchesPlayer(item.player))
{
customName = name;
customTexture = texture;
this.matchesPlayer = matchesPlayer;
}

public override string Name
{
get
{
if (customName != null)
return customName;

if (biome == BiomeHelper.ShimmerBiome)
return "Aether";

return biome != null ? Language.GetTextValue(biome.GetDisplayNameKey()) : "Unknown";
}
}
public override string Description => "";

public override void Draw(SpriteBatch spriteBatch, Rectangle target)
{
if (customTexture != null)
{
Texture2D tex = customTexture.Value;
int widest = Math.Max(tex.Width, tex.Height);
spriteBatch.Draw(tex, target.Center.ToVector2(), null, Color.White, 0f, tex.Size() * 0.5f, target.Width / (float)widest, SpriteEffects.None, 0f);
return;
}

if (biome == null || !BiomeHelper.TryGetBestiaryIconDrawData(biome, out Asset<Texture2D> texture, out Rectangle source))
return;

float scale = Math.Min((float)target.Width / source.Width, (float)target.Height / source.Height);
spriteBatch.Draw(texture.Value, target.Center.ToVector2(), source, Color.White, 0f, source.Size() * 0.5f, scale, SpriteEffects.None, 0f);
}
}
}
28 changes: 28 additions & 0 deletions Content/Filters/PlayerManagerFilters/ButtonOptionFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using DragonLens.Content.Tools.Multiplayer;
using DragonLens.Helpers;
using ReLogic.Content;

namespace DragonLens.Content.Filters.PlayerManagerFilters.Toggles
{
internal sealed class ButtonOptionFilter : Filter
{
private readonly PlayerManagerBrowser browser;
private readonly string key;

public ButtonOptionFilter(PlayerManagerBrowser browser, string key, Asset<Texture2D> texture)
: base(texture, LocalizationHelper.GetToolText($"PlayerManager.Filters.{key}"), _ => false)
{
this.browser = browser;
this.key = key;
}
public override string Name => base.Name + " Button";
public override string Description => LocalizationHelper.GetToolText($"PlayerManager.Filters.{key}.Toggle");

public bool Enabled => browser.Settings.IsButtonVisible(key);

public void Toggle()
{
browser.Settings.SetButtonVisible(key, !browser.Settings.IsButtonVisible(key));
}
}
}
32 changes: 32 additions & 0 deletions Content/Filters/PlayerManagerFilters/PlayerOptionFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using DragonLens.Content.Tools.Multiplayer;
using DragonLens.Helpers;
using ReLogic.Content;

namespace DragonLens.Content.Filters.PlayerManagerFilters
{
internal sealed class PlayerOptionFilter : Filter
{
private readonly PlayerManagerBrowser browser;
private readonly string key;

public PlayerOptionFilter(PlayerManagerBrowser browser, string key, Asset<Texture2D> texture)
: base(texture, LocalizationHelper.GetToolText($"PlayerManager.Filters.{key}"), _ => false)
{
this.browser = browser;
this.key = key;
isModFilter = true;
}

public override string Description => LocalizationHelper.GetToolText($"PlayerManager.Filters.{key}.Toggle");
public bool Enabled => browser.Settings.IsPlayerMode(key);

public void Toggle()
{
bool enabled = browser.Settings.IsPlayerMode(key);
browser.Settings.SetPlayerMode(key, !enabled);

// Debug print
//Main.NewText(key + ": " + !enabled);
}
}
}
29 changes: 29 additions & 0 deletions Content/Filters/PlayerManagerFilters/StatOptionFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using DragonLens.Content.Tools.Multiplayer;
using DragonLens.Helpers;
using ReLogic.Content;
using System;

namespace DragonLens.Content.Filters.PlayerManagerFilters.Toggles
{
internal sealed class StatOptionFilter : Filter
{
private readonly PlayerManagerBrowser browser;
private readonly string key;

public StatOptionFilter(PlayerManagerBrowser browser, string key, Asset<Texture2D> texture)
: base(texture, LocalizationHelper.GetToolText($"PlayerManager.Filters.{key}"), _ => false)
{
this.browser = browser;
this.key = key;
}
public override string Description => LocalizationHelper.GetToolText($"PlayerManager.Filters.{key}.Toggle");
public bool Enabled => browser.Settings.IsStatVisible(key);

public void Toggle()
{
bool enabled = browser.Settings.IsStatVisible(key);
int availableHeight = browser.listMode ? Math.Max(48, browser.buttonSize) : browser.buttonSize;
browser.Settings.TryToggleStat(key, !enabled, browser.listMode, availableHeight);
}
}
}
33 changes: 33 additions & 0 deletions Content/Filters/PlayerManagerFilters/TeamFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
namespace DragonLens.Content.Filters.PlayerManagerFilters
{

/// <summary>
/// Draw filter with a custom spritesheet
/// Used for team icon filters
/// </summary>
internal class TeamFilter : Filter
{
public Rectangle sourceRect;
public Point drawSize;
public Color color = Color.White;

public TeamFilter(Asset<Texture2D> texture, string localizationKey, FilterDelegate shouldFilter, Rectangle sourceRect, Point drawSize)
: base(texture, localizationKey, shouldFilter)
{
this.sourceRect = sourceRect;
this.drawSize = drawSize;
}

public override void Draw(SpriteBatch spriteBatch, Rectangle target)
{
Rectangle drawRect = new(
target.X + (target.Width - drawSize.X) / 2,
target.Y + (target.Height - drawSize.Y) / 2,
drawSize.X,
drawSize.Y
);

spriteBatch.Draw(texture.Value, drawRect, sourceRect, color);
}
}
}
Loading